1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _LDAP_VAL_H 28*7c478bd9Sstevel@tonic-gate #define _LDAP_VAL_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <rpcsvc/nis.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include "ldap_parse.h" 39*7c478bd9Sstevel@tonic-gate #include "ldap_ruleval.h" 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* 42*7c478bd9Sstevel@tonic-gate * If we got values for the columns in the ruleval struct (from LDAP 43*7c478bd9Sstevel@tonic-gate * or got from the query itself) then we assign the status to 44*7c478bd9Sstevel@tonic-gate * NP_LDAP_MAP_SUCCESS. If we have enough NIS+ columns for the 45*7c478bd9Sstevel@tonic-gate * rules to produce a value, but none of the rules produce a 46*7c478bd9Sstevel@tonic-gate * value, then we pass NP_LDAP_RULES_NO_VALUE from 47*7c478bd9Sstevel@tonic-gate * createLdapRequest() as an indication to proceed to the next 48*7c478bd9Sstevel@tonic-gate * table mapping. NP_LDAP_NO_VALUE is used to indicate that 49*7c478bd9Sstevel@tonic-gate * the element didn't have an entry in the LDAP. 50*7c478bd9Sstevel@tonic-gate */ 51*7c478bd9Sstevel@tonic-gate #define NP_LDAP_MAP_SUCCESS 1 52*7c478bd9Sstevel@tonic-gate #define NP_LDAP_RULES_NO_VALUE 2 53*7c478bd9Sstevel@tonic-gate #define NP_LDAP_NO_VALUE 3 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate /* Exported functions */ 56*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *cloneMappingFormat(__nis_mapping_format_t *m); 57*7c478bd9Sstevel@tonic-gate void freeMappingFormat(__nis_mapping_format_t *m); 58*7c478bd9Sstevel@tonic-gate void copyIndex(__nis_index_t *old, __nis_index_t *nnew, 59*7c478bd9Sstevel@tonic-gate int *err); 60*7c478bd9Sstevel@tonic-gate __nis_index_t *cloneIndex(__nis_index_t *old); 61*7c478bd9Sstevel@tonic-gate void freeIndex(__nis_index_t *old, bool_t doFree); 62*7c478bd9Sstevel@tonic-gate char **cloneName(char **name, int numNames); 63*7c478bd9Sstevel@tonic-gate void freeValue(__nis_value_t *val, int count); 64*7c478bd9Sstevel@tonic-gate __nis_value_t *cloneValue(__nis_value_t *val, int count); 65*7c478bd9Sstevel@tonic-gate __nis_value_t *getMappingItemVal(__nis_mapping_item_t *i, 66*7c478bd9Sstevel@tonic-gate __nis_mapping_item_type_t native, 67*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, char *berstring, 68*7c478bd9Sstevel@tonic-gate int *np_ldap_stat); 69*7c478bd9Sstevel@tonic-gate __nis_value_t *getMappingFormat(__nis_mapping_format_t *f, 70*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, __nis_format_arg_t at, 71*7c478bd9Sstevel@tonic-gate void *a, int *numArg); 72*7c478bd9Sstevel@tonic-gate __nis_value_t *explodeValues(__nis_value_t *v1, __nis_value_t *v2); 73*7c478bd9Sstevel@tonic-gate __nis_value_t *getMappingFormatArray(__nis_mapping_format_t *a, 74*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, __nis_format_arg_t at, 75*7c478bd9Sstevel@tonic-gate int numArgs, void *arg); 76*7c478bd9Sstevel@tonic-gate char *getIndex(__nis_index_t *i, int *len); 77*7c478bd9Sstevel@tonic-gate char *getObjSpec(__nis_obj_spec_t *o, int *len); 78*7c478bd9Sstevel@tonic-gate char *getScope(int scope); 79*7c478bd9Sstevel@tonic-gate char *getSearchTriple(__nis_search_triple_t *s, int *len); 80*7c478bd9Sstevel@tonic-gate __nis_value_t *getMappingItem(__nis_mapping_item_t *i, 81*7c478bd9Sstevel@tonic-gate __nis_mapping_item_type_t native, 82*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, char *berstring, 83*7c478bd9Sstevel@tonic-gate int *np_ldap_stat); 84*7c478bd9Sstevel@tonic-gate void copyObjSpec(__nis_obj_spec_t *old, 85*7c478bd9Sstevel@tonic-gate __nis_obj_spec_t *nnew, int *err); 86*7c478bd9Sstevel@tonic-gate __nis_obj_spec_t *cloneObjSpec(__nis_obj_spec_t *old); 87*7c478bd9Sstevel@tonic-gate void freeObjSpec(__nis_obj_spec_t *old, bool_t doFree); 88*7c478bd9Sstevel@tonic-gate void copySearchTriple(__nis_search_triple_t *old, 89*7c478bd9Sstevel@tonic-gate __nis_search_triple_t *nnew, int *err); 90*7c478bd9Sstevel@tonic-gate __nis_search_triple_t *cloneSearchTriple(__nis_search_triple_t *old); 91*7c478bd9Sstevel@tonic-gate void freeSearchTriple(__nis_search_triple_t *old, 92*7c478bd9Sstevel@tonic-gate bool_t doFree); 93*7c478bd9Sstevel@tonic-gate void copyTripleOrObj(__nis_mapping_item_type_t type, 94*7c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t *old, 95*7c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t *nnew, int *err); 96*7c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t *cloneTripleOrObj(__nis_mapping_item_type_t type, 97*7c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t *old); 98*7c478bd9Sstevel@tonic-gate void freeTripleOrObj(__nis_mapping_item_type_t type, 99*7c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t *old, 100*7c478bd9Sstevel@tonic-gate bool_t doFree); 101*7c478bd9Sstevel@tonic-gate void copyItem(__nis_mapping_item_t *old, 102*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t *nnew, int *err); 103*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t *cloneItem(__nis_mapping_item_t *old); 104*7c478bd9Sstevel@tonic-gate void freeMappingItem(__nis_mapping_item_t *item, 105*7c478bd9Sstevel@tonic-gate int numItems); 106*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t *concatenateMappingItem(__nis_mapping_item_t *old, 107*7c478bd9Sstevel@tonic-gate int numItems, __nis_mapping_item_t *cat); 108*7c478bd9Sstevel@tonic-gate __nis_value_t *concatenateValues(__nis_value_t *v1, 109*7c478bd9Sstevel@tonic-gate __nis_value_t *v2); 110*7c478bd9Sstevel@tonic-gate __nis_value_t *splitMappingItem(__nis_mapping_item_t *item, 111*7c478bd9Sstevel@tonic-gate char delim, __nis_rule_value_t *rv); 112*7c478bd9Sstevel@tonic-gate char *scanMappingFormat(__nis_mapping_format_t *f, 113*7c478bd9Sstevel@tonic-gate int curf, int nf, char *str, char **val, 114*7c478bd9Sstevel@tonic-gate char **fmtstart, char *sepset); 115*7c478bd9Sstevel@tonic-gate int verifyMappingMatch(__nis_mapping_format_t *f, 116*7c478bd9Sstevel@tonic-gate char *str); 117*7c478bd9Sstevel@tonic-gate __nis_value_t **matchMappingItem(__nis_mapping_format_t *f, 118*7c478bd9Sstevel@tonic-gate __nis_value_t *inVal, int *numVals, 119*7c478bd9Sstevel@tonic-gate char *sepset, char **outstr); 120*7c478bd9Sstevel@tonic-gate __nis_value_t *extractMappingItem(__nis_mapping_item_t *item, 121*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *f, 122*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, int *np_ldap_stat); 123*7c478bd9Sstevel@tonic-gate void stringElide(__nis_value_t *val, char elide); 124*7c478bd9Sstevel@tonic-gate __nis_value_t *getMappingSubElement(__nis_mapping_sub_element_t *e, 125*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, int *np_ldap_stat); 126*7c478bd9Sstevel@tonic-gate __nis_value_t *getMappingElement(__nis_mapping_element_t *e, 127*7c478bd9Sstevel@tonic-gate __nis_mapping_item_type_t native, 128*7c478bd9Sstevel@tonic-gate __nis_rule_value_t *rv, int *stat); 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 131*7c478bd9Sstevel@tonic-gate } 132*7c478bd9Sstevel@tonic-gate #endif 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate #endif /* _LDAP_VAL_H */ 135