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 2004 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 _NIS_PARSE_LDAP_CONF_H 28*7c478bd9Sstevel@tonic-gate #define _NIS_PARSE_LDAP_CONF_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 <lber.h> 37*7c478bd9Sstevel@tonic-gate #include <ldap.h> 38*7c478bd9Sstevel@tonic-gate #include <iso/limits_iso.h> 39*7c478bd9Sstevel@tonic-gate #include "ldap_parse.h" 40*7c478bd9Sstevel@tonic-gate #include "nisdb_ldap.h" 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate #define DEFAULT_MAPPING_FILE "/var/nis/NIS+LDAPmapping" 43*7c478bd9Sstevel@tonic-gate #define YP_DEFAULT_MAPPING_FILE "/var/yp/NISLDAPmapping" 44*7c478bd9Sstevel@tonic-gate #define mmt_berstring_null ((__nis_mapping_match_type_t)-1) 45*7c478bd9Sstevel@tonic-gate #define ESCAPE_CHAR '\\' 46*7c478bd9Sstevel@tonic-gate #define EQUAL_CHAR '=' 47*7c478bd9Sstevel@tonic-gate #define COMMA_CHAR ',' 48*7c478bd9Sstevel@tonic-gate #define COMMA_STRING "," 49*7c478bd9Sstevel@tonic-gate #define OPEN_PAREN_CHAR '(' 50*7c478bd9Sstevel@tonic-gate #define CLOSE_PAREN_CHAR ')' 51*7c478bd9Sstevel@tonic-gate #define DOUBLE_QUOTE_CHAR '"' 52*7c478bd9Sstevel@tonic-gate #define PERIOD_CHAR '.' 53*7c478bd9Sstevel@tonic-gate #define COLON_CHAR ':' 54*7c478bd9Sstevel@tonic-gate #define POUND_SIGN '#' 55*7c478bd9Sstevel@tonic-gate #define SEMI_COLON_CHAR ';' 56*7c478bd9Sstevel@tonic-gate #define QUESTION_MARK '?' 57*7c478bd9Sstevel@tonic-gate #define PLUS_SIGN '+' 58*7c478bd9Sstevel@tonic-gate #define PERCENT_SIGN '%' 59*7c478bd9Sstevel@tonic-gate #define OPEN_BRACKET '[' 60*7c478bd9Sstevel@tonic-gate #define CLOSE_BRACKET ']' 61*7c478bd9Sstevel@tonic-gate #define ASTERIX_CHAR '*' 62*7c478bd9Sstevel@tonic-gate #define DASH_CHAR '-' 63*7c478bd9Sstevel@tonic-gate #define SINGLE_QUOTE_CHAR '\'' 64*7c478bd9Sstevel@tonic-gate #define DEFAULT_COMMENT_CHAR '#' 65*7c478bd9Sstevel@tonic-gate #define DEFAULT_SEP_STRING " " 66*7c478bd9Sstevel@tonic-gate #define SPACE_CHAR ' ' 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate #define FOREVER -1 69*7c478bd9Sstevel@tonic-gate #define FIFTEEN_SECONDS 15 70*7c478bd9Sstevel@tonic-gate #define TWO_MINUTES 120 71*7c478bd9Sstevel@tonic-gate #define THIRTY_MINUTES 1800 72*7c478bd9Sstevel@tonic-gate #define THREE_MINUTES 180 73*7c478bd9Sstevel@tonic-gate #define ONE_HOUR 3600 74*7c478bd9Sstevel@tonic-gate #define MAX_LDAP_CONFIG_RETRY_TIME 60 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate #define NO_VALUE_SET -2 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate #define INITIAL_UPDATE_NO_ACTION -3 79*7c478bd9Sstevel@tonic-gate #define NO_INITIAL_UPDATE_NO_ACTION -4 80*7c478bd9Sstevel@tonic-gate #define FROM_NO_INITIAL_UPDATE -5 81*7c478bd9Sstevel@tonic-gate #define TO_NO_INITIAL_UPDATE -6 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate #define BUFSIZE 8192 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate #ifndef UINT32_MAX 86*7c478bd9Sstevel@tonic-gate #define UINT32_MAX (4294967295U) 87*7c478bd9Sstevel@tonic-gate #endif 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate #define IS_TERMINAL_CHAR(c) \ 90*7c478bd9Sstevel@tonic-gate ((c) == QUESTION_MARK || \ 91*7c478bd9Sstevel@tonic-gate (c) == EQUAL_CHAR || \ 92*7c478bd9Sstevel@tonic-gate (c) == COMMA_CHAR || \ 93*7c478bd9Sstevel@tonic-gate (c) == CLOSE_PAREN_CHAR || \ 94*7c478bd9Sstevel@tonic-gate (c) == COLON_CHAR || \ 95*7c478bd9Sstevel@tonic-gate (c) == SEMI_COLON_CHAR) 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate #define TIME_MAX LONG_MAX 98*7c478bd9Sstevel@tonic-gate #define WILL_OVERFLOW_TIME(t, d) ((t) > TIME_MAX/10 || \ 99*7c478bd9Sstevel@tonic-gate ((t) == TIME_MAX/10 && d > TIME_MAX % 10)) 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate #define LIMIT_MAX (65535) 102*7c478bd9Sstevel@tonic-gate #define WILL_OVERFLOW_LIMIT(t, d) ((t) > LIMIT_MAX/10 || \ 103*7c478bd9Sstevel@tonic-gate ((t) == LIMIT_MAX/10 && d > LIMIT_MAX % 10)) 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate #define WILL_OVERFLOW_INT(t, d) ((t) > INT_MAX/10 || \ 106*7c478bd9Sstevel@tonic-gate ((t) == INT_MAX/10 && d > INT_MAX % 10)) 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate /* initial configuration keywords */ 109*7c478bd9Sstevel@tonic-gate /* for NIS+ */ 110*7c478bd9Sstevel@tonic-gate #define CONFIG_DN "nisplusLDAPconfigDN" 111*7c478bd9Sstevel@tonic-gate #define CONFIG_SERVER_LIST "nisplusLDAPconfigPreferredServerList" 112*7c478bd9Sstevel@tonic-gate #define CONFIG_AUTH_METHOD "nisplusLDAPconfigAuthenticationMethod" 113*7c478bd9Sstevel@tonic-gate #define CONFIG_TLS_OPTION "nisplusLDAPconfigTLS" 114*7c478bd9Sstevel@tonic-gate #define CONFIG_TLS_CERT_DB "nisplusLDAPconfigTLSCertificateDBPath" 115*7c478bd9Sstevel@tonic-gate #define CONFIG_PROXY_USER "nisplusLDAPconfigProxyUser" 116*7c478bd9Sstevel@tonic-gate #define CONFIG_PROXY_PASSWD "nisplusLDAPconfigProxyPassword" 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate #define IS_CONFIG_KEYWORD(x) \ 119*7c478bd9Sstevel@tonic-gate ((x) >= key_config_dn && (x) <= key_config_proxy_passwd) 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* LDAP server keywords */ 122*7c478bd9Sstevel@tonic-gate /* for NIS+ */ 123*7c478bd9Sstevel@tonic-gate #define PREFERRED_SERVERS "preferredServerList" 124*7c478bd9Sstevel@tonic-gate #define AUTH_METHOD "authenticationMethod" 125*7c478bd9Sstevel@tonic-gate #define TLS_OPTION "nisplusLDAPTLS" 126*7c478bd9Sstevel@tonic-gate #define TLS_CERT_DB "nisplusLDAPTLSCertificateDBPath" 127*7c478bd9Sstevel@tonic-gate #define SEARCH_BASE "defaultSearchBase" 128*7c478bd9Sstevel@tonic-gate #define PROXY_USER "nisplusLDAPproxyUser" 129*7c478bd9Sstevel@tonic-gate #define PROXY_PASSWD "nisplusLDAPproxyPassword" 130*7c478bd9Sstevel@tonic-gate #define LDAP_BASE_DOMAIN "nisplusLDAPbaseDomain" 131*7c478bd9Sstevel@tonic-gate #define BIND_TIMEOUT "nisplusLDAPbindTimeout" 132*7c478bd9Sstevel@tonic-gate #define SEARCH_TIMEOUT "nisplusLDAPsearchTimeout" 133*7c478bd9Sstevel@tonic-gate #define MODIFY_TIMEOUT "nisplusLDAPmodifyTimeout" 134*7c478bd9Sstevel@tonic-gate #define ADD_TIMEOUT "nisplusLDAPaddTimeout" 135*7c478bd9Sstevel@tonic-gate #define DELETE_TIMEOUT "nisplusLDAPdeleteTimeout" 136*7c478bd9Sstevel@tonic-gate #define SEARCH_TIME_LIMIT "nisplusLDAPsearchTimeLimit" 137*7c478bd9Sstevel@tonic-gate #define SEARCH_SIZE_LIMIT "nisplusLDAPsearchSizeLimit" 138*7c478bd9Sstevel@tonic-gate #define FOLLOW_REFERRAL "nisplusLDAPfollowReferral" 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate #define IS_BIND_INFO(x) \ 141*7c478bd9Sstevel@tonic-gate ((x) >= key_preferred_servers && (x) <= key_follow_referral) 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* This information will be need to determine the server behavior */ 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate /* for NIS+ */ 146*7c478bd9Sstevel@tonic-gate #define INITIAL_UPDATE_ACTION "nisplusLDAPinitialUpdateAction" 147*7c478bd9Sstevel@tonic-gate #define INITIAL_UPDATE_ONLY "nisplusLDAPinitialUpdateOnly" 148*7c478bd9Sstevel@tonic-gate #define RETRIEVE_ERROR_ACTION "nisplusLDAPretrieveErrorAction" 149*7c478bd9Sstevel@tonic-gate #define RETREIVE_ERROR_ATTEMPTS "nisplusLDAPretrieveErrorAttempts" 150*7c478bd9Sstevel@tonic-gate #define RETREIVE_ERROR_TIMEOUT "nisplusLDAPretrieveErrorTimeout" 151*7c478bd9Sstevel@tonic-gate #define STORE_ERROR_ACTION "nisplusLDAPstoreErrorAction" 152*7c478bd9Sstevel@tonic-gate #define STORE_ERROR_ATTEMPTS "nisplusLDAPstoreErrorAttempts" 153*7c478bd9Sstevel@tonic-gate #define STORE_ERROR_TIMEOUT "nisplusLDAPstoreErrorTimeout" 154*7c478bd9Sstevel@tonic-gate #define REFRESH_ERROR_ACTION "nisplusLDAPrefreshErrorAction" 155*7c478bd9Sstevel@tonic-gate #define REFRESH_ERROR_ATTEMPTS "nisplusLDAPrefreshErrorAttempts" 156*7c478bd9Sstevel@tonic-gate #define REFRESH_ERROR_TIMEOUT "nisplusLDAPrefreshErrorTimeout" 157*7c478bd9Sstevel@tonic-gate #define THREAD_CREATE_ERROR_ACTION \ 158*7c478bd9Sstevel@tonic-gate "nisplusThreadCreationErrorAction" 159*7c478bd9Sstevel@tonic-gate #define THREAD_CREATE_ERROR_ATTEMPTS \ 160*7c478bd9Sstevel@tonic-gate "nisplusThreadCreationErrorAttempts" 161*7c478bd9Sstevel@tonic-gate #define THREAD_CREATE_ERROR_TIMEOUT \ 162*7c478bd9Sstevel@tonic-gate "nisplusThreadCreationErrorTimeout" 163*7c478bd9Sstevel@tonic-gate #define DUMP_ERROR_ACTION "nisplusDumpErrorAction" 164*7c478bd9Sstevel@tonic-gate #define DUMP_ERROR_ATTEMPTS "nisplusDumpErrorAttempts" 165*7c478bd9Sstevel@tonic-gate #define DUMP_ERROR_TIMEOUT "nisplusDumpErrorTimeout" 166*7c478bd9Sstevel@tonic-gate #define RESYNC "nisplusResyncService" 167*7c478bd9Sstevel@tonic-gate #define UPDATE_BATCHING "nisplusUpdateBatching" 168*7c478bd9Sstevel@tonic-gate #define UPDATE_BATCHING_TIMEOUT "nisplusUpdateBatchingTimeout" 169*7c478bd9Sstevel@tonic-gate #define MATCH_FETCH "nisplusLDAPmatchFetchAction" 170*7c478bd9Sstevel@tonic-gate #define NUMBER_THEADS "nisplusNumberOfServiceThreads" 171*7c478bd9Sstevel@tonic-gate #define YP_EMULATION "ENABLE_NIS_YP_EMULATION" 172*7c478bd9Sstevel@tonic-gate #define MAX_RPC_RECSIZE "nisplusMaxRPCRecordSize" 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate #define IS_OPER_INFO(x) \ 175*7c478bd9Sstevel@tonic-gate ((x) >= key_initial_update_action && (x) <= key_max_rpc_recsize) 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate #define DB_ID_MAP "nisplusLDAPdatabaseIdMapping" 178*7c478bd9Sstevel@tonic-gate #define ENTRY_TTL "nisplusLDAPentryTtl" 179*7c478bd9Sstevel@tonic-gate #define LDAP_OBJECT_DN "nisplusLDAPobjectDN" 180*7c478bd9Sstevel@tonic-gate #define LDAP_TO_NISPLUS_MAP "nisplusLDAPcolumnFromAttribute" 181*7c478bd9Sstevel@tonic-gate #define NISPLUS_TO_LDAP_MAP "nisplusLDAPattributeFromColumn" 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate /* The following definitions are for NIS */ 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_DN "nisLDAPconfigDN" 186*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_SERVER_LIST "nisLDAPconfigPreferredServerList" 187*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_AUTH_METHOD "nisLDAPconfigAuthenticationMethod" 188*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_TLS_OPTION "nisLDAPconfigTLS" 189*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_TLS_CERT_DB "nisLDAPconfigTLSCertificateDBPath" 190*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_PROXY_USER "nisLDAPconfigProxyUser" 191*7c478bd9Sstevel@tonic-gate #define YP_CONFIG_PROXY_PASSWD "nisLDAPconfigProxyPassword" 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate #define IS_YP_CONFIG_KEYWORD(x) \ 194*7c478bd9Sstevel@tonic-gate ((x) >= key_yp_config_dn && (x) <= key_yp_config_proxy_passwd) 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate #define YP_TLS_OPTION "nisLDAPTLS" 197*7c478bd9Sstevel@tonic-gate #define YP_TLS_CERT_DB "nisLDAPTLSCertificateDBPath" 198*7c478bd9Sstevel@tonic-gate #define YP_PROXY_USER "nisLDAPproxyUser" 199*7c478bd9Sstevel@tonic-gate #define YP_PROXY_PASSWD "nisLDAPproxyPassword" 200*7c478bd9Sstevel@tonic-gate #define YP_LDAP_BASE_DOMAIN "nisLDAPbaseDomain" 201*7c478bd9Sstevel@tonic-gate #define YP_BIND_TIMEOUT "nisLDAPbindTimeout" 202*7c478bd9Sstevel@tonic-gate #define YP_SEARCH_TIMEOUT "nisLDAPsearchTimeout" 203*7c478bd9Sstevel@tonic-gate #define YP_MODIFY_TIMEOUT "nisLDAPmodifyTimeout" 204*7c478bd9Sstevel@tonic-gate #define YP_ADD_TIMEOUT "nisLDAPaddTimeout" 205*7c478bd9Sstevel@tonic-gate #define YP_DELETE_TIMEOUT "nisLDAPdeleteTimeout" 206*7c478bd9Sstevel@tonic-gate #define YP_SEARCH_TIME_LIMIT "nisLDAPsearchTimeLimit" 207*7c478bd9Sstevel@tonic-gate #define YP_SEARCH_SIZE_LIMIT "nisLDAPsearchSizeLimit" 208*7c478bd9Sstevel@tonic-gate #define YP_FOLLOW_REFERRAL "nisLDAPfollowReferral" 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate #define IS_YP_BIND_INFO(x) \ 211*7c478bd9Sstevel@tonic-gate ((x) == key_preferred_servers || \ 212*7c478bd9Sstevel@tonic-gate (x) == key_auth_method || \ 213*7c478bd9Sstevel@tonic-gate (x) == key_search_base || \ 214*7c478bd9Sstevel@tonic-gate ((x) >= key_yp_tls_option && (x) <= key_yp_follow_referral)) 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate #define YP_RETRIEVE_ERROR_ACTION "nisLDAPretrieveErrorAction" 217*7c478bd9Sstevel@tonic-gate #define YP_RETREIVE_ERROR_ATTEMPTS "nisLDAPretrieveErrorAttempts" 218*7c478bd9Sstevel@tonic-gate #define YP_RETREIVE_ERROR_TIMEOUT "nisLDAPretrieveErrorTimeout" 219*7c478bd9Sstevel@tonic-gate #define YP_STORE_ERROR_ACTION "nisLDAPstoreErrorAction" 220*7c478bd9Sstevel@tonic-gate #define YP_STORE_ERROR_ATTEMPTS "nisLDAPstoreErrorAttempts" 221*7c478bd9Sstevel@tonic-gate #define YP_STORE_ERROR_TIMEOUT "nisLDAPstoreErrorTimeout" 222*7c478bd9Sstevel@tonic-gate #define YP_MATCH_FETCH "nisLDAPmatchFetchAction" 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate #define IS_YP_OPER_INFO(x) \ 225*7c478bd9Sstevel@tonic-gate ((x) >= key_yp_retrieve_error_action && (x) <= key_yp_match_fetch) 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate #define YP_DOMAIN_CONTEXT "nisLDAPdomainContext" 228*7c478bd9Sstevel@tonic-gate #define YPPASSWDD_DOMAINS "nisLDAPyppasswddDomains" 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate #define IS_YP_DOMAIN_INFO(x) \ 231*7c478bd9Sstevel@tonic-gate ((x) >= key_yp_domain_context && (x) <= key_yppasswdd_domains) 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate #define YP_DB_ID_MAP "nisLDAPdatabaseIdMapping" 234*7c478bd9Sstevel@tonic-gate #define YP_COMMENT_CHAR "nisLDAPcommentChar" 235*7c478bd9Sstevel@tonic-gate #define YP_MAP_FLAGS "nisLDAPmapFlags" 236*7c478bd9Sstevel@tonic-gate #define YP_ENTRY_TTL "nisLDAPentryTtl" 237*7c478bd9Sstevel@tonic-gate #define YP_NAME_FIELDS "nisLDAPnameFields" 238*7c478bd9Sstevel@tonic-gate #define YP_SPLIT_FIELD "nisLDAPsplitField" 239*7c478bd9Sstevel@tonic-gate #define YP_REPEATED_FIELD_SEPARATORS "nisLDAPrepeatedFieldSeparators" 240*7c478bd9Sstevel@tonic-gate #define YP_LDAP_OBJECT_DN "nisLDAPobjectDN" 241*7c478bd9Sstevel@tonic-gate #define LDAP_TO_NIS_MAP "nisLDAPfieldFromAttribute" 242*7c478bd9Sstevel@tonic-gate #define NIS_TO_LDAP_MAP "nisLDAPattributeFromField" 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate #define IS_YP_MAP_ATTR(x) \ 245*7c478bd9Sstevel@tonic-gate ((x) == key_yp_domain_context || \ 246*7c478bd9Sstevel@tonic-gate (x) == key_yppasswdd_domains || \ 247*7c478bd9Sstevel@tonic-gate ((x) >= key_yp_db_id_map && (x) <= key_nis_to_ldap_map)) 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate #define DEFAULT_YP_SEARCH_TIMEOUT THREE_MINUTES 250*7c478bd9Sstevel@tonic-gate #define DEFAULT_BIND_TIMEOUT FIFTEEN_SECONDS 251*7c478bd9Sstevel@tonic-gate #define DEFAULT_SEARCH_TIMEOUT FIFTEEN_SECONDS 252*7c478bd9Sstevel@tonic-gate #define DEFAULT_MODIFY_TIMEOUT FIFTEEN_SECONDS 253*7c478bd9Sstevel@tonic-gate #define DEFAULT_ADD_TIMEOUT FIFTEEN_SECONDS 254*7c478bd9Sstevel@tonic-gate #define DEFAULT_DELETE_TIMEOUT FIFTEEN_SECONDS 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate #define DEFAULT_SEARCH_TIME_LIMIT LDAP_NO_LIMIT 257*7c478bd9Sstevel@tonic-gate #define DEFAULT_SEARCH_SIZE_LIMIT LDAP_NO_LIMIT 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate #define DEFAULT_THREAD_ERROR_ATTEMPTS FOREVER 260*7c478bd9Sstevel@tonic-gate #define DEFAULT_THREAD_ERROR_TIME_OUT FIFTEEN_SECONDS 261*7c478bd9Sstevel@tonic-gate #define DEFAULT_DUMP_ERROR_ATTEMPTS FOREVER 262*7c478bd9Sstevel@tonic-gate #define DEFAULT_DUMP_ERROR_TIME_OUT FIFTEEN_SECONDS 263*7c478bd9Sstevel@tonic-gate #define DEFAULT_RETRIEVE_ERROR_ATTEMPTS FOREVER 264*7c478bd9Sstevel@tonic-gate #define DEFAULT_RETRIEVE_ERROR_TIME_OUT FIFTEEN_SECONDS 265*7c478bd9Sstevel@tonic-gate #define DEFAULT_STORE_ERROR_ATTEMPTS FOREVER 266*7c478bd9Sstevel@tonic-gate #define DEFAULT_STORE_ERROR_TIME_OUT FIFTEEN_SECONDS 267*7c478bd9Sstevel@tonic-gate #define DEFAULT_REFRESH_ERROR_ATTEMPTS FOREVER 268*7c478bd9Sstevel@tonic-gate #define DEFAULT_REFRESH_ERROR_TIME_OUT FIFTEEN_SECONDS 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate #define DEFAULT_BATCHING_TIME_OUT TWO_MINUTES 271*7c478bd9Sstevel@tonic-gate #define DEFAULT_NUMBER_OF_THREADS 0 272*7c478bd9Sstevel@tonic-gate #define DEFAULT_YP_EMULATION 0 273*7c478bd9Sstevel@tonic-gate 274*7c478bd9Sstevel@tonic-gate #define DEFAULT_TTL_HIGH (ONE_HOUR + THIRTY_MINUTES) 275*7c478bd9Sstevel@tonic-gate #define DEFAULT_TTL_LOW (ONE_HOUR - THIRTY_MINUTES) 276*7c478bd9Sstevel@tonic-gate #define DEFAULT_TTL ONE_HOUR 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate typedef enum { 279*7c478bd9Sstevel@tonic-gate no_parse_error, 280*7c478bd9Sstevel@tonic-gate parse_no_mem_error, 281*7c478bd9Sstevel@tonic-gate parse_bad_key, 282*7c478bd9Sstevel@tonic-gate parse_bad_continuation_error, 283*7c478bd9Sstevel@tonic-gate parse_line_too_long, 284*7c478bd9Sstevel@tonic-gate parse_internal_error, 285*7c478bd9Sstevel@tonic-gate parse_initial_update_action_error, 286*7c478bd9Sstevel@tonic-gate parse_initial_update_only_error, 287*7c478bd9Sstevel@tonic-gate parse_retrieve_error_action_error, 288*7c478bd9Sstevel@tonic-gate parse_store_error_action_error, 289*7c478bd9Sstevel@tonic-gate parse_refresh_error_action_error, 290*7c478bd9Sstevel@tonic-gate parse_thread_create_error_action_error, 291*7c478bd9Sstevel@tonic-gate parse_dump_error_action_error, 292*7c478bd9Sstevel@tonic-gate parse_resync_error, 293*7c478bd9Sstevel@tonic-gate parse_update_batching_error, 294*7c478bd9Sstevel@tonic-gate parse_match_fetch_error, 295*7c478bd9Sstevel@tonic-gate parse_no_object_dn, 296*7c478bd9Sstevel@tonic-gate parse_invalid_scope, 297*7c478bd9Sstevel@tonic-gate parse_invalid_ldap_search_filter, 298*7c478bd9Sstevel@tonic-gate parse_semi_expected_error, 299*7c478bd9Sstevel@tonic-gate parse_mismatched_brackets, 300*7c478bd9Sstevel@tonic-gate parse_unsupported_format, 301*7c478bd9Sstevel@tonic-gate parse_unexpected_dash, 302*7c478bd9Sstevel@tonic-gate parse_unmatched_escape, 303*7c478bd9Sstevel@tonic-gate parse_bad_lhs_format_error, 304*7c478bd9Sstevel@tonic-gate parse_comma_expected_error, 305*7c478bd9Sstevel@tonic-gate parse_equal_expected_error, 306*7c478bd9Sstevel@tonic-gate parse_close_paren_expected_error, 307*7c478bd9Sstevel@tonic-gate parse_too_many_extract_items, 308*7c478bd9Sstevel@tonic-gate parse_not_enough_extract_items, 309*7c478bd9Sstevel@tonic-gate parse_bad_print_format, 310*7c478bd9Sstevel@tonic-gate parse_bad_elide_char, 311*7c478bd9Sstevel@tonic-gate parse_start_rhs_unrecognized, 312*7c478bd9Sstevel@tonic-gate parse_item_expected_error, 313*7c478bd9Sstevel@tonic-gate parse_format_string_expected_error, 314*7c478bd9Sstevel@tonic-gate parse_unexpected_data_end_rule, 315*7c478bd9Sstevel@tonic-gate parse_bad_ttl_format_error, 316*7c478bd9Sstevel@tonic-gate parse_bad_auth_method_error, 317*7c478bd9Sstevel@tonic-gate parse_open_file_error, 318*7c478bd9Sstevel@tonic-gate parse_no_proxy_dn_error, 319*7c478bd9Sstevel@tonic-gate parse_no_config_auth_error, 320*7c478bd9Sstevel@tonic-gate parse_no_proxy_auth_error, 321*7c478bd9Sstevel@tonic-gate parse_ldap_init_error, 322*7c478bd9Sstevel@tonic-gate parse_ldap_bind_error, 323*7c478bd9Sstevel@tonic-gate parse_ldap_search_error, 324*7c478bd9Sstevel@tonic-gate parse_ldap_get_values_error, 325*7c478bd9Sstevel@tonic-gate parse_object_dn_syntax_error, 326*7c478bd9Sstevel@tonic-gate parse_invalid_dn, 327*7c478bd9Sstevel@tonic-gate parse_bad_index_format, 328*7c478bd9Sstevel@tonic-gate parse_bad_item_format, 329*7c478bd9Sstevel@tonic-gate parse_bad_ldap_item_format, 330*7c478bd9Sstevel@tonic-gate parse_invalid_print_arg, 331*7c478bd9Sstevel@tonic-gate parse_bad_extract_format_spec, 332*7c478bd9Sstevel@tonic-gate parse_no_db_del_mapping_rule, 333*7c478bd9Sstevel@tonic-gate parse_invalid_db_del_mapping_rule, 334*7c478bd9Sstevel@tonic-gate parse_bad_domain_name, 335*7c478bd9Sstevel@tonic-gate parse_bad_dn, 336*7c478bd9Sstevel@tonic-gate parse_yes_or_no_expected_error, 337*7c478bd9Sstevel@tonic-gate parse_bad_uint_error, 338*7c478bd9Sstevel@tonic-gate parse_bad_int_error, 339*7c478bd9Sstevel@tonic-gate parse_bad_command_line_attribute_format, 340*7c478bd9Sstevel@tonic-gate parse_no_ldap_server_error, 341*7c478bd9Sstevel@tonic-gate parse_bad_ber_format, 342*7c478bd9Sstevel@tonic-gate parse_no_config_server_addr, 343*7c478bd9Sstevel@tonic-gate parse_bad_time_error, 344*7c478bd9Sstevel@tonic-gate parse_lhs_rhs_type_mismatch, 345*7c478bd9Sstevel@tonic-gate parse_no_match_item, 346*7c478bd9Sstevel@tonic-gate parse_cannot_elide, 347*7c478bd9Sstevel@tonic-gate parse_bad_tls_option_error, 348*7c478bd9Sstevel@tonic-gate parse_ldapssl_client_init_error, 349*7c478bd9Sstevel@tonic-gate parse_ldapssl_init_error, 350*7c478bd9Sstevel@tonic-gate parse_no_available_referrals_error, 351*7c478bd9Sstevel@tonic-gate parse_no_config_cert_db, 352*7c478bd9Sstevel@tonic-gate parse_no_cert_db, 353*7c478bd9Sstevel@tonic-gate parse_unknown_yp_domain_error, 354*7c478bd9Sstevel@tonic-gate parse_unexpected_yp_domain_end_error, 355*7c478bd9Sstevel@tonic-gate parse_bad_map_error, 356*7c478bd9Sstevel@tonic-gate parse_bad_yp_comment_error, 357*7c478bd9Sstevel@tonic-gate parse_bad_field_separator_error, 358*7c478bd9Sstevel@tonic-gate parse_bad_name_field, 359*7c478bd9Sstevel@tonic-gate parse_yp_retrieve_error_action_error, 360*7c478bd9Sstevel@tonic-gate parse_yp_store_error_action_error 361*7c478bd9Sstevel@tonic-gate } parse_error; 362*7c478bd9Sstevel@tonic-gate 363*7c478bd9Sstevel@tonic-gate typedef enum { 364*7c478bd9Sstevel@tonic-gate no_conn_error, 365*7c478bd9Sstevel@tonic-gate conn_no_mem_error, 366*7c478bd9Sstevel@tonic-gate conn_ldap_init_error, 367*7c478bd9Sstevel@tonic-gate conn_unsupported_ldap_bind_method, 368*7c478bd9Sstevel@tonic-gate conn_ldap_bind_error 369*7c478bd9Sstevel@tonic-gate } conn_error; 370*7c478bd9Sstevel@tonic-gate 371*7c478bd9Sstevel@tonic-gate typedef enum { 372*7c478bd9Sstevel@tonic-gate key_bad = -1, 373*7c478bd9Sstevel@tonic-gate no_more_keys = 0, 374*7c478bd9Sstevel@tonic-gate key_config_dn = 1, 375*7c478bd9Sstevel@tonic-gate key_config_server_list, 376*7c478bd9Sstevel@tonic-gate key_config_auth_method, 377*7c478bd9Sstevel@tonic-gate key_config_tls_option, 378*7c478bd9Sstevel@tonic-gate key_config_tls_certificate_db, 379*7c478bd9Sstevel@tonic-gate key_config_proxy_user, 380*7c478bd9Sstevel@tonic-gate key_config_proxy_passwd, 381*7c478bd9Sstevel@tonic-gate key_preferred_servers, 382*7c478bd9Sstevel@tonic-gate key_auth_method, 383*7c478bd9Sstevel@tonic-gate key_tls_option, 384*7c478bd9Sstevel@tonic-gate key_tls_certificate_db, 385*7c478bd9Sstevel@tonic-gate key_search_base, 386*7c478bd9Sstevel@tonic-gate key_proxy_user, 387*7c478bd9Sstevel@tonic-gate key_proxy_passwd, 388*7c478bd9Sstevel@tonic-gate key_ldap_base_domain, 389*7c478bd9Sstevel@tonic-gate key_bind_timeout, 390*7c478bd9Sstevel@tonic-gate key_search_timeout, 391*7c478bd9Sstevel@tonic-gate key_modify_timeout, 392*7c478bd9Sstevel@tonic-gate key_add_timeout, 393*7c478bd9Sstevel@tonic-gate key_delete_timeout, 394*7c478bd9Sstevel@tonic-gate key_search_time_limit, 395*7c478bd9Sstevel@tonic-gate key_search_size_limit, 396*7c478bd9Sstevel@tonic-gate key_follow_referral, 397*7c478bd9Sstevel@tonic-gate key_initial_update_action, 398*7c478bd9Sstevel@tonic-gate key_initial_update_only, 399*7c478bd9Sstevel@tonic-gate key_retrieve_error_action, 400*7c478bd9Sstevel@tonic-gate key_retrieve_error_attempts, 401*7c478bd9Sstevel@tonic-gate key_retreive_error_timeout, 402*7c478bd9Sstevel@tonic-gate key_store_error_action, 403*7c478bd9Sstevel@tonic-gate key_store_error_attempts, 404*7c478bd9Sstevel@tonic-gate key_store_error_timeout, 405*7c478bd9Sstevel@tonic-gate key_refresh_error_action, 406*7c478bd9Sstevel@tonic-gate key_refresh_error_attempts, 407*7c478bd9Sstevel@tonic-gate key_refresh_error_timeout, 408*7c478bd9Sstevel@tonic-gate key_thread_create_error_action, 409*7c478bd9Sstevel@tonic-gate key_thread_create_error_attempts, 410*7c478bd9Sstevel@tonic-gate key_thread_create_error_timeout, 411*7c478bd9Sstevel@tonic-gate key_dump_error_action, 412*7c478bd9Sstevel@tonic-gate key_dump_error_attempts, 413*7c478bd9Sstevel@tonic-gate key_dump_error_timeout, 414*7c478bd9Sstevel@tonic-gate key_resync, 415*7c478bd9Sstevel@tonic-gate key_update_batching, 416*7c478bd9Sstevel@tonic-gate key_update_batching_timeout, 417*7c478bd9Sstevel@tonic-gate key_match_fetch, 418*7c478bd9Sstevel@tonic-gate key_number_threads, 419*7c478bd9Sstevel@tonic-gate key_yp_emulation, 420*7c478bd9Sstevel@tonic-gate key_max_rpc_recsize, 421*7c478bd9Sstevel@tonic-gate key_db_id_map, 422*7c478bd9Sstevel@tonic-gate key_entry_ttl, 423*7c478bd9Sstevel@tonic-gate key_ldap_object_dn, 424*7c478bd9Sstevel@tonic-gate key_ldap_to_nisplus_map, 425*7c478bd9Sstevel@tonic-gate key_nisplus_to_ldap_map, 426*7c478bd9Sstevel@tonic-gate key_yp_config_dn, 427*7c478bd9Sstevel@tonic-gate key_yp_config_server_list, 428*7c478bd9Sstevel@tonic-gate key_yp_config_auth_method, 429*7c478bd9Sstevel@tonic-gate key_yp_config_tls_option, 430*7c478bd9Sstevel@tonic-gate key_yp_config_tls_certificate_db, 431*7c478bd9Sstevel@tonic-gate key_yp_config_proxy_user, 432*7c478bd9Sstevel@tonic-gate key_yp_config_proxy_passwd, 433*7c478bd9Sstevel@tonic-gate key_yp_preferred_servers, 434*7c478bd9Sstevel@tonic-gate key_yp_auth_method, 435*7c478bd9Sstevel@tonic-gate key_yp_tls_option, 436*7c478bd9Sstevel@tonic-gate key_yp_tls_certificate_db, 437*7c478bd9Sstevel@tonic-gate key_yp_search_base, 438*7c478bd9Sstevel@tonic-gate key_yp_proxy_user, 439*7c478bd9Sstevel@tonic-gate key_yp_proxy_passwd, 440*7c478bd9Sstevel@tonic-gate key_yp_ldap_base_domain, 441*7c478bd9Sstevel@tonic-gate key_yp_bind_timeout, 442*7c478bd9Sstevel@tonic-gate key_yp_search_timeout, 443*7c478bd9Sstevel@tonic-gate key_yp_modify_timeout, 444*7c478bd9Sstevel@tonic-gate key_yp_add_timeout, 445*7c478bd9Sstevel@tonic-gate key_yp_delete_timeout, 446*7c478bd9Sstevel@tonic-gate key_yp_search_time_limit, 447*7c478bd9Sstevel@tonic-gate key_yp_search_size_limit, 448*7c478bd9Sstevel@tonic-gate key_yp_follow_referral, 449*7c478bd9Sstevel@tonic-gate key_yp_retrieve_error_action, 450*7c478bd9Sstevel@tonic-gate key_yp_retrieve_error_attempts, 451*7c478bd9Sstevel@tonic-gate key_yp_retreive_error_timeout, 452*7c478bd9Sstevel@tonic-gate key_yp_store_error_action, 453*7c478bd9Sstevel@tonic-gate key_yp_store_error_attempts, 454*7c478bd9Sstevel@tonic-gate key_yp_store_error_timeout, 455*7c478bd9Sstevel@tonic-gate key_yp_match_fetch, 456*7c478bd9Sstevel@tonic-gate key_yp_domain_context, 457*7c478bd9Sstevel@tonic-gate key_yppasswdd_domains, 458*7c478bd9Sstevel@tonic-gate key_yp_db_id_map, 459*7c478bd9Sstevel@tonic-gate key_yp_comment_char, 460*7c478bd9Sstevel@tonic-gate key_yp_map_flags, 461*7c478bd9Sstevel@tonic-gate key_yp_entry_ttl, 462*7c478bd9Sstevel@tonic-gate key_yp_name_fields, 463*7c478bd9Sstevel@tonic-gate key_yp_split_field, 464*7c478bd9Sstevel@tonic-gate key_yp_repeated_field_separators, 465*7c478bd9Sstevel@tonic-gate key_yp_ldap_object_dn, 466*7c478bd9Sstevel@tonic-gate key_ldap_to_nis_map, 467*7c478bd9Sstevel@tonic-gate key_nis_to_ldap_map, 468*7c478bd9Sstevel@tonic-gate n_config_keys 469*7c478bd9Sstevel@tonic-gate } config_key; 470*7c478bd9Sstevel@tonic-gate 471*7c478bd9Sstevel@tonic-gate typedef enum { 472*7c478bd9Sstevel@tonic-gate string_token, 473*7c478bd9Sstevel@tonic-gate quoted_string_token, 474*7c478bd9Sstevel@tonic-gate equal_token, 475*7c478bd9Sstevel@tonic-gate comma_token, 476*7c478bd9Sstevel@tonic-gate open_paren_token, 477*7c478bd9Sstevel@tonic-gate close_paren_token, 478*7c478bd9Sstevel@tonic-gate colon_token, 479*7c478bd9Sstevel@tonic-gate no_token 480*7c478bd9Sstevel@tonic-gate } token_type; 481*7c478bd9Sstevel@tonic-gate 482*7c478bd9Sstevel@tonic-gate typedef enum { 483*7c478bd9Sstevel@tonic-gate dn_no_token, 484*7c478bd9Sstevel@tonic-gate dn_semi_token, 485*7c478bd9Sstevel@tonic-gate dn_ques_token, 486*7c478bd9Sstevel@tonic-gate dn_colon_token, 487*7c478bd9Sstevel@tonic-gate dn_base_token, 488*7c478bd9Sstevel@tonic-gate dn_one_token, 489*7c478bd9Sstevel@tonic-gate dn_sub_token, 490*7c478bd9Sstevel@tonic-gate dn_text_token 491*7c478bd9Sstevel@tonic-gate } object_dn_token; 492*7c478bd9Sstevel@tonic-gate 493*7c478bd9Sstevel@tonic-gate typedef enum { 494*7c478bd9Sstevel@tonic-gate dn_begin_parse, 495*7c478bd9Sstevel@tonic-gate dn_got_read_dn, 496*7c478bd9Sstevel@tonic-gate dn_got_read_q_scope, 497*7c478bd9Sstevel@tonic-gate dn_got_read_scope, 498*7c478bd9Sstevel@tonic-gate dn_got_read_q_filter, 499*7c478bd9Sstevel@tonic-gate dn_got_read_filter, 500*7c478bd9Sstevel@tonic-gate dn_got_write_colon, 501*7c478bd9Sstevel@tonic-gate dn_got_write_dn, 502*7c478bd9Sstevel@tonic-gate dn_got_write_q_scope, 503*7c478bd9Sstevel@tonic-gate dn_got_write_scope, 504*7c478bd9Sstevel@tonic-gate dn_got_write_q_filter, 505*7c478bd9Sstevel@tonic-gate dn_got_write_filter, 506*7c478bd9Sstevel@tonic-gate dn_got_delete_colon, 507*7c478bd9Sstevel@tonic-gate dn_got_delete_dsp 508*7c478bd9Sstevel@tonic-gate } parse_object_dn_state; 509*7c478bd9Sstevel@tonic-gate 510*7c478bd9Sstevel@tonic-gate typedef enum { 511*7c478bd9Sstevel@tonic-gate none = 1, 512*7c478bd9Sstevel@tonic-gate simple, 513*7c478bd9Sstevel@tonic-gate cram_md5, 514*7c478bd9Sstevel@tonic-gate digest_md5 515*7c478bd9Sstevel@tonic-gate } auth_method_t; 516*7c478bd9Sstevel@tonic-gate 517*7c478bd9Sstevel@tonic-gate typedef enum { 518*7c478bd9Sstevel@tonic-gate no_tls = 1, 519*7c478bd9Sstevel@tonic-gate ssl_tls 520*7c478bd9Sstevel@tonic-gate } tls_method_t; 521*7c478bd9Sstevel@tonic-gate 522*7c478bd9Sstevel@tonic-gate typedef struct { 523*7c478bd9Sstevel@tonic-gate char *config_dn; 524*7c478bd9Sstevel@tonic-gate char *default_servers; 525*7c478bd9Sstevel@tonic-gate auth_method_t auth_method; 526*7c478bd9Sstevel@tonic-gate tls_method_t tls_method; 527*7c478bd9Sstevel@tonic-gate char *proxy_dn; 528*7c478bd9Sstevel@tonic-gate char *proxy_passwd; 529*7c478bd9Sstevel@tonic-gate char *tls_cert_db; 530*7c478bd9Sstevel@tonic-gate } __nis_config_info_t; 531*7c478bd9Sstevel@tonic-gate 532*7c478bd9Sstevel@tonic-gate typedef enum { 533*7c478bd9Sstevel@tonic-gate follow = 1, 534*7c478bd9Sstevel@tonic-gate no_follow 535*7c478bd9Sstevel@tonic-gate } follow_referral_t; 536*7c478bd9Sstevel@tonic-gate 537*7c478bd9Sstevel@tonic-gate typedef struct { 538*7c478bd9Sstevel@tonic-gate char *default_servers; 539*7c478bd9Sstevel@tonic-gate auth_method_t auth_method; 540*7c478bd9Sstevel@tonic-gate tls_method_t tls_method; 541*7c478bd9Sstevel@tonic-gate char *default_search_base; 542*7c478bd9Sstevel@tonic-gate char *proxy_dn; 543*7c478bd9Sstevel@tonic-gate char *proxy_passwd; 544*7c478bd9Sstevel@tonic-gate char *tls_cert_db; 545*7c478bd9Sstevel@tonic-gate char *default_nis_domain; 546*7c478bd9Sstevel@tonic-gate struct timeval bind_timeout; 547*7c478bd9Sstevel@tonic-gate struct timeval search_timeout; 548*7c478bd9Sstevel@tonic-gate struct timeval modify_timeout; 549*7c478bd9Sstevel@tonic-gate struct timeval add_timeout; 550*7c478bd9Sstevel@tonic-gate struct timeval delete_timeout; 551*7c478bd9Sstevel@tonic-gate int search_time_limit; 552*7c478bd9Sstevel@tonic-gate int search_size_limit; 553*7c478bd9Sstevel@tonic-gate follow_referral_t follow_referral; 554*7c478bd9Sstevel@tonic-gate } __nis_ldap_proxy_info; 555*7c478bd9Sstevel@tonic-gate 556*7c478bd9Sstevel@tonic-gate extern __nisdb_table_mapping_t ldapDBTableMapping; 557*7c478bd9Sstevel@tonic-gate extern __nis_ldap_proxy_info proxyInfo; 558*7c478bd9Sstevel@tonic-gate extern __nis_table_mapping_t *ldapTableMapping; 559*7c478bd9Sstevel@tonic-gate 560*7c478bd9Sstevel@tonic-gate extern int parse_ldap_migration(const char *const *cmdline_options, 561*7c478bd9Sstevel@tonic-gate const char *config_file); 562*7c478bd9Sstevel@tonic-gate 563*7c478bd9Sstevel@tonic-gate extern void get_ldap_connection(LDAP **ld, time_t retry_time); 564*7c478bd9Sstevel@tonic-gate extern void free_ldap_connection(LDAP *ld); 565*7c478bd9Sstevel@tonic-gate extern void return_ldap_connection(LDAP *ld); 566*7c478bd9Sstevel@tonic-gate extern void free_ldap_connections(); 567*7c478bd9Sstevel@tonic-gate 568*7c478bd9Sstevel@tonic-gate 569*7c478bd9Sstevel@tonic-gate extern void initialize_parse_structs(__nis_ldap_proxy_info *proxy_info, 570*7c478bd9Sstevel@tonic-gate __nis_config_t *config_info, __nisdb_table_mapping_t *table_info); 571*7c478bd9Sstevel@tonic-gate extern void initialize_yp_parse_structs(__yp_domain_context_t *ypDomains); 572*7c478bd9Sstevel@tonic-gate 573*7c478bd9Sstevel@tonic-gate /* Deallocation functions */ 574*7c478bd9Sstevel@tonic-gate extern void free_parse_structs(void); 575*7c478bd9Sstevel@tonic-gate extern void free_yp_domain_context(__yp_domain_context_t *domains); 576*7c478bd9Sstevel@tonic-gate extern void free_config_info(__nis_config_info_t *config_info); 577*7c478bd9Sstevel@tonic-gate extern void free_mapping_rule(__nis_mapping_rule_t *rule); 578*7c478bd9Sstevel@tonic-gate extern void free_object_dn(__nis_object_dn_t *obj_dn); 579*7c478bd9Sstevel@tonic-gate extern void free_mapping_format(__nis_mapping_format_t *fmt); 580*7c478bd9Sstevel@tonic-gate extern void free_index(__nis_index_t *index); 581*7c478bd9Sstevel@tonic-gate extern void free_mapping_item(__nis_mapping_item_t *item); 582*7c478bd9Sstevel@tonic-gate extern void free_mapping_element(__nis_mapping_element_t *e); 583*7c478bd9Sstevel@tonic-gate extern void free_mapping_sub_element(__nis_mapping_sub_element_t *sub); 584*7c478bd9Sstevel@tonic-gate extern void free_proxy_info(__nis_ldap_proxy_info *proxy_info); 585*7c478bd9Sstevel@tonic-gate extern void free_table_mapping(__nis_table_mapping_t *mapping); 586*7c478bd9Sstevel@tonic-gate 587*7c478bd9Sstevel@tonic-gate /* Parser functions */ 588*7c478bd9Sstevel@tonic-gate extern int read_line(int fd, char *buffer, int buflen); 589*7c478bd9Sstevel@tonic-gate extern __nis_table_mapping_t *find_table_mapping(const char *s, int len, 590*7c478bd9Sstevel@tonic-gate __nis_table_mapping_t *table_mapping); 591*7c478bd9Sstevel@tonic-gate extern int second_parser_pass(__nis_table_mapping_t **table_mapping); 592*7c478bd9Sstevel@tonic-gate extern int final_parser_pass(__nis_table_mapping_t **table_mapping, 593*7c478bd9Sstevel@tonic-gate __yp_domain_context_t *ypDomains); 594*7c478bd9Sstevel@tonic-gate extern int finish_parse(__nis_ldap_proxy_info *proxy_info, 595*7c478bd9Sstevel@tonic-gate __nis_table_mapping_t **table_mapping); 596*7c478bd9Sstevel@tonic-gate extern void set_default_values(__nis_ldap_proxy_info *proxy_info, 597*7c478bd9Sstevel@tonic-gate __nis_config_t *config_info, __nisdb_table_mapping_t *table_info); 598*7c478bd9Sstevel@tonic-gate 599*7c478bd9Sstevel@tonic-gate extern int add_config_attribute(config_key attrib_num, const char *attrib_val, 600*7c478bd9Sstevel@tonic-gate int attrib_len, __nis_config_info_t *config_info); 601*7c478bd9Sstevel@tonic-gate extern int add_bind_attribute(config_key attrib_num, const char *attrib_val, 602*7c478bd9Sstevel@tonic-gate int attrib_len, __nis_ldap_proxy_info *proxy_info); 603*7c478bd9Sstevel@tonic-gate extern int add_operation_attribute(config_key attrib_num, 604*7c478bd9Sstevel@tonic-gate const char *attrib_val, int attrib_len, __nis_config_t *config_info, 605*7c478bd9Sstevel@tonic-gate __nisdb_table_mapping_t *table_info); 606*7c478bd9Sstevel@tonic-gate extern int add_mapping_attribute(config_key attrib_num, const char *attrib_val, 607*7c478bd9Sstevel@tonic-gate int attrib_len, __nis_table_mapping_t **table_mapping); 608*7c478bd9Sstevel@tonic-gate extern int add_ypdomains_attribute(config_key attrib_num, 609*7c478bd9Sstevel@tonic-gate const char *attrib_val, int attrib_len, 610*7c478bd9Sstevel@tonic-gate __yp_domain_context_t *ypDomains); 611*7c478bd9Sstevel@tonic-gate extern config_key get_attrib_num(const char *s, int n); 612*7c478bd9Sstevel@tonic-gate bool_t is_cmd_line_option(config_key a_num); 613*7c478bd9Sstevel@tonic-gate 614*7c478bd9Sstevel@tonic-gate extern const char * 615*7c478bd9Sstevel@tonic-gate skip_get_dn(const char *dn, const char *end); 616*7c478bd9Sstevel@tonic-gate extern const char *get_search_triple(const char *s, const char *end_s, 617*7c478bd9Sstevel@tonic-gate __nis_search_triple_t *triple); 618*7c478bd9Sstevel@tonic-gate extern bool_t parse_index(const char *s, const char *end_s, 619*7c478bd9Sstevel@tonic-gate __nis_index_t *index); 620*7c478bd9Sstevel@tonic-gate extern bool_t add_element(__nis_mapping_element_t *e, 621*7c478bd9Sstevel@tonic-gate __nis_mapping_rlhs_t *m); 622*7c478bd9Sstevel@tonic-gate extern const char *skip_token(const char *s, const char *end_s, 623*7c478bd9Sstevel@tonic-gate token_type t); 624*7c478bd9Sstevel@tonic-gate extern const char *get_next_extract_format_item(const char *begin_fmt, 625*7c478bd9Sstevel@tonic-gate const char *end_fmt, __nis_mapping_format_t *fmt); 626*7c478bd9Sstevel@tonic-gate extern const char *get_next_print_format_item(const char *begin_fmt, 627*7c478bd9Sstevel@tonic-gate const char *end_fmt, __nis_mapping_format_t *fmt); 628*7c478bd9Sstevel@tonic-gate extern const char *get_next_token(const char **begin_token, 629*7c478bd9Sstevel@tonic-gate const char **end_token, token_type *t); 630*7c478bd9Sstevel@tonic-gate extern const char *get_next_object_dn_token(const char **begin_ret, 631*7c478bd9Sstevel@tonic-gate const char **end_ret, object_dn_token *token); 632*7c478bd9Sstevel@tonic-gate extern const char *get_ldap_filter(const char **begin, const char **end); 633*7c478bd9Sstevel@tonic-gate const char *get_ava_list(const char **begin, const char **end, 634*7c478bd9Sstevel@tonic-gate bool_t end_nisplus); 635*7c478bd9Sstevel@tonic-gate 636*7c478bd9Sstevel@tonic-gate extern void init_yptol_flag(); 637*7c478bd9Sstevel@tonic-gate /* Utility functions */ 638*7c478bd9Sstevel@tonic-gate extern char *s_strndup_esc(const char *s, int n); 639*7c478bd9Sstevel@tonic-gate extern char *s_strndup(const char *s, int n); 640*7c478bd9Sstevel@tonic-gate extern char *s_strdup(const char *s); 641*7c478bd9Sstevel@tonic-gate extern void *s_calloc(size_t n, size_t size); 642*7c478bd9Sstevel@tonic-gate extern void *s_realloc(void *s, size_t size); 643*7c478bd9Sstevel@tonic-gate extern bool_t is_whitespace(int c); 644*7c478bd9Sstevel@tonic-gate extern bool_t contains_string(const char *s1, const char *s2); 645*7c478bd9Sstevel@tonic-gate extern const char *skip_string(const char *s1, const char *s2, int len); 646*7c478bd9Sstevel@tonic-gate extern bool_t same_string(const char *s1, const char *s2, int len); 647*7c478bd9Sstevel@tonic-gate 648*7c478bd9Sstevel@tonic-gate /* Error and information reporting functions */ 649*7c478bd9Sstevel@tonic-gate extern void report_error(const char *str, const char *attr); 650*7c478bd9Sstevel@tonic-gate extern void report_error2(const char *str1, const char *str2); 651*7c478bd9Sstevel@tonic-gate extern void report_info(const char *str, const char *arg); 652*7c478bd9Sstevel@tonic-gate extern void report_conn_error(conn_error e, const char *str1, const char *str2); 653*7c478bd9Sstevel@tonic-gate extern void warn_duplicate_map(const char *db_id, config_key attrib_num); 654*7c478bd9Sstevel@tonic-gate 655*7c478bd9Sstevel@tonic-gate /* Validation functions */ 656*7c478bd9Sstevel@tonic-gate extern bool_t validate_dn(const char *s, int len); 657*7c478bd9Sstevel@tonic-gate extern bool_t validate_ldap_filter(const char *s, const char *end); 658*7c478bd9Sstevel@tonic-gate 659*7c478bd9Sstevel@tonic-gate extern int start_line_num; 660*7c478bd9Sstevel@tonic-gate extern int cur_line_num; 661*7c478bd9Sstevel@tonic-gate extern int seq_num; 662*7c478bd9Sstevel@tonic-gate extern parse_error p_error; 663*7c478bd9Sstevel@tonic-gate extern char _key_val[38]; 664*7c478bd9Sstevel@tonic-gate extern const char *command_line_source; 665*7c478bd9Sstevel@tonic-gate extern const char *file_source; 666*7c478bd9Sstevel@tonic-gate extern const char *ldap_source; 667*7c478bd9Sstevel@tonic-gate extern const char *warn_file; 668*7c478bd9Sstevel@tonic-gate 669*7c478bd9Sstevel@tonic-gate /* SSL and sasl-digest md5 functions */ 670*7c478bd9Sstevel@tonic-gate int ldapssl_client_init(const char *certdbpath, void *certdbhandle); 671*7c478bd9Sstevel@tonic-gate const char *ldapssl_err2string(const int prerrno); 672*7c478bd9Sstevel@tonic-gate LDAP *ldapssl_init(const char *defhost, int defport, int defsecure); 673*7c478bd9Sstevel@tonic-gate int ldap_x_sasl_digest_md5_bind_s(LDAP *ld, char *user_name, 674*7c478bd9Sstevel@tonic-gate struct berval *cred, 675*7c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls); 676*7c478bd9Sstevel@tonic-gate 677*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 678*7c478bd9Sstevel@tonic-gate } 679*7c478bd9Sstevel@tonic-gate #endif 680*7c478bd9Sstevel@tonic-gate 681*7c478bd9Sstevel@tonic-gate #endif /* _NIS_PARSE_LDAP_CONF_H */ 682