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