4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _NIS_PARSE_LDAP_CONF_H
28 #define _NIS_PARSE_LDAP_CONF_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
38 #include <iso/limits_iso.h>
39 #include "ldap_parse.h"
40 #include "nisdb_ldap.h"
42 #define DEFAULT_MAPPING_FILE "/var/nis/NIS+LDAPmapping"
43 #define YP_DEFAULT_MAPPING_FILE "/var/yp/NISLDAPmapping"
44 #define mmt_berstring_null ((__nis_mapping_match_type_t)-1)
45 #define ESCAPE_CHAR '\\'
46 #define EQUAL_CHAR '='
47 #define COMMA_CHAR ','
48 #define COMMA_STRING ","
49 #define OPEN_PAREN_CHAR '('
50 #define CLOSE_PAREN_CHAR ')'
51 #define DOUBLE_QUOTE_CHAR '"'
52 #define PERIOD_CHAR '.'
53 #define COLON_CHAR ':'
54 #define POUND_SIGN '#'
55 #define SEMI_COLON_CHAR ';'
56 #define QUESTION_MARK '?'
58 #define PERCENT_SIGN '%'
59 #define OPEN_BRACKET '['
60 #define CLOSE_BRACKET ']'
61 #define ASTERIX_CHAR '*'
63 #define SINGLE_QUOTE_CHAR '\''
64 #define DEFAULT_COMMENT_CHAR '#'
65 #define DEFAULT_SEP_STRING " "
66 #define SPACE_CHAR ' '
69 #define FIFTEEN_SECONDS 15
70 #define TWO_MINUTES 120
71 #define THIRTY_MINUTES 1800
72 #define THREE_MINUTES 180
74 #define MAX_LDAP_CONFIG_RETRY_TIME 60
76 #define NO_VALUE_SET -2
78 #define INITIAL_UPDATE_NO_ACTION -3
79 #define NO_INITIAL_UPDATE_NO_ACTION -4
80 #define FROM_NO_INITIAL_UPDATE -5
81 #define TO_NO_INITIAL_UPDATE -6
86 #define UINT32_MAX (4294967295U)
89 #define IS_TERMINAL_CHAR(c) \
90 ((c) == QUESTION_MARK || \
91 (c) == EQUAL_CHAR || \
92 (c) == COMMA_CHAR || \
93 (c) == CLOSE_PAREN_CHAR || \
94 (c) == COLON_CHAR || \
95 (c) == SEMI_COLON_CHAR)
97 #define TIME_MAX LONG_MAX
98 #define WILL_OVERFLOW_TIME(t, d) ((t) > TIME_MAX/10 || \
99 ((t) == TIME_MAX/10 && d > TIME_MAX % 10))
101 #define LIMIT_MAX (65535)
102 #define WILL_OVERFLOW_LIMIT(t, d) ((t) > LIMIT_MAX/10 || \
103 ((t) == LIMIT_MAX/10 && d > LIMIT_MAX % 10))
105 #define WILL_OVERFLOW_INT(t, d) ((t) > INT_MAX/10 || \
106 ((t) == INT_MAX/10 && d > INT_MAX % 10))
108 /* initial configuration keywords */
110 #define CONFIG_DN "nisplusLDAPconfigDN"
111 #define CONFIG_SERVER_LIST "nisplusLDAPconfigPreferredServerList"
112 #define CONFIG_AUTH_METHOD "nisplusLDAPconfigAuthenticationMethod"
113 #define CONFIG_TLS_OPTION "nisplusLDAPconfigTLS"
114 #define CONFIG_TLS_CERT_DB "nisplusLDAPconfigTLSCertificateDBPath"
115 #define CONFIG_PROXY_USER "nisplusLDAPconfigProxyUser"
116 #define CONFIG_PROXY_PASSWD "nisplusLDAPconfigProxyPassword"
118 #define IS_CONFIG_KEYWORD(x) \
119 ((x) >= key_config_dn && (x) <= key_config_proxy_passwd)
121 /* LDAP server keywords */
123 #define PREFERRED_SERVERS "preferredServerList"
124 #define AUTH_METHOD "authenticationMethod"
125 #define TLS_OPTION "nisplusLDAPTLS"
126 #define TLS_CERT_DB "nisplusLDAPTLSCertificateDBPath"
127 #define SEARCH_BASE "defaultSearchBase"
128 #define PROXY_USER "nisplusLDAPproxyUser"
129 #define PROXY_PASSWD "nisplusLDAPproxyPassword"
130 #define LDAP_BASE_DOMAIN "nisplusLDAPbaseDomain"
131 #define BIND_TIMEOUT "nisplusLDAPbindTimeout"
132 #define SEARCH_TIMEOUT "nisplusLDAPsearchTimeout"
133 #define MODIFY_TIMEOUT "nisplusLDAPmodifyTimeout"
134 #define ADD_TIMEOUT "nisplusLDAPaddTimeout"
135 #define DELETE_TIMEOUT "nisplusLDAPdeleteTimeout"
136 #define SEARCH_TIME_LIMIT "nisplusLDAPsearchTimeLimit"
137 #define SEARCH_SIZE_LIMIT "nisplusLDAPsearchSizeLimit"
138 #define FOLLOW_REFERRAL "nisplusLDAPfollowReferral"
140 #define IS_BIND_INFO(x) \
141 ((x) >= key_preferred_servers && (x) <= key_follow_referral)
143 /* This information will be need to determine the server behavior */
146 #define INITIAL_UPDATE_ACTION "nisplusLDAPinitialUpdateAction"
147 #define INITIAL_UPDATE_ONLY "nisplusLDAPinitialUpdateOnly"
148 #define RETRIEVE_ERROR_ACTION "nisplusLDAPretrieveErrorAction"
149 #define RETREIVE_ERROR_ATTEMPTS "nisplusLDAPretrieveErrorAttempts"
150 #define RETREIVE_ERROR_TIMEOUT "nisplusLDAPretrieveErrorTimeout"
151 #define STORE_ERROR_ACTION "nisplusLDAPstoreErrorAction"
152 #define STORE_ERROR_ATTEMPTS "nisplusLDAPstoreErrorAttempts"
153 #define STORE_ERROR_TIMEOUT "nisplusLDAPstoreErrorTimeout"
154 #define REFRESH_ERROR_ACTION "nisplusLDAPrefreshErrorAction"
155 #define REFRESH_ERROR_ATTEMPTS "nisplusLDAPrefreshErrorAttempts"
156 #define REFRESH_ERROR_TIMEOUT "nisplusLDAPrefreshErrorTimeout"
157 #define THREAD_CREATE_ERROR_ACTION \
158 "nisplusThreadCreationErrorAction"
159 #define THREAD_CREATE_ERROR_ATTEMPTS \
160 "nisplusThreadCreationErrorAttempts"
161 #define THREAD_CREATE_ERROR_TIMEOUT \
162 "nisplusThreadCreationErrorTimeout"
163 #define DUMP_ERROR_ACTION "nisplusDumpErrorAction"
164 #define DUMP_ERROR_ATTEMPTS "nisplusDumpErrorAttempts"
165 #define DUMP_ERROR_TIMEOUT "nisplusDumpErrorTimeout"
166 #define RESYNC "nisplusResyncService"
167 #define UPDATE_BATCHING "nisplusUpdateBatching"
168 #define UPDATE_BATCHING_TIMEOUT "nisplusUpdateBatchingTimeout"
169 #define MATCH_FETCH "nisplusLDAPmatchFetchAction"
170 #define NUMBER_THEADS "nisplusNumberOfServiceThreads"
171 #define YP_EMULATION "ENABLE_NIS_YP_EMULATION"
172 #define MAX_RPC_RECSIZE "nisplusMaxRPCRecordSize"
174 #define IS_OPER_INFO(x) \
175 ((x) >= key_initial_update_action && (x) <= key_max_rpc_recsize)
177 #define DB_ID_MAP "nisplusLDAPdatabaseIdMapping"
178 #define ENTRY_TTL "nisplusLDAPentryTtl"
179 #define LDAP_OBJECT_DN "nisplusLDAPobjectDN"
180 #define LDAP_TO_NISPLUS_MAP "nisplusLDAPcolumnFromAttribute"
181 #define NISPLUS_TO_LDAP_MAP "nisplusLDAPattributeFromColumn"
183 /* The following definitions are for NIS */
185 #define YP_CONFIG_DN "nisLDAPconfigDN"
186 #define YP_CONFIG_SERVER_LIST "nisLDAPconfigPreferredServerList"
187 #define YP_CONFIG_AUTH_METHOD "nisLDAPconfigAuthenticationMethod"
188 #define YP_CONFIG_TLS_OPTION "nisLDAPconfigTLS"
189 #define YP_CONFIG_TLS_CERT_DB "nisLDAPconfigTLSCertificateDBPath"
190 #define YP_CONFIG_PROXY_USER "nisLDAPconfigProxyUser"
191 #define YP_CONFIG_PROXY_PASSWD "nisLDAPconfigProxyPassword"
193 #define IS_YP_CONFIG_KEYWORD(x) \
194 ((x) >= key_yp_config_dn && (x) <= key_yp_config_proxy_passwd)
196 #define YP_TLS_OPTION "nisLDAPTLS"
197 #define YP_TLS_CERT_DB "nisLDAPTLSCertificateDBPath"
198 #define YP_PROXY_USER "nisLDAPproxyUser"
199 #define YP_PROXY_PASSWD "nisLDAPproxyPassword"
200 #define YP_LDAP_BASE_DOMAIN "nisLDAPbaseDomain"
201 #define YP_BIND_TIMEOUT "nisLDAPbindTimeout"
202 #define YP_SEARCH_TIMEOUT "nisLDAPsearchTimeout"
203 #define YP_MODIFY_TIMEOUT "nisLDAPmodifyTimeout"
204 #define YP_ADD_TIMEOUT "nisLDAPaddTimeout"
205 #define YP_DELETE_TIMEOUT "nisLDAPdeleteTimeout"
206 #define YP_SEARCH_TIME_LIMIT "nisLDAPsearchTimeLimit"
207 #define YP_SEARCH_SIZE_LIMIT "nisLDAPsearchSizeLimit"
208 #define YP_FOLLOW_REFERRAL "nisLDAPfollowReferral"
210 #define IS_YP_BIND_INFO(x) \
211 ((x) == key_preferred_servers || \
212 (x) == key_auth_method || \
213 (x) == key_search_base || \
214 ((x) >= key_yp_tls_option && (x) <= key_yp_follow_referral))
216 #define YP_RETRIEVE_ERROR_ACTION "nisLDAPretrieveErrorAction"
217 #define YP_RETREIVE_ERROR_ATTEMPTS "nisLDAPretrieveErrorAttempts"
218 #define YP_RETREIVE_ERROR_TIMEOUT "nisLDAPretrieveErrorTimeout"
219 #define YP_STORE_ERROR_ACTION "nisLDAPstoreErrorAction"
220 #define YP_STORE_ERROR_ATTEMPTS "nisLDAPstoreErrorAttempts"
221 #define YP_STORE_ERROR_TIMEOUT "nisLDAPstoreErrorTimeout"
222 #define YP_MATCH_FETCH "nisLDAPmatchFetchAction"
224 #define IS_YP_OPER_INFO(x) \
225 ((x) >= key_yp_retrieve_error_action && (x) <= key_yp_match_fetch)
227 #define YP_DOMAIN_CONTEXT "nisLDAPdomainContext"
228 #define YPPASSWDD_DOMAINS "nisLDAPyppasswddDomains"
230 #define IS_YP_DOMAIN_INFO(x) \
231 ((x) >= key_yp_domain_context && (x) <= key_yppasswdd_domains)
233 #define YP_DB_ID_MAP "nisLDAPdatabaseIdMapping"
234 #define YP_COMMENT_CHAR "nisLDAPcommentChar"
235 #define YP_MAP_FLAGS "nisLDAPmapFlags"
236 #define YP_ENTRY_TTL "nisLDAPentryTtl"
237 #define YP_NAME_FIELDS "nisLDAPnameFields"
238 #define YP_SPLIT_FIELD "nisLDAPsplitField"
239 #define YP_REPEATED_FIELD_SEPARATORS "nisLDAPrepeatedFieldSeparators"
240 #define YP_LDAP_OBJECT_DN "nisLDAPobjectDN"
241 #define LDAP_TO_NIS_MAP "nisLDAPfieldFromAttribute"
242 #define NIS_TO_LDAP_MAP "nisLDAPattributeFromField"
244 #define IS_YP_MAP_ATTR(x) \
245 ((x) == key_yp_domain_context || \
246 (x) == key_yppasswdd_domains || \
247 ((x) >= key_yp_db_id_map && (x) <= key_nis_to_ldap_map))
249 #define DEFAULT_YP_SEARCH_TIMEOUT THREE_MINUTES
250 #define DEFAULT_BIND_TIMEOUT FIFTEEN_SECONDS
251 #define DEFAULT_SEARCH_TIMEOUT FIFTEEN_SECONDS
252 #define DEFAULT_MODIFY_TIMEOUT FIFTEEN_SECONDS
253 #define DEFAULT_ADD_TIMEOUT FIFTEEN_SECONDS
254 #define DEFAULT_DELETE_TIMEOUT FIFTEEN_SECONDS
256 #define DEFAULT_SEARCH_TIME_LIMIT LDAP_NO_LIMIT
257 #define DEFAULT_SEARCH_SIZE_LIMIT LDAP_NO_LIMIT
259 #define DEFAULT_THREAD_ERROR_ATTEMPTS FOREVER
260 #define DEFAULT_THREAD_ERROR_TIME_OUT FIFTEEN_SECONDS
261 #define DEFAULT_DUMP_ERROR_ATTEMPTS FOREVER
262 #define DEFAULT_DUMP_ERROR_TIME_OUT FIFTEEN_SECONDS
263 #define DEFAULT_RETRIEVE_ERROR_ATTEMPTS FOREVER
264 #define DEFAULT_RETRIEVE_ERROR_TIME_OUT FIFTEEN_SECONDS
265 #define DEFAULT_STORE_ERROR_ATTEMPTS FOREVER
266 #define DEFAULT_STORE_ERROR_TIME_OUT FIFTEEN_SECONDS
267 #define DEFAULT_REFRESH_ERROR_ATTEMPTS FOREVER
268 #define DEFAULT_REFRESH_ERROR_TIME_OUT FIFTEEN_SECONDS
270 #define DEFAULT_BATCHING_TIME_OUT TWO_MINUTES
271 #define DEFAULT_NUMBER_OF_THREADS 0
272 #define DEFAULT_YP_EMULATION 0
274 #define DEFAULT_TTL_HIGH (ONE_HOUR + THIRTY_MINUTES)
275 #define DEFAULT_TTL_LOW (ONE_HOUR - THIRTY_MINUTES)
276 #define DEFAULT_TTL ONE_HOUR
282 parse_bad_continuation_error
,
284 parse_internal_error
,
285 parse_initial_update_action_error
,
286 parse_initial_update_only_error
,
287 parse_retrieve_error_action_error
,
288 parse_store_error_action_error
,
289 parse_refresh_error_action_error
,
290 parse_thread_create_error_action_error
,
291 parse_dump_error_action_error
,
293 parse_update_batching_error
,
294 parse_match_fetch_error
,
297 parse_invalid_ldap_search_filter
,
298 parse_semi_expected_error
,
299 parse_mismatched_brackets
,
300 parse_unsupported_format
,
301 parse_unexpected_dash
,
302 parse_unmatched_escape
,
303 parse_bad_lhs_format_error
,
304 parse_comma_expected_error
,
305 parse_equal_expected_error
,
306 parse_close_paren_expected_error
,
307 parse_too_many_extract_items
,
308 parse_not_enough_extract_items
,
309 parse_bad_print_format
,
310 parse_bad_elide_char
,
311 parse_start_rhs_unrecognized
,
312 parse_item_expected_error
,
313 parse_format_string_expected_error
,
314 parse_unexpected_data_end_rule
,
315 parse_bad_ttl_format_error
,
316 parse_bad_auth_method_error
,
317 parse_open_file_error
,
318 parse_no_proxy_dn_error
,
319 parse_no_config_auth_error
,
320 parse_no_proxy_auth_error
,
321 parse_ldap_init_error
,
322 parse_ldap_bind_error
,
323 parse_ldap_search_error
,
324 parse_ldap_get_values_error
,
325 parse_object_dn_syntax_error
,
327 parse_bad_index_format
,
328 parse_bad_item_format
,
329 parse_bad_ldap_item_format
,
330 parse_invalid_print_arg
,
331 parse_bad_extract_format_spec
,
332 parse_no_db_del_mapping_rule
,
333 parse_invalid_db_del_mapping_rule
,
334 parse_bad_domain_name
,
336 parse_yes_or_no_expected_error
,
337 parse_bad_uint_error
,
339 parse_bad_command_line_attribute_format
,
340 parse_no_ldap_server_error
,
341 parse_bad_ber_format
,
342 parse_no_config_server_addr
,
343 parse_bad_time_error
,
344 parse_lhs_rhs_type_mismatch
,
347 parse_bad_tls_option_error
,
348 parse_ldapssl_client_init_error
,
349 parse_ldapssl_init_error
,
350 parse_no_available_referrals_error
,
351 parse_no_config_cert_db
,
353 parse_unknown_yp_domain_error
,
354 parse_unexpected_yp_domain_end_error
,
356 parse_bad_yp_comment_error
,
357 parse_bad_field_separator_error
,
358 parse_bad_name_field
,
359 parse_yp_retrieve_error_action_error
,
360 parse_yp_store_error_action_error
366 conn_ldap_init_error
,
367 conn_unsupported_ldap_bind_method
,
375 key_config_server_list
,
376 key_config_auth_method
,
377 key_config_tls_option
,
378 key_config_tls_certificate_db
,
379 key_config_proxy_user
,
380 key_config_proxy_passwd
,
381 key_preferred_servers
,
384 key_tls_certificate_db
,
388 key_ldap_base_domain
,
394 key_search_time_limit
,
395 key_search_size_limit
,
397 key_initial_update_action
,
398 key_initial_update_only
,
399 key_retrieve_error_action
,
400 key_retrieve_error_attempts
,
401 key_retreive_error_timeout
,
402 key_store_error_action
,
403 key_store_error_attempts
,
404 key_store_error_timeout
,
405 key_refresh_error_action
,
406 key_refresh_error_attempts
,
407 key_refresh_error_timeout
,
408 key_thread_create_error_action
,
409 key_thread_create_error_attempts
,
410 key_thread_create_error_timeout
,
411 key_dump_error_action
,
412 key_dump_error_attempts
,
413 key_dump_error_timeout
,
416 key_update_batching_timeout
,
424 key_ldap_to_nisplus_map
,
425 key_nisplus_to_ldap_map
,
427 key_yp_config_server_list
,
428 key_yp_config_auth_method
,
429 key_yp_config_tls_option
,
430 key_yp_config_tls_certificate_db
,
431 key_yp_config_proxy_user
,
432 key_yp_config_proxy_passwd
,
433 key_yp_preferred_servers
,
436 key_yp_tls_certificate_db
,
440 key_yp_ldap_base_domain
,
442 key_yp_search_timeout
,
443 key_yp_modify_timeout
,
445 key_yp_delete_timeout
,
446 key_yp_search_time_limit
,
447 key_yp_search_size_limit
,
448 key_yp_follow_referral
,
449 key_yp_retrieve_error_action
,
450 key_yp_retrieve_error_attempts
,
451 key_yp_retreive_error_timeout
,
452 key_yp_store_error_action
,
453 key_yp_store_error_attempts
,
454 key_yp_store_error_timeout
,
456 key_yp_domain_context
,
457 key_yppasswdd_domains
,
464 key_yp_repeated_field_separators
,
465 key_yp_ldap_object_dn
,
498 dn_got_read_q_filter
,
502 dn_got_write_q_scope
,
504 dn_got_write_q_filter
,
508 } parse_object_dn_state
;
524 char *default_servers
;
525 auth_method_t auth_method
;
526 tls_method_t tls_method
;
530 } __nis_config_info_t
;
538 char *default_servers
;
539 auth_method_t auth_method
;
540 tls_method_t tls_method
;
541 char *default_search_base
;
545 char *default_nis_domain
;
546 struct timeval bind_timeout
;
547 struct timeval search_timeout
;
548 struct timeval modify_timeout
;
549 struct timeval add_timeout
;
550 struct timeval delete_timeout
;
551 int search_time_limit
;
552 int search_size_limit
;
553 follow_referral_t follow_referral
;
554 } __nis_ldap_proxy_info
;
556 extern __nisdb_table_mapping_t ldapDBTableMapping
;
557 extern __nis_ldap_proxy_info proxyInfo
;
558 extern __nis_table_mapping_t
*ldapTableMapping
;
560 extern int parse_ldap_migration(const char *const *cmdline_options
,
561 const char *config_file
);
563 extern void get_ldap_connection(LDAP
**ld
, time_t retry_time
);
564 extern void free_ldap_connection(LDAP
*ld
);
565 extern void return_ldap_connection(LDAP
*ld
);
566 extern void free_ldap_connections();
569 extern void initialize_parse_structs(__nis_ldap_proxy_info
*proxy_info
,
570 __nis_config_t
*config_info
, __nisdb_table_mapping_t
*table_info
);
571 extern void initialize_yp_parse_structs(__yp_domain_context_t
*ypDomains
);
573 /* Deallocation functions */
574 extern void free_parse_structs(void);
575 extern void free_yp_domain_context(__yp_domain_context_t
*domains
);
576 extern void free_config_info(__nis_config_info_t
*config_info
);
577 extern void free_mapping_rule(__nis_mapping_rule_t
*rule
);
578 extern void free_object_dn(__nis_object_dn_t
*obj_dn
);
579 extern void free_mapping_format(__nis_mapping_format_t
*fmt
);
580 extern void free_index(__nis_index_t
*index
);
581 extern void free_mapping_item(__nis_mapping_item_t
*item
);
582 extern void free_mapping_element(__nis_mapping_element_t
*e
);
583 extern void free_mapping_sub_element(__nis_mapping_sub_element_t
*sub
);
584 extern void free_proxy_info(__nis_ldap_proxy_info
*proxy_info
);
585 extern void free_table_mapping(__nis_table_mapping_t
*mapping
);
587 /* Parser functions */
588 extern int read_line(int fd
, char *buffer
, int buflen
);
589 extern __nis_table_mapping_t
*find_table_mapping(const char *s
, int len
,
590 __nis_table_mapping_t
*table_mapping
);
591 extern int second_parser_pass(__nis_table_mapping_t
**table_mapping
);
592 extern int final_parser_pass(__nis_table_mapping_t
**table_mapping
,
593 __yp_domain_context_t
*ypDomains
);
594 extern int finish_parse(__nis_ldap_proxy_info
*proxy_info
,
595 __nis_table_mapping_t
**table_mapping
);
596 extern void set_default_values(__nis_ldap_proxy_info
*proxy_info
,
597 __nis_config_t
*config_info
, __nisdb_table_mapping_t
*table_info
);
599 extern int add_config_attribute(config_key attrib_num
, const char *attrib_val
,
600 int attrib_len
, __nis_config_info_t
*config_info
);
601 extern int add_bind_attribute(config_key attrib_num
, const char *attrib_val
,
602 int attrib_len
, __nis_ldap_proxy_info
*proxy_info
);
603 extern int add_operation_attribute(config_key attrib_num
,
604 const char *attrib_val
, int attrib_len
, __nis_config_t
*config_info
,
605 __nisdb_table_mapping_t
*table_info
);
606 extern int add_mapping_attribute(config_key attrib_num
, const char *attrib_val
,
607 int attrib_len
, __nis_table_mapping_t
**table_mapping
);
608 extern int add_ypdomains_attribute(config_key attrib_num
,
609 const char *attrib_val
, int attrib_len
,
610 __yp_domain_context_t
*ypDomains
);
611 extern config_key
get_attrib_num(const char *s
, int n
);
612 bool_t
is_cmd_line_option(config_key a_num
);
615 skip_get_dn(const char *dn
, const char *end
);
616 extern const char *get_search_triple(const char *s
, const char *end_s
,
617 __nis_search_triple_t
*triple
);
618 extern bool_t
parse_index(const char *s
, const char *end_s
,
619 __nis_index_t
*index
);
620 extern bool_t
add_element(__nis_mapping_element_t
*e
,
621 __nis_mapping_rlhs_t
*m
);
622 extern const char *skip_token(const char *s
, const char *end_s
,
624 extern const char *get_next_extract_format_item(const char *begin_fmt
,
625 const char *end_fmt
, __nis_mapping_format_t
*fmt
);
626 extern const char *get_next_print_format_item(const char *begin_fmt
,
627 const char *end_fmt
, __nis_mapping_format_t
*fmt
);
628 extern const char *get_next_token(const char **begin_token
,
629 const char **end_token
, token_type
*t
);
630 extern const char *get_next_object_dn_token(const char **begin_ret
,
631 const char **end_ret
, object_dn_token
*token
);
632 extern const char *get_ldap_filter(const char **begin
, const char **end
);
633 const char *get_ava_list(const char **begin
, const char **end
,
636 extern void init_yptol_flag();
637 /* Utility functions */
638 extern char *s_strndup_esc(const char *s
, int n
);
639 extern char *s_strndup(const char *s
, int n
);
640 extern char *s_strdup(const char *s
);
641 extern void *s_calloc(size_t n
, size_t size
);
642 extern void *s_realloc(void *s
, size_t size
);
643 extern bool_t
is_whitespace(int c
);
644 extern bool_t
contains_string(const char *s1
, const char *s2
);
645 extern const char *skip_string(const char *s1
, const char *s2
, int len
);
646 extern bool_t
same_string(const char *s1
, const char *s2
, int len
);
648 /* Error and information reporting functions */
649 extern void report_error(const char *str
, const char *attr
);
650 extern void report_error2(const char *str1
, const char *str2
);
651 extern void report_info(const char *str
, const char *arg
);
652 extern void report_conn_error(conn_error e
, const char *str1
, const char *str2
);
653 extern void warn_duplicate_map(const char *db_id
, config_key attrib_num
);
655 /* Validation functions */
656 extern bool_t
validate_dn(const char *s
, int len
);
657 extern bool_t
validate_ldap_filter(const char *s
, const char *end
);
659 extern int start_line_num
;
660 extern int cur_line_num
;
662 extern parse_error p_error
;
663 extern char _key_val
[38];
664 extern const char *command_line_source
;
665 extern const char *file_source
;
666 extern const char *ldap_source
;
667 extern const char *warn_file
;
669 /* SSL and sasl-digest md5 functions */
670 int ldapssl_client_init(const char *certdbpath
, void *certdbhandle
);
671 const char *ldapssl_err2string(const int prerrno
);
672 LDAP
*ldapssl_init(const char *defhost
, int defport
, int defsecure
);
673 int ldap_x_sasl_digest_md5_bind_s(LDAP
*ld
, char *user_name
,
675 LDAPControl
**serverctrls
, LDAPControl
**clientctrls
);
681 #endif /* _NIS_PARSE_LDAP_CONF_H */