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