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