1 /* config.c - configuration file handling routines */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2005 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
16 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
17 * All rights reserved.
19 * Redistribution and use in source and binary forms are permitted
20 * provided that this notice is preserved and that due credit is given
21 * to the University of Michigan at Ann Arbor. The name of the University
22 * may not be used to endorse or promote products derived from this
23 * software without specific prior written permission. This software
24 * is provided ``as is'' without express or implied warranty.
31 #include <ac/string.h>
33 #include <ac/signal.h>
34 #include <ac/socket.h>
40 #include "slapi/slapi.h"
47 * defaults for various global variables
49 struct slap_limits_set deflimit = {
50 SLAPD_DEFAULT_TIMELIMIT, /* backward compatible limits */
53 SLAPD_DEFAULT_SIZELIMIT, /* backward compatible limits */
55 -1, /* no limit on unchecked size */
57 0, /* hide number of entries left */
58 0 /* number of total entries returned by pagedResults equal to hard limit */
61 AccessControl *global_acl = NULL;
62 slap_access_t global_default_access = ACL_READ;
63 slap_mask_t global_restrictops = 0;
64 slap_mask_t global_allows = 0;
65 slap_mask_t global_disallows = 0;
66 slap_mask_t global_requires = 0;
67 slap_ssf_set_t global_ssf_set;
69 int global_gentlehup = 0;
70 int global_idletimeout = 0;
71 char *global_host = NULL;
72 char *global_realm = NULL;
73 char *ldap_srvtab = "";
74 char **default_passwd_hash = NULL;
75 int cargc = 0, cargv_size = 0;
77 struct berval default_search_base = BER_BVNULL;
78 struct berval default_search_nbase = BER_BVNULL;
79 unsigned num_subordinates = 0;
80 struct berval global_schemadn = BER_BVNULL;
81 struct berval global_schemandn = BER_BVNULL;
83 ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
84 ber_len_t sockbuf_max_incoming_auth= SLAP_SB_MAX_INCOMING_AUTH;
86 int slap_conn_max_pending = SLAP_CONN_MAX_PENDING_DEFAULT;
87 int slap_conn_max_pending_auth = SLAP_CONN_MAX_PENDING_AUTH;
89 char *slapd_pid_file = NULL;
90 char *slapd_args_file = NULL;
92 char *strtok_quote_ptr;
94 int use_reverse_lookup = 0;
97 int slapi_plugins_used = 0;
100 static char *fp_getline(FILE *fp, int *lineno);
101 static void fp_getline_init(int *lineno);
102 static int fp_parse_line(int lineno, char *line);
104 static char *strtok_quote(char *line, char *sep);
105 static int load_ucdata(char *path);
107 static int add_syncrepl LDAP_P(( Backend *, char **, int ));
108 static int parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
111 read_config( const char *fname, int depth )
114 char *line, *savefname, *saveline;
118 struct berval vals[2];
121 static BackendInfo *bi = NULL;
122 static BackendDB *be = NULL;
126 vals[1].bv_val = NULL;
129 cargv = ch_calloc( ARGS_STEP + 1, sizeof(*cargv) );
130 cargv_size = ARGS_STEP + 1;
133 if ( (fp = fopen( fname, "r" )) == NULL ) {
136 LDAP_LOG( CONFIG, ENTRY,
137 "read_config: " "could not open config file \"%s\": %s (%d)\n",
138 fname, strerror(errno), errno );
140 Debug( LDAP_DEBUG_ANY,
141 "could not open config file \"%s\": %s (%d)\n",
142 fname, strerror(errno), errno );
148 LDAP_LOG( CONFIG, ENTRY,
149 "read_config: reading config file %s\n", fname, 0, 0 );
151 Debug( LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0 );
155 fp_getline_init( &lineno );
157 while ( (line = fp_getline( fp, &lineno )) != NULL ) {
158 /* skip comments and blank lines */
159 if ( line[0] == '#' || line[0] == '\0' ) {
163 /* fp_parse_line is destructive, we save a copy */
164 saveline = ch_strdup( line );
166 if ( fp_parse_line( lineno, line ) != 0 ) {
172 LDAP_LOG( CONFIG, INFO,
173 "%s: line %d: bad config line (ignored)\n", fname, lineno, 0 );
175 Debug( LDAP_DEBUG_ANY,
176 "%s: line %d: bad config line (ignored)\n",
183 if ( strcasecmp( cargv[0], "backend" ) == 0 ) {
186 LDAP_LOG( CONFIG, CRIT,
187 "%s : line %d: missing type in \"backend\" line.\n",
190 Debug( LDAP_DEBUG_ANY,
191 "%s: line %d: missing type in \"backend <type>\" line\n",
200 LDAP_LOG( CONFIG, CRIT,
201 "%s: line %d: backend line must appear before any "
202 "database definition.\n", fname, lineno , 0 );
204 Debug( LDAP_DEBUG_ANY,
205 "%s: line %d: backend line must appear before any database definition\n",
212 bi = backend_info( cargv[1] );
216 LDAP_LOG( CONFIG, CRIT,
217 "read_config: backend %s initialization failed.\n",
220 Debug( LDAP_DEBUG_ANY,
221 "backend %s initialization failed.\n",
227 } else if ( strcasecmp( cargv[0], "database" ) == 0 ) {
230 LDAP_LOG( CONFIG, CRIT,
231 "%s: line %d: missing type in \"database <type>\" line\n",
234 Debug( LDAP_DEBUG_ANY,
235 "%s: line %d: missing type in \"database <type>\" line\n",
243 be = backend_db_init( cargv[1] );
247 LDAP_LOG( CONFIG, CRIT,
248 "database %s initialization failed.\n", cargv[1], 0, 0 );
250 Debug( LDAP_DEBUG_ANY,
251 "database %s initialization failed.\n",
258 /* set thread concurrency */
259 } else if ( strcasecmp( cargv[0], "concurrency" ) == 0 ) {
263 LDAP_LOG( CONFIG, CRIT,
264 "%s: line %d: missing level in \"concurrency <level>\" "
265 " line\n", fname, lineno, 0 );
267 Debug( LDAP_DEBUG_ANY,
268 "%s: line %d: missing level in \"concurrency <level>\" line\n",
275 c = strtol( cargv[1], &next, 10 );
276 if ( next == NULL || next[0] != '\0' ) {
278 LDAP_LOG( CONFIG, CRIT,
279 "%s: line %d: unable to parse level \"%s\" in \"concurrency <level>\" "
280 " line\n", fname, lineno, cargv[1] );
282 Debug( LDAP_DEBUG_ANY,
283 "%s: line %d: unable to parse level \"%s\" in \"concurrency <level>\" line\n",
284 fname, lineno, cargv[1] );
291 LDAP_LOG( CONFIG, CRIT,
292 "%s: line %d: invalid level (%d) in "
293 "\"concurrency <level>\" line.\n", fname, lineno, c );
295 Debug( LDAP_DEBUG_ANY,
296 "%s: line %d: invalid level (%d) in \"concurrency <level>\" line\n",
303 ldap_pvt_thread_set_concurrency( c );
305 /* set sockbuf max */
306 } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming" ) == 0 ) {
310 LDAP_LOG( CONFIG, CRIT,
311 "%s: line %d: missing max in \"sockbuf_max_incoming "
312 "<bytes>\" line\n", fname, lineno, 0 );
314 Debug( LDAP_DEBUG_ANY,
315 "%s: line %d: missing max in \"sockbuf_max_incoming <bytes>\" line\n",
322 max = atol( cargv[1] );
326 LDAP_LOG( CONFIG, CRIT,
327 "%s: line %d: invalid max value (%ld) in "
328 "\"sockbuf_max_incoming <bytes>\" line.\n",
329 fname, lineno, max );
331 Debug( LDAP_DEBUG_ANY,
332 "%s: line %d: invalid max value (%ld) in "
333 "\"sockbuf_max_incoming <bytes>\" line.\n",
334 fname, lineno, max );
340 sockbuf_max_incoming = max;
342 /* set sockbuf max authenticated */
343 } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming_auth" ) == 0 ) {
347 LDAP_LOG( CONFIG, CRIT,
348 "%s: line %d: missing max in \"sockbuf_max_incoming_auth "
349 "<bytes>\" line\n", fname, lineno, 0 );
351 Debug( LDAP_DEBUG_ANY,
352 "%s: line %d: missing max in \"sockbuf_max_incoming_auth <bytes>\" line\n",
359 max = atol( cargv[1] );
363 LDAP_LOG( CONFIG, CRIT,
364 "%s: line %d: invalid max value (%ld) in "
365 "\"sockbuf_max_incoming_auth <bytes>\" line.\n",
366 fname, lineno, max );
368 Debug( LDAP_DEBUG_ANY,
369 "%s: line %d: invalid max value (%ld) in "
370 "\"sockbuf_max_incoming_auth <bytes>\" line.\n",
371 fname, lineno, max );
377 sockbuf_max_incoming_auth = max;
379 /* set conn pending max */
380 } else if ( strcasecmp( cargv[0], "conn_max_pending" ) == 0 ) {
384 LDAP_LOG( CONFIG, CRIT,
385 "%s: line %d: missing max in \"conn_max_pending "
386 "<requests>\" line\n", fname, lineno, 0 );
388 Debug( LDAP_DEBUG_ANY,
389 "%s: line %d: missing max in \"conn_max_pending <requests>\" line\n",
396 max = atol( cargv[1] );
400 LDAP_LOG( CONFIG, CRIT,
401 "%s: line %d: invalid max value (%ld) in "
402 "\"conn_max_pending <requests>\" line.\n",
403 fname, lineno, max );
405 Debug( LDAP_DEBUG_ANY,
406 "%s: line %d: invalid max value (%ld) in "
407 "\"conn_max_pending <requests>\" line.\n",
408 fname, lineno, max );
414 slap_conn_max_pending = max;
416 /* set conn pending max authenticated */
417 } else if ( strcasecmp( cargv[0], "conn_max_pending_auth" ) == 0 ) {
421 LDAP_LOG( CONFIG, CRIT,
422 "%s: line %d: missing max in \"conn_max_pending_auth "
423 "<requests>\" line\n", fname, lineno, 0 );
425 Debug( LDAP_DEBUG_ANY,
426 "%s: line %d: missing max in \"conn_max_pending_auth <requests>\" line\n",
433 max = atol( cargv[1] );
437 LDAP_LOG( CONFIG, CRIT,
438 "%s: line %d: invalid max value (%ld) in "
439 "\"conn_max_pending_auth <requests>\" line.\n",
440 fname, lineno, max );
442 Debug( LDAP_DEBUG_ANY,
443 "%s: line %d: invalid max value (%ld) in "
444 "\"conn_max_pending_auth <requests>\" line.\n",
445 fname, lineno, max );
451 slap_conn_max_pending_auth = max;
453 /* default search base */
454 } else if ( strcasecmp( cargv[0], "defaultSearchBase" ) == 0 ) {
457 LDAP_LOG( CONFIG, CRIT,
458 "%s: line %d: missing dn in \"defaultSearchBase <dn\" "
459 "line\n", fname, lineno, 0 );
461 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
462 "missing dn in \"defaultSearchBase <dn>\" line\n",
468 } else if ( cargc > 2 ) {
470 LDAP_LOG( CONFIG, INFO,
471 "%s: line %d: extra cruft after <dn> in "
472 "\"defaultSearchBase %s\" line (ignored)\n",
473 fname, lineno, cargv[1] );
475 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
476 "extra cruft after <dn> in \"defaultSearchBase %s\", "
478 fname, lineno, cargv[1] );
482 if ( bi != NULL || be != NULL ) {
484 LDAP_LOG( CONFIG, CRIT,
485 "%s: line %d: defaultSearchBase line must appear "
486 "prior to any backend or database definitions\n",
489 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
490 "defaultSearchBaase line must appear prior to "
491 "any backend or database definition\n",
498 if ( default_search_nbase.bv_len ) {
500 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
501 "default search base \"%s\" already defined "
502 "(discarding old)\n", fname, lineno,
503 default_search_base.bv_val );
505 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
506 "default search base \"%s\" already defined "
507 "(discarding old)\n",
508 fname, lineno, default_search_base.bv_val );
511 free( default_search_base.bv_val );
512 free( default_search_nbase.bv_val );
515 if ( load_ucdata( NULL ) < 0 ) return 1;
520 dn.bv_val = cargv[1];
521 dn.bv_len = strlen( dn.bv_val );
523 rc = dnPrettyNormal( NULL, &dn,
524 &default_search_base,
525 &default_search_nbase, NULL );
527 if( rc != LDAP_SUCCESS ) {
529 LDAP_LOG( CONFIG, CRIT,
530 "%s: line %d: defaultSearchBase DN is invalid.\n",
533 Debug( LDAP_DEBUG_ANY,
534 "%s: line %d: defaultSearchBase DN is invalid\n",
541 /* set maximum threads in thread pool */
542 } else if ( strcasecmp( cargv[0], "threads" ) == 0 ) {
546 LDAP_LOG( CONFIG, CRIT,
547 "%s: line %d: missing count in \"threads <count>\" line\n",
550 Debug( LDAP_DEBUG_ANY,
551 "%s: line %d: missing count in \"threads <count>\" line\n",
558 c = strtol( cargv[1], &next, 10 );
559 if (next == NULL || next[0] != '\0' ) {
561 LDAP_LOG( CONFIG, CRIT,
562 "%s: line %d: unable to parse count \"%s\" in \"threads <count>\" line\n",
563 fname, lineno, cargv[1] );
565 Debug( LDAP_DEBUG_ANY,
566 "%s: line %d: unable to parse count \"%s\" in \"threads <count>\" line\n",
567 fname, lineno, cargv[1] );
574 LDAP_LOG( CONFIG, CRIT,
575 "%s: line %d: invalid level (%d) in \"threads <count>\""
576 "line\n", fname, lineno, c );
578 Debug( LDAP_DEBUG_ANY,
579 "%s: line %d: invalid level (%d) in \"threads <count>\" line\n",
586 ldap_pvt_thread_pool_maxthreads( &connection_pool, c );
588 /* save for later use */
589 connection_pool_max = c;
591 /* get pid file name */
592 } else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
595 LDAP_LOG( CONFIG, CRIT,
596 "%s: line %d missing file name in \"pidfile <file>\" "
597 "line.\n", fname, lineno, 0 );
599 Debug( LDAP_DEBUG_ANY,
600 "%s: line %d: missing file name in \"pidfile <file>\" line\n",
607 slapd_pid_file = ch_strdup( cargv[1] );
609 /* get args file name */
610 } else if ( strcasecmp( cargv[0], "argsfile" ) == 0 ) {
613 LDAP_LOG( CONFIG, CRIT,
614 "%s: %d: missing file name in "
615 "\"argsfile <file>\" line.\n",
618 Debug( LDAP_DEBUG_ANY,
619 "%s: line %d: missing file name in \"argsfile <file>\" line\n",
626 slapd_args_file = ch_strdup( cargv[1] );
628 } else if ( strcasecmp( cargv[0], "replica-pidfile" ) == 0 ) {
631 } else if ( strcasecmp( cargv[0], "replica-argsfile" ) == 0 ) {
634 /* default password hash */
635 } else if ( strcasecmp( cargv[0], "password-hash" ) == 0 ) {
638 LDAP_LOG( CONFIG, CRIT,
639 "%s: line %d: missing hash in "
640 "\"password-hash <hash>\" line.\n",
643 Debug( LDAP_DEBUG_ANY,
644 "%s: line %d: missing hash in \"password-hash <hash>\" line\n",
650 if ( default_passwd_hash != NULL ) {
652 LDAP_LOG( CONFIG, CRIT,
653 "%s: line %d: already set default password_hash!\n",
656 Debug( LDAP_DEBUG_ANY,
657 "%s: line %d: already set default password_hash!\n",
664 for(i = 1; i < cargc; i++) {
665 if ( lutil_passwd_scheme( cargv[i] ) == 0 ) {
667 LDAP_LOG( CONFIG, CRIT,
668 "%s: line %d: password scheme \"%s\" not available\n",
669 fname, lineno, cargv[i] );
671 Debug( LDAP_DEBUG_ANY,
672 "%s: line %d: password scheme \"%s\" not available\n",
673 fname, lineno, cargv[i] );
676 ldap_charray_add( &default_passwd_hash, cargv[i] );
679 if( !default_passwd_hash ) {
681 LDAP_LOG( CONFIG, CRIT,
682 "%s: line %d: no valid hashes found\n",
685 Debug( LDAP_DEBUG_ANY,
686 "%s: line %d: no valid hashes found\n",
692 } else if ( strcasecmp( cargv[0], "password-crypt-salt-format" ) == 0 )
696 LDAP_LOG( CONFIG, CRIT,
697 "%s: line %d: missing format in "
698 "\"password-crypt-salt-format <format>\" line\n",
701 Debug( LDAP_DEBUG_ANY, "%s: line %d: missing format in "
702 "\"password-crypt-salt-format <format>\" line\n",
709 lutil_salt_format( cargv[1] );
711 /* SASL config options */
712 } else if ( strncasecmp( cargv[0], "sasl", 4 ) == 0 ) {
713 if ( slap_sasl_config( cargc, cargv, line, fname, lineno ) )
715 #ifdef SLAP_X_SASL_REWRITE
716 /* use authid rewrite instead of sasl regexp */
717 } else if ( strncasecmp( cargv[0], "authid-rewrite", sizeof("authid-rewrite") - 1 ) == 0 ) {
718 int rc = slap_sasl_rewrite_config( fname, lineno,
723 #endif /* SLAP_X_SASL_REWRITE */
725 } else if ( strcasecmp( cargv[0], "schemadn" ) == 0 ) {
729 LDAP_LOG( CONFIG, CRIT,
730 "%s: line %d: missing dn in "
731 "\"schemadn <dn>\" line.\n", fname, lineno, 0 );
733 Debug( LDAP_DEBUG_ANY,
734 "%s: line %d: missing dn in \"schemadn <dn>\" line\n",
739 ber_str2bv( cargv[1], 0, 0, &dn );
741 rc = dnPrettyNormal( NULL, &dn, &be->be_schemadn,
742 &be->be_schemandn, NULL );
744 rc = dnPrettyNormal( NULL, &dn, &global_schemadn,
745 &global_schemandn, NULL );
747 if ( rc != LDAP_SUCCESS ) {
749 LDAP_LOG( CONFIG, CRIT,
750 "%s: line %d: schemadn DN is invalid.\n",
753 Debug( LDAP_DEBUG_ANY,
754 "%s: line %d: schemadn DN is invalid\n",
760 /* set UCDATA path */
761 } else if ( strcasecmp( cargv[0], "ucdata-path" ) == 0 ) {
765 LDAP_LOG( CONFIG, CRIT,
766 "%s: line %d: missing path in "
767 "\"ucdata-path <path>\" line.\n", fname, lineno, 0 );
769 Debug( LDAP_DEBUG_ANY,
770 "%s: line %d: missing path in \"ucdata-path <path>\" line\n",
777 err = load_ucdata( cargv[1] );
781 LDAP_LOG( CONFIG, CRIT,
782 "%s: line %d: ucdata already loaded, ucdata-path "
783 "must be set earlier in the file and/or be "
784 "specified only once!\n", fname, lineno, 0 );
786 Debug( LDAP_DEBUG_ANY,
787 "%s: line %d: ucdata already loaded, ucdata-path must be set earlier in the file and/or be specified only once!\n",
796 } else if ( strcasecmp( cargv[0], "sizelimit" ) == 0 ) {
798 struct slap_limits_set *lim;
802 LDAP_LOG( CONFIG, CRIT,
803 "%s: line %d: missing limit in \"sizelimit <limit>\" "
804 "line.\n", fname, lineno, 0 );
806 Debug( LDAP_DEBUG_ANY,
807 "%s: line %d: missing limit in \"sizelimit <limit>\" line\n",
817 lim = &be->be_def_limit;
820 for ( i = 1; i < cargc; i++ ) {
821 if ( strncasecmp( cargv[i], "size", 4 ) == 0 ) {
822 rc = limits_parse_one( cargv[i], lim );
825 LDAP_LOG( CONFIG, CRIT,
826 "%s: line %d: unable "
827 "to parse value \"%s\" in \"sizelimit "
828 "<limit>\" line.\n", fname, lineno, cargv[i] );
830 Debug( LDAP_DEBUG_ANY,
831 "%s: line %d: unable "
832 "to parse value \"%s\" "
835 fname, lineno, cargv[i] );
841 if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) {
842 lim->lms_s_soft = -1;
844 lim->lms_s_soft = strtol( cargv[i] , &next, 0 );
845 if ( next == cargv[i] ) {
847 LDAP_LOG( CONFIG, CRIT,
848 "%s: line %d: unable to parse limit \"%s\" in \"sizelimit <limit>\" "
849 "line.\n", fname, lineno, cargv[i] );
851 Debug( LDAP_DEBUG_ANY,
852 "%s: line %d: unable to parse limit \"%s\" in \"sizelimit <limit>\" line\n",
853 fname, lineno, cargv[i] );
857 } else if ( next[0] != '\0' ) {
859 LDAP_LOG( CONFIG, CRIT,
860 "%s: line %d: trailing chars \"%s\" in \"sizelimit <limit>\" "
861 "line ignored.\n", fname, lineno, next );
863 Debug( LDAP_DEBUG_ANY,
864 "%s: line %d: trailing chars \"%s\" in \"sizelimit <limit>\" line ignored\n",
865 fname, lineno, next );
874 } else if ( strcasecmp( cargv[0], "timelimit" ) == 0 ) {
876 struct slap_limits_set *lim;
880 LDAP_LOG( CONFIG, CRIT,
881 "%s: line %d missing limit in \"timelimit <limit>\" "
882 "line.\n", fname, lineno, 0 );
884 Debug( LDAP_DEBUG_ANY,
885 "%s: line %d: missing limit in \"timelimit <limit>\" line\n",
895 lim = &be->be_def_limit;
898 for ( i = 1; i < cargc; i++ ) {
899 if ( strncasecmp( cargv[i], "time", 4 ) == 0 ) {
900 rc = limits_parse_one( cargv[i], lim );
903 LDAP_LOG( CONFIG, CRIT,
904 "%s: line %d: unable to parse value \"%s\" "
905 "in \"timelimit <limit>\" line.\n",
906 fname, lineno, cargv[i] );
908 Debug( LDAP_DEBUG_ANY,
909 "%s: line %d: unable "
910 "to parse value \"%s\" "
913 fname, lineno, cargv[i] );
919 if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) {
920 lim->lms_t_soft = -1;
922 lim->lms_t_soft = strtol( cargv[i] , &next, 0 );
923 if ( next == cargv[i] ) {
925 LDAP_LOG( CONFIG, CRIT,
926 "%s: line %d: unable to parse limit \"%s\" in \"timelimit <limit>\" "
927 "line.\n", fname, lineno, cargv[i] );
929 Debug( LDAP_DEBUG_ANY,
930 "%s: line %d: unable to parse limit \"%s\" in \"timelimit <limit>\" line\n",
931 fname, lineno, cargv[i] );
935 } else if ( next[0] != '\0' ) {
937 LDAP_LOG( CONFIG, CRIT,
938 "%s: line %d: trailing chars \"%s\" in \"timelimit <limit>\" "
939 "line ignored.\n", fname, lineno, next );
941 Debug( LDAP_DEBUG_ANY,
942 "%s: line %d: trailing chars \"%s\" in \"timelimit <limit>\" line ignored\n",
943 fname, lineno, next );
951 /* set regex-based limits */
952 } else if ( strcasecmp( cargv[0], "limits" ) == 0 ) {
955 LDAP_LOG( CONFIG, WARNING,
956 "%s: line %d \"limits\" allowed only in database "
957 "environment.\n", fname, lineno, 0 );
959 Debug( LDAP_DEBUG_ANY,
960 "%s: line %d \"limits\" allowed only in database environment.\n%s",
966 if ( limits_parse( be, fname, lineno, cargc, cargv ) ) {
970 /* mark this as a subordinate database */
971 } else if ( strcasecmp( cargv[0], "subordinate" ) == 0 ) {
974 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
975 "subordinate keyword must appear inside a database "
976 "definition.\n", fname, lineno, 0 );
978 Debug( LDAP_DEBUG_ANY, "%s: line %d: subordinate keyword "
979 "must appear inside a database definition.\n",
985 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_GLUE_SUBORDINATE;
989 /* add an overlay to this backend */
990 } else if ( strcasecmp( cargv[0], "overlay" ) == 0 ) {
993 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
994 "overlay keyword must appear inside a database "
995 "definition.\n", fname, lineno, 0 );
997 Debug( LDAP_DEBUG_ANY, "%s: line %d: overlay keyword "
998 "must appear inside a database definition.\n",
1003 } else if ( overlay_config( be, cargv[1] )) {
1007 /* set database suffix */
1008 } else if ( strcasecmp( cargv[0], "suffix" ) == 0 ) {
1010 struct berval dn, pdn, ndn;
1014 LDAP_LOG( CONFIG, CRIT,
1015 "%s: line %d: missing dn in \"suffix <dn>\" line.\n",
1018 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1019 "missing dn in \"suffix <dn>\" line\n",
1025 } else if ( cargc > 2 ) {
1027 LDAP_LOG( CONFIG, INFO,
1028 "%s: line %d: extra cruft after <dn> in \"suffix %s\""
1029 " line (ignored).\n", fname, lineno, cargv[1] );
1031 Debug( LDAP_DEBUG_ANY, "%s: line %d: extra cruft "
1032 "after <dn> in \"suffix %s\" line (ignored)\n",
1033 fname, lineno, cargv[1] );
1039 LDAP_LOG( CONFIG, INFO,
1040 "%s: line %d: suffix line must appear inside a database "
1041 "definition.\n", fname, lineno, 0 );
1043 Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix line "
1044 "must appear inside a database definition\n",
1049 #if defined(SLAPD_MONITOR_DN)
1050 /* "cn=Monitor" is reserved for monitoring slap */
1051 } else if ( strcasecmp( cargv[1], SLAPD_MONITOR_DN ) == 0 ) {
1053 LDAP_LOG( CONFIG, CRIT, "%s: line %d: \""
1054 "%s\" is reserved for monitoring slapd\n",
1055 fname, lineno, SLAPD_MONITOR_DN );
1057 Debug( LDAP_DEBUG_ANY, "%s: line %d: \""
1058 "%s\" is reserved for monitoring slapd\n",
1059 fname, lineno, SLAPD_MONITOR_DN );
1062 #endif /* SLAPD_MONITOR_DN */
1065 if ( load_ucdata( NULL ) < 0 ) return 1;
1067 dn.bv_val = cargv[1];
1068 dn.bv_len = strlen( cargv[1] );
1070 rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn, NULL );
1071 if( rc != LDAP_SUCCESS ) {
1073 LDAP_LOG( CONFIG, CRIT,
1074 "%s: line %d: suffix DN is invalid.\n",
1077 Debug( LDAP_DEBUG_ANY,
1078 "%s: line %d: suffix DN is invalid\n",
1084 tmp_be = select_backend( &ndn, 0, 0 );
1085 if ( tmp_be == be ) {
1087 LDAP_LOG( CONFIG, INFO,
1088 "%s: line %d: suffix already served by this backend "
1089 "(ignored)\n", fname, lineno, 0 );
1091 Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
1092 "already served by this backend (ignored)\n",
1098 } else if ( tmp_be != NULL ) {
1100 LDAP_LOG( CONFIG, INFO,
1101 "%s: line %d: suffix already served by a preceding "
1102 "backend \"%s\"\n", fname, lineno,
1103 tmp_be->be_suffix[0].bv_val );
1105 Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
1106 "already served by a preceeding backend \"%s\"\n",
1107 fname, lineno, tmp_be->be_suffix[0].bv_val );
1113 } else if( pdn.bv_len == 0 && default_search_nbase.bv_len ) {
1115 LDAP_LOG( CONFIG, INFO,
1116 "%s: line %d: suffix DN empty and default search "
1117 "base provided \"%s\" (assuming okay).\n",
1118 fname, lineno, default_search_base.bv_val );
1120 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1121 "suffix DN empty and default "
1122 "search base provided \"%s\" (assuming okay)\n",
1123 fname, lineno, default_search_base.bv_val );
1127 ber_bvarray_add( &be->be_suffix, &pdn );
1128 ber_bvarray_add( &be->be_nsuffix, &ndn );
1130 /* set max deref depth */
1131 } else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) {
1135 LDAP_LOG( CONFIG, CRIT,
1136 "%s: line %d: missing depth in \"maxDerefDepth <depth>\""
1137 " line\n", fname, lineno, 0 );
1139 Debug( LDAP_DEBUG_ANY,
1140 "%s: line %d: missing depth in \"maxDerefDepth <depth>\" line\n",
1148 LDAP_LOG( CONFIG, INFO,
1149 "%s: line %d: depth line must appear inside a database "
1150 "definition.\n", fname, lineno ,0 );
1152 Debug( LDAP_DEBUG_ANY,
1153 "%s: line %d: depth line must appear inside a database definition.\n",
1159 i = strtol( cargv[1], &next, 10 );
1160 if ( next == NULL || next[0] != '\0' ) {
1162 LDAP_LOG( CONFIG, INFO,
1163 "%s: line %d: unable to parse depth \"%s\" in \"maxDerefDepth <depth>\" "
1164 "line.\n", fname, lineno, cargv[1] );
1166 Debug( LDAP_DEBUG_ANY,
1167 "%s: line %d: unable to parse depth \"%s\" in \"maxDerefDepth <depth>\" "
1168 "line.\n", fname, lineno, cargv[1] );
1175 LDAP_LOG( CONFIG, INFO,
1176 "%s: line %d: depth must be positive.\n",
1179 Debug( LDAP_DEBUG_ANY,
1180 "%s: line %d: depth must be positive.\n",
1187 be->be_max_deref_depth = i;
1189 /* set magic "root" dn for this database */
1190 } else if ( strcasecmp( cargv[0], "rootdn" ) == 0 ) {
1193 LDAP_LOG( CONFIG, INFO,
1194 "%s: line %d: missing dn in \"rootdn <dn>\" line.\n",
1197 Debug( LDAP_DEBUG_ANY,
1198 "%s: line %d: missing dn in \"rootdn <dn>\" line\n",
1207 LDAP_LOG( CONFIG, INFO,
1208 "%s: line %d: rootdn line must appear inside a database "
1209 "definition.\n", fname, lineno ,0 );
1211 Debug( LDAP_DEBUG_ANY,
1212 "%s: line %d: rootdn line must appear inside a database definition.\n",
1220 if ( load_ucdata( NULL ) < 0 ) return 1;
1222 dn.bv_val = cargv[1];
1223 dn.bv_len = strlen( cargv[1] );
1225 rc = dnPrettyNormal( NULL, &dn,
1227 &be->be_rootndn, NULL );
1229 if( rc != LDAP_SUCCESS ) {
1231 LDAP_LOG( CONFIG, CRIT,
1232 "%s: line %d: rootdn DN is invalid.\n",
1235 Debug( LDAP_DEBUG_ANY,
1236 "%s: line %d: rootdn DN is invalid\n",
1243 /* set super-secret magic database password */
1244 } else if ( strcasecmp( cargv[0], "rootpw" ) == 0 ) {
1247 LDAP_LOG( CONFIG, CRIT,
1248 "%s: line %d: missing passwd in \"rootpw <passwd>\""
1249 " line\n", fname, lineno ,0 );
1251 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1252 "missing passwd in \"rootpw <passwd>\" line\n",
1261 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
1262 "rootpw line must appear inside a database "
1263 "definition.\n", fname, lineno ,0 );
1265 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1266 "rootpw line must appear inside a database "
1273 Backend *tmp_be = select_backend( &be->be_rootndn, 0, 0 );
1275 if( tmp_be != be ) {
1277 LDAP_LOG( CONFIG, INFO,
1279 "rootpw can only be set when rootdn is under suffix\n",
1280 fname, lineno, "" );
1282 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1283 "rootpw can only be set when rootdn is under suffix\n",
1289 be->be_rootpw.bv_val = ch_strdup( cargv[1] );
1290 be->be_rootpw.bv_len = strlen( be->be_rootpw.bv_val );
1293 /* make this database read-only */
1294 } else if ( strcasecmp( cargv[0], "readonly" ) == 0 ) {
1297 LDAP_LOG( CONFIG, CRIT,
1298 "%s: line %d: missing on|off in \"readonly <on|off>\" "
1299 "line.\n", fname, lineno ,0 );
1301 Debug( LDAP_DEBUG_ANY,
1302 "%s: line %d: missing on|off in \"readonly <on|off>\" line\n",
1309 if ( strcasecmp( cargv[1], "on" ) == 0 ) {
1310 global_restrictops |= SLAP_RESTRICT_OP_WRITES;
1312 global_restrictops &= ~SLAP_RESTRICT_OP_WRITES;
1315 if ( strcasecmp( cargv[1], "on" ) == 0 ) {
1316 be->be_restrictops |= SLAP_RESTRICT_OP_WRITES;
1318 be->be_restrictops &= ~SLAP_RESTRICT_OP_WRITES;
1323 /* allow these features */
1324 } else if ( strcasecmp( cargv[0], "allows" ) == 0 ||
1325 strcasecmp( cargv[0], "allow" ) == 0 )
1327 slap_mask_t allows = 0;
1331 LDAP_LOG( CONFIG, INFO,
1332 "%s: line %d: allow line must appear prior to "
1333 "database definitions.\n", fname, lineno ,0 );
1335 Debug( LDAP_DEBUG_ANY,
1336 "%s: line %d: allow line must appear prior to database definitions\n",
1344 LDAP_LOG( CONFIG, CRIT,
1345 "%s: line %d: missing feature(s) in \"allow <features>\""
1346 " line\n", fname, lineno ,0 );
1348 Debug( LDAP_DEBUG_ANY,
1349 "%s: line %d: missing feature(s) in \"allow <features>\" line\n",
1356 for( i=1; i < cargc; i++ ) {
1357 if( strcasecmp( cargv[i], "bind_v2" ) == 0 ) {
1358 allows |= SLAP_ALLOW_BIND_V2;
1360 } else if( strcasecmp( cargv[i], "bind_anon_cred" ) == 0 ) {
1361 allows |= SLAP_ALLOW_BIND_ANON_CRED;
1363 } else if( strcasecmp( cargv[i], "bind_anon_dn" ) == 0 ) {
1364 allows |= SLAP_ALLOW_BIND_ANON_DN;
1366 } else if( strcasecmp( cargv[i], "update_anon" ) == 0 ) {
1367 allows |= SLAP_ALLOW_UPDATE_ANON;
1371 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
1372 "unknown feature %s in \"allow <features>\" line.\n",
1373 fname, lineno, cargv[i] );
1375 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1376 "unknown feature %s in \"allow <features>\" line\n",
1377 fname, lineno, cargv[i] );
1384 global_allows |= allows;
1386 /* disallow these features */
1387 } else if ( strcasecmp( cargv[0], "disallows" ) == 0 ||
1388 strcasecmp( cargv[0], "disallow" ) == 0 )
1390 slap_mask_t disallows = 0;
1394 LDAP_LOG( CONFIG, INFO,
1395 "%s: line %d: disallow line must appear prior to "
1396 "database definitions.\n", fname, lineno ,0 );
1398 Debug( LDAP_DEBUG_ANY,
1399 "%s: line %d: disallow line must appear prior to database definitions\n",
1407 LDAP_LOG( CONFIG, CRIT,
1408 "%s: line %d: missing feature(s) in \"disallow <features>\""
1409 " line.\n", fname, lineno ,0 );
1411 Debug( LDAP_DEBUG_ANY,
1412 "%s: line %d: missing feature(s) in \"disallow <features>\" line\n",
1419 for( i=1; i < cargc; i++ ) {
1420 if( strcasecmp( cargv[i], "bind_anon" ) == 0 ) {
1421 disallows |= SLAP_DISALLOW_BIND_ANON;
1423 } else if( strcasecmp( cargv[i], "bind_simple" ) == 0 ) {
1424 disallows |= SLAP_DISALLOW_BIND_SIMPLE;
1426 } else if( strcasecmp( cargv[i], "bind_krbv4" ) == 0 ) {
1427 disallows |= SLAP_DISALLOW_BIND_KRBV4;
1429 } else if( strcasecmp( cargv[i], "tls_2_anon" ) == 0 ) {
1430 disallows |= SLAP_DISALLOW_TLS_2_ANON;
1432 } else if( strcasecmp( cargv[i], "tls_authc" ) == 0 ) {
1433 disallows |= SLAP_DISALLOW_TLS_AUTHC;
1437 LDAP_LOG( CONFIG, CRIT,
1438 "%s: line %d: unknown feature %s in "
1439 "\"disallow <features>\" line.\n",
1440 fname, lineno, cargv[i] );
1442 Debug( LDAP_DEBUG_ANY,
1443 "%s: line %d: unknown feature %s in \"disallow <features>\" line\n",
1444 fname, lineno, cargv[i] );
1451 global_disallows |= disallows;
1453 /* require these features */
1454 } else if ( strcasecmp( cargv[0], "requires" ) == 0 ||
1455 strcasecmp( cargv[0], "require" ) == 0 )
1457 slap_mask_t requires = 0;
1461 LDAP_LOG( CONFIG, CRIT,
1462 "%s: line %d: missing feature(s) in "
1463 "\"require <features>\" line.\n", fname, lineno ,0 );
1465 Debug( LDAP_DEBUG_ANY,
1466 "%s: line %d: missing feature(s) in \"require <features>\" line\n",
1473 for( i=1; i < cargc; i++ ) {
1474 if( strcasecmp( cargv[i], "bind" ) == 0 ) {
1475 requires |= SLAP_REQUIRE_BIND;
1477 } else if( strcasecmp( cargv[i], "LDAPv3" ) == 0 ) {
1478 requires |= SLAP_REQUIRE_LDAP_V3;
1480 } else if( strcasecmp( cargv[i], "authc" ) == 0 ) {
1481 requires |= SLAP_REQUIRE_AUTHC;
1483 } else if( strcasecmp( cargv[i], "SASL" ) == 0 ) {
1484 requires |= SLAP_REQUIRE_SASL;
1486 } else if( strcasecmp( cargv[i], "strong" ) == 0 ) {
1487 requires |= SLAP_REQUIRE_STRONG;
1489 } else if( strcasecmp( cargv[i], "none" ) != 0 ) {
1491 LDAP_LOG( CONFIG, CRIT,
1492 "%s: line %d: unknown feature %s in "
1493 "\"require <features>\" line.\n",
1494 fname, lineno , cargv[i] );
1496 Debug( LDAP_DEBUG_ANY,
1497 "%s: line %d: unknown feature %s in \"require <features>\" line\n",
1498 fname, lineno, cargv[i] );
1506 global_requires = requires;
1508 be->be_requires = requires;
1511 /* required security factors */
1512 } else if ( strcasecmp( cargv[0], "security" ) == 0 ) {
1513 slap_ssf_set_t *set;
1517 LDAP_LOG( CONFIG, CRIT,
1518 "%s: line %d: missing factor(s) in \"security <factors>\""
1519 " line.\n", fname, lineno ,0 );
1521 Debug( LDAP_DEBUG_ANY,
1522 "%s: line %d: missing factor(s) in \"security <factors>\" line\n",
1530 set = &global_ssf_set;
1532 set = &be->be_ssf_set;
1535 for( i=1; i < cargc; i++ ) {
1539 if ( strncasecmp( cargv[i], "ssf=",
1540 STRLENOF("ssf=") ) == 0 )
1542 tgt = &set->sss_ssf;
1543 src = &cargv[i][STRLENOF("ssf=")];
1545 } else if ( strncasecmp( cargv[i], "transport=",
1546 STRLENOF("transport=") ) == 0 )
1548 tgt = &set->sss_transport;
1549 src = &cargv[i][STRLENOF("transport=")];
1551 } else if ( strncasecmp( cargv[i], "tls=",
1552 STRLENOF("tls=") ) == 0 )
1554 tgt = &set->sss_tls;
1555 src = &cargv[i][STRLENOF("tls=")];
1557 } else if ( strncasecmp( cargv[i], "sasl=",
1558 STRLENOF("sasl=") ) == 0 )
1560 tgt = &set->sss_sasl;
1561 src = &cargv[i][STRLENOF("sasl=")];
1563 } else if ( strncasecmp( cargv[i], "update_ssf=",
1564 STRLENOF("update_ssf=") ) == 0 )
1566 tgt = &set->sss_update_ssf;
1567 src = &cargv[i][STRLENOF("update_ssf=")];
1569 } else if ( strncasecmp( cargv[i], "update_transport=",
1570 STRLENOF("update_transport=") ) == 0 )
1572 tgt = &set->sss_update_transport;
1573 src = &cargv[i][STRLENOF("update_transport=")];
1575 } else if ( strncasecmp( cargv[i], "update_tls=",
1576 STRLENOF("update_tls=") ) == 0 )
1578 tgt = &set->sss_update_tls;
1579 src = &cargv[i][STRLENOF("update_tls=")];
1581 } else if ( strncasecmp( cargv[i], "update_sasl=",
1582 STRLENOF("update_sasl=") ) == 0 )
1584 tgt = &set->sss_update_sasl;
1585 src = &cargv[i][STRLENOF("update_sasl=")];
1587 } else if ( strncasecmp( cargv[i], "simple_bind=",
1588 STRLENOF("simple_bind=") ) == 0 )
1590 tgt = &set->sss_simple_bind;
1591 src = &cargv[i][STRLENOF("simple_bind=")];
1595 LDAP_LOG( CONFIG, CRIT,
1596 "%s: line %d: unknown factor %s in "
1597 "\"security <factors>\" line.\n",
1598 fname, lineno, cargv[1] );
1600 Debug( LDAP_DEBUG_ANY,
1601 "%s: line %d: unknown factor %s in \"security <factors>\" line\n",
1602 fname, lineno, cargv[i] );
1608 *tgt = strtol( src, &next, 10 );
1609 if ( next == NULL || next[0] != '\0' ) {
1611 LDAP_LOG( CONFIG, CRIT,
1612 "%s: line %d: unable to parse factor \"%s\" in "
1613 "\"security <factors>\" line.\n",
1614 fname, lineno, cargv[1] );
1616 Debug( LDAP_DEBUG_ANY,
1617 "%s: line %d: unable to parse factor \"%s\" in \"security <factors>\" line\n",
1618 fname, lineno, cargv[i] );
1625 /* where to send clients when we don't hold it */
1626 } else if ( strcasecmp( cargv[0], "referral" ) == 0 ) {
1629 LDAP_LOG( CONFIG, CRIT,
1630 "%s: line %d: missing URL in \"referral <URL>\""
1631 " line.\n", fname, lineno , 0 );
1633 Debug( LDAP_DEBUG_ANY,
1634 "%s: line %d: missing URL in \"referral <URL>\" line\n",
1641 if( validate_global_referral( cargv[1] ) ) {
1643 LDAP_LOG( CONFIG, CRIT,
1644 "%s: line %d: invalid URL (%s) in \"referral\" line.\n",
1645 fname, lineno, cargv[1] );
1647 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1648 "invalid URL (%s) in \"referral\" line.\n",
1649 fname, lineno, cargv[1] );
1654 vals[0].bv_val = cargv[1];
1655 vals[0].bv_len = strlen( vals[0].bv_val );
1656 if( value_add( &default_referral, vals ) )
1660 } else if ( strcasecmp( cargv[0], "logfile" ) == 0 ) {
1664 LDAP_LOG( CONFIG, CRIT,
1665 "%s: line %d: Error in logfile directive, "
1666 "\"logfile <filename>\"\n", fname, lineno , 0 );
1668 Debug( LDAP_DEBUG_ANY,
1669 "%s: line %d: Error in logfile directive, \"logfile filename\"\n",
1675 logfile = fopen( cargv[1], "w" );
1676 if ( logfile != NULL ) lutil_debug_file( logfile );
1679 /* start of a new database definition */
1680 } else if ( strcasecmp( cargv[0], "debug" ) == 0 ) {
1684 LDAP_LOG( CONFIG, CRIT,
1685 "%s: line %d: Error in debug directive, "
1686 "\"debug <subsys> <level>\"\n", fname, lineno , 0 );
1688 Debug( LDAP_DEBUG_ANY,
1689 "%s: line %d: Error in debug directive, \"debug subsys level\"\n",
1694 level = strtol( cargv[2], &next, 10 );
1695 if ( next == NULL || next[0] != '\0' ){
1697 LDAP_LOG( CONFIG, CRIT,
1698 "%s: line %d: unable to parse level \"%s\" in debug directive, "
1699 "\"debug <subsys> <level>\"\n", fname, lineno , cargv[2] );
1701 Debug( LDAP_DEBUG_ANY,
1702 "%s: line %d: unable to parse level \"%s\" in debug directive, "
1703 "\"debug <subsys> <level>\"\n", fname, lineno , cargv[2] );
1708 if ( level <= 0 ) level = lutil_mnem2level( cargv[2] );
1709 lutil_set_debug_level( cargv[1], level );
1710 /* specify an Object Identifier macro */
1711 } else if ( strcasecmp( cargv[0], "objectidentifier" ) == 0 ) {
1712 rc = parse_oidm( fname, lineno, cargc, cargv );
1715 /* specify an objectclass */
1716 } else if ( strcasecmp( cargv[0], "objectclass" ) == 0 ) {
1719 LDAP_LOG( CONFIG, INFO,
1720 "%s: line %d: illegal objectclass format.\n",
1721 fname, lineno , 0 );
1723 Debug( LDAP_DEBUG_ANY,
1724 "%s: line %d: illegal objectclass format.\n",
1729 } else if ( *cargv[1] == '(' /*')'*/) {
1731 p = strchr(saveline,'(' /*')'*/);
1732 rc = parse_oc( fname, lineno, p, cargv );
1737 LDAP_LOG( CONFIG, INFO,
1738 "%s: line %d: old objectclass format not supported\n",
1739 fname, lineno , 0 );
1741 Debug( LDAP_DEBUG_ANY,
1742 "%s: line %d: old objectclass format not supported.\n",
1747 } else if ( strcasecmp( cargv[0], "ditcontentrule" ) == 0 ) {
1749 p = strchr(saveline,'(' /*')'*/);
1750 rc = parse_cr( fname, lineno, p, cargv );
1753 /* specify an attribute type */
1754 } else if (( strcasecmp( cargv[0], "attributetype" ) == 0 )
1755 || ( strcasecmp( cargv[0], "attribute" ) == 0 ))
1759 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
1760 "illegal attribute type format.\n",
1761 fname, lineno , 0 );
1763 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1764 "illegal attribute type format.\n",
1769 } else if ( *cargv[1] == '(' /*')'*/) {
1771 p = strchr(saveline,'(' /*')'*/);
1772 rc = parse_at( fname, lineno, p, cargv );
1777 LDAP_LOG( CONFIG, INFO,
1778 "%s: line %d: old attribute type format not supported.\n",
1779 fname, lineno , 0 );
1781 Debug( LDAP_DEBUG_ANY,
1782 "%s: line %d: old attribute type format not supported.\n",
1788 /* define attribute option(s) */
1789 } else if ( strcasecmp( cargv[0], "attributeoptions" ) == 0 ) {
1790 ad_define_option( NULL, NULL, 0 );
1791 for ( i = 1; i < cargc; i++ )
1792 if ( ad_define_option( cargv[i], fname, lineno ) != 0 )
1795 /* turn on/off schema checking */
1796 } else if ( strcasecmp( cargv[0], "schemacheck" ) == 0 ) {
1799 LDAP_LOG( CONFIG, CRIT,
1800 "%s: line %d: missing on|off in \"schemacheck <on|off>\""
1801 " line.\n", fname, lineno , 0 );
1803 Debug( LDAP_DEBUG_ANY,
1804 "%s: line %d: missing on|off in \"schemacheck <on|off>\" line\n",
1810 if ( strcasecmp( cargv[1], "off" ) == 0 ) {
1812 LDAP_LOG( CONFIG, CRIT,
1813 "%s: line %d: schema checking disabled! your mileage may "
1814 "vary!\n", fname, lineno , 0 );
1816 Debug( LDAP_DEBUG_ANY,
1817 "%s: line %d: schema checking disabled! your mileage may vary!\n",
1820 global_schemacheck = 0;
1822 global_schemacheck = 1;
1825 /* specify access control info */
1826 } else if ( strcasecmp( cargv[0], "access" ) == 0 ) {
1827 parse_acl( be, fname, lineno, cargc, cargv );
1829 /* debug level to log things to syslog */
1830 } else if ( strcasecmp( cargv[0], "loglevel" ) == 0 ) {
1833 LDAP_LOG( CONFIG, CRIT,
1834 "%s: line %d: missing level(s) in \"loglevel <level> [...]\""
1835 " line.\n", fname, lineno , 0 );
1837 Debug( LDAP_DEBUG_ANY,
1838 "%s: line %d: missing level(s) in \"loglevel <level> [...]\" line\n",
1847 for( i=1; i < cargc; i++ ) {
1848 int level = strtol( cargv[i], &next, 10 );
1849 if ( next == NULL || next[0] != '\0' ) {
1851 LDAP_LOG( CONFIG, CRIT,
1852 "%s: line %d: unable to parse level \"%s\" in \"loglevel <level> [...]\""
1853 " line.\n", fname, lineno , cargv[i] );
1855 Debug( LDAP_DEBUG_ANY,
1856 "%s: line %d: unable to parse level \"%s\" in \"loglevel <level> [...]\""
1857 " line.\n", fname, lineno , cargv[i] );
1862 ldap_syslog |= level;
1865 /* list of sync replication information in this backend (slave only) */
1866 } else if ( strcasecmp( cargv[0], "syncrepl" ) == 0 ) {
1870 LDAP_LOG( CONFIG, INFO,
1871 "%s: line %d: syncrepl line must appear inside "
1872 "a database definition.\n", fname, lineno, 0);
1874 Debug( LDAP_DEBUG_ANY,
1875 "%s: line %d: syncrepl line must appear inside "
1876 "a database definition.\n", fname, lineno, 0);
1880 } else if ( SLAP_SHADOW( be )) {
1882 LDAP_LOG( CONFIG, INFO,
1883 "%s: line %d: syncrepl: database already shadowed.\n",
1886 Debug( LDAP_DEBUG_ANY,
1887 "%s: line %d: syncrepl: database already shadowed.\n",
1892 } else if ( add_syncrepl( be, cargv, cargc )) {
1896 SLAP_DBFLAGS(be) |= ( SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SYNC_SHADOW );
1898 /* list of replicas of the data in this backend (master only) */
1899 } else if ( strcasecmp( cargv[0], "replica" ) == 0 ) {
1902 LDAP_LOG( CONFIG, CRIT,
1903 "%s: line %d: missing host or uri in \"replica "
1904 " <host[:port]\" line\n", fname, lineno , 0 );
1906 Debug( LDAP_DEBUG_ANY,
1907 "%s: line %d: missing host or uri in \"replica <host[:port]>\" line\n",
1915 LDAP_LOG( CONFIG, INFO,
1916 "%s: line %d: replica line must appear inside "
1917 "a database definition.\n", fname, lineno, 0);
1919 Debug( LDAP_DEBUG_ANY,
1920 "%s: line %d: replica line must appear inside a database definition\n",
1928 for ( i = 1; i < cargc; i++ ) {
1929 if ( strncasecmp( cargv[i], "host=", 5 )
1931 nr = add_replica_info( be,
1934 } else if (strncasecmp( cargv[i], "uri=", 4 )
1936 if ( ldap_url_parse( cargv[ i ] + 4, &ludp )
1939 LDAP_LOG( CONFIG, INFO,
1940 "%s: line %d: replica line contains invalid "
1941 "uri definition.\n", fname, lineno, 0);
1943 Debug( LDAP_DEBUG_ANY,
1944 "%s: line %d: replica line contains invalid "
1945 "uri definition.\n", fname, lineno, 0);
1949 if (ludp->lud_host == NULL ) {
1951 LDAP_LOG( CONFIG, INFO,
1952 "%s: line %d: replica line contains invalid "
1953 "uri definition - missing hostname.\n",
1956 Debug( LDAP_DEBUG_ANY,
1957 "%s: line %d: replica line contains invalid "
1958 "uri definition - missing hostname.\n", fname, lineno, 0);
1962 replicahost = ch_malloc( strlen( cargv[ i ] ) );
1963 if ( replicahost == NULL ) {
1965 LDAP_LOG( CONFIG, ERR,
1966 "out of memory in read_config\n", 0, 0,0 );
1968 Debug( LDAP_DEBUG_ANY,
1969 "out of memory in read_config\n", 0, 0, 0 );
1971 ldap_free_urldesc( ludp );
1972 exit( EXIT_FAILURE );
1974 sprintf(replicahost, "%s:%d",
1975 ludp->lud_host, ludp->lud_port);
1976 nr = add_replica_info( be, replicahost );
1977 ldap_free_urldesc( ludp );
1978 ch_free(replicahost);
1984 LDAP_LOG( CONFIG, INFO,
1985 "%s: line %d: missing host or uri in \"replica\" line\n",
1986 fname, lineno , 0 );
1988 Debug( LDAP_DEBUG_ANY,
1989 "%s: line %d: missing host or uri in \"replica\" line\n",
1994 } else if ( nr == -1 ) {
1996 LDAP_LOG( CONFIG, INFO,
1997 "%s: line %d: unable to add"
1998 " replica \"%s\"\n",
2002 Debug( LDAP_DEBUG_ANY,
2003 "%s: line %d: unable to add replica \"%s\"\n",
2004 fname, lineno, cargv[i] + 5 );
2008 for ( i = 1; i < cargc; i++ ) {
2009 if ( strncasecmp( cargv[i], "suffix=", 7 ) == 0 ) {
2011 switch ( add_replica_suffix( be, nr, cargv[i] + 7 ) ) {
2014 LDAP_LOG( CONFIG, INFO,
2015 "%s: line %d: suffix \"%s\" in \"replica\""
2016 " line is not valid for backend(ignored)\n",
2017 fname, lineno, cargv[i] + 7 );
2019 Debug( LDAP_DEBUG_ANY,
2020 "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
2021 fname, lineno, cargv[i] + 7 );
2027 LDAP_LOG( CONFIG, INFO,
2028 "%s: line %d: unable to normalize suffix"
2029 " in \"replica\" line (ignored)\n",
2030 fname, lineno , 0 );
2032 Debug( LDAP_DEBUG_ANY,
2033 "%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
2039 } else if ( strncasecmp( cargv[i], "attr", 4 ) == 0 ) {
2041 char *arg = cargv[i] + 4;
2043 if ( arg[0] == '!' ) {
2048 if ( arg[0] != '=' ) {
2052 if ( add_replica_attrs( be, nr, arg + 1, exclude ) ) {
2054 LDAP_LOG( CONFIG, INFO,
2055 "%s: line %d: attribute \"%s\" in "
2056 "\"replica\" line is unknown\n",
2057 fname, lineno, arg + 1 );
2059 Debug( LDAP_DEBUG_ANY,
2060 "%s: line %d: attribute \"%s\" in \"replica\" line is unknown\n",
2061 fname, lineno, arg + 1 );
2070 } else if ( strcasecmp( cargv[0], "replicationInterval" ) == 0 ) {
2073 /* dn of slave entity allowed to write to replica */
2074 } else if ( strcasecmp( cargv[0], "updatedn" ) == 0 ) {
2077 LDAP_LOG( CONFIG, CRIT,
2078 "%s: line %d: missing dn in \"updatedn <dn>\""
2079 " line.\n", fname, lineno , 0 );
2081 Debug( LDAP_DEBUG_ANY,
2082 "%s: line %d: missing dn in \"updatedn <dn>\" line\n",
2090 LDAP_LOG( CONFIG, INFO,
2091 "%s: line %d: updatedn line must appear inside "
2092 "a database definition\n",
2093 fname, lineno , 0 );
2095 Debug( LDAP_DEBUG_ANY,
2096 "%s: line %d: updatedn line must appear inside a database definition\n",
2101 } else if ( SLAP_SHADOW(be) ) {
2103 LDAP_LOG( CONFIG, INFO,
2104 "%s: line %d: updatedn: database already shadowed.\n",
2107 Debug( LDAP_DEBUG_ANY,
2108 "%s: line %d: updatedn: database already shadowed.\n",
2116 if ( load_ucdata( NULL ) < 0 ) return 1;
2118 dn.bv_val = cargv[1];
2119 dn.bv_len = strlen( cargv[1] );
2121 rc = dnNormalize( 0, NULL, NULL, &dn, &be->be_update_ndn, NULL );
2122 if( rc != LDAP_SUCCESS ) {
2124 LDAP_LOG( CONFIG, CRIT,
2125 "%s: line %d: updatedn DN is invalid.\n",
2126 fname, lineno , 0 );
2128 Debug( LDAP_DEBUG_ANY,
2129 "%s: line %d: updatedn DN is invalid\n",
2136 SLAP_DBFLAGS(be) |= ( SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW );
2138 } else if ( strcasecmp( cargv[0], "updateref" ) == 0 ) {
2141 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2142 "missing url in \"updateref <ldapurl>\" line.\n",
2143 fname, lineno , 0 );
2145 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2146 "missing url in \"updateref <ldapurl>\" line\n",
2154 LDAP_LOG( CONFIG, INFO, "%s: line %d: updateref"
2155 " line must appear inside a database definition\n",
2156 fname, lineno , 0 );
2158 Debug( LDAP_DEBUG_ANY, "%s: line %d: updateref"
2159 " line must appear inside a database definition\n",
2164 } else if ( !SLAP_SHADOW(be) ) {
2166 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
2167 "updateref line must come after syncrepl or updatedn.\n",
2168 fname, lineno , 0 );
2170 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2171 "updateref line must after syncrepl or updatedn.\n",
2177 if( validate_global_referral( cargv[1] ) ) {
2179 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2180 "invalid URL (%s) in \"updateref\" line.\n",
2181 fname, lineno, cargv[1] );
2183 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2184 "invalid URL (%s) in \"updateref\" line.\n",
2185 fname, lineno, cargv[1] );
2190 vals[0].bv_val = cargv[1];
2191 vals[0].bv_len = strlen( vals[0].bv_val );
2192 if( value_add( &be->be_update_refs, vals ) ) {
2196 /* replication log file to which changes are appended */
2197 } else if ( strcasecmp( cargv[0], "replogfile" ) == 0 ) {
2200 LDAP_LOG( CONFIG, CRIT,
2201 "%s: line %d: missing filename in \"replogfile <filename>\""
2202 " line.\n", fname, lineno , 0 );
2204 Debug( LDAP_DEBUG_ANY,
2205 "%s: line %d: missing filename in \"replogfile <filename>\" line\n",
2212 be->be_replogfile = ch_strdup( cargv[1] );
2214 replogfile = ch_strdup( cargv[1] );
2217 /* file from which to read additional rootdse attrs */
2218 } else if ( strcasecmp( cargv[0], "rootDSE" ) == 0) {
2221 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2222 "missing filename in \"rootDSE <filename>\" line.\n",
2223 fname, lineno , 0 );
2225 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2226 "missing filename in \"rootDSE <filename>\" line.\n",
2232 if( read_root_dse_file( cargv[1] ) ) {
2234 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2235 "could not read \"rootDSE <filename>\" line.\n",
2236 fname, lineno , 0 );
2238 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2239 "could not read \"rootDSE <filename>\" line\n",
2245 /* maintain lastmodified{by,time} attributes */
2246 } else if ( strcasecmp( cargv[0], "lastmod" ) == 0 ) {
2249 LDAP_LOG( CONFIG, CRIT,
2250 "%s: line %d: missing on|off in \"lastmod <on|off>\""
2251 " line.\n", fname, lineno , 0 );
2253 Debug( LDAP_DEBUG_ANY,
2254 "%s: line %d: missing on|off in \"lastmod <on|off>\" line\n",
2263 LDAP_LOG( CONFIG, INFO, "%s: line %d: lastmod"
2264 " line must appear inside a database definition\n",
2265 fname, lineno , 0 );
2267 Debug( LDAP_DEBUG_ANY, "%s: line %d: lastmod"
2268 " line must appear inside a database definition\n",
2273 } else if ( SLAP_NOLASTMODCMD(be) ) {
2275 LDAP_LOG( CONFIG, INFO, "%s: line %d: lastmod"
2276 " not available for %s database\n",
2277 fname, lineno , be->bd_info->bi_type );
2279 Debug( LDAP_DEBUG_ANY, "%s: line %d: lastmod"
2280 " not available for %s databases\n",
2281 fname, lineno, be->bd_info->bi_type );
2286 if ( strcasecmp( cargv[1], "on" ) == 0 ) {
2287 SLAP_DBFLAGS(be) &= ~SLAP_DBFLAG_NOLASTMOD;
2289 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NOLASTMOD;
2293 /* turn on/off gentle SIGHUP handling */
2294 } else if ( strcasecmp( cargv[0], "gentlehup" ) == 0 ) {
2296 Debug( LDAP_DEBUG_ANY,
2297 "%s: line %d: missing on|off in \"gentlehup <on|off>\" line\n",
2301 if ( strcasecmp( cargv[1], "off" ) == 0 ) {
2302 global_gentlehup = 0;
2304 global_gentlehup = 1;
2308 /* set idle timeout value */
2309 } else if ( strcasecmp( cargv[0], "idletimeout" ) == 0 ) {
2313 LDAP_LOG( CONFIG, CRIT,
2314 "%s: line %d: missing timeout value in "
2315 "\"idletimeout <seconds>\" line.\n", fname, lineno , 0 );
2317 Debug( LDAP_DEBUG_ANY,
2318 "%s: line %d: missing timeout value in \"idletimeout <seconds>\" line\n",
2325 i = atoi( cargv[1] );
2329 LDAP_LOG( CONFIG, CRIT,
2330 "%s: line %d: timeout value (%d) invalid "
2331 "\"idletimeout <seconds>\" line.\n", fname, lineno, i );
2333 Debug( LDAP_DEBUG_ANY,
2334 "%s: line %d: timeout value (%d) invalid \"idletimeout <seconds>\" line\n",
2341 global_idletimeout = i;
2343 /* include another config file */
2344 } else if ( strcasecmp( cargv[0], "include" ) == 0 ) {
2347 LDAP_LOG( CONFIG, CRIT,
2348 "%s: line %d: missing filename in \"include "
2349 "<filename>\" line.\n", fname, lineno , 0 );
2351 Debug( LDAP_DEBUG_ANY,
2352 "%s: line %d: missing filename in \"include <filename>\" line\n",
2358 savefname = ch_strdup( cargv[1] );
2359 savelineno = lineno;
2361 if ( read_config( savefname, depth+1 ) != 0 ) {
2366 lineno = savelineno - 1;
2368 /* location of kerberos srvtab file */
2369 } else if ( strcasecmp( cargv[0], "srvtab" ) == 0 ) {
2372 LDAP_LOG( CONFIG, CRIT,
2373 "%s: line %d: missing filename in \"srvtab "
2374 "<filename>\" line.\n", fname, lineno , 0 );
2376 Debug( LDAP_DEBUG_ANY,
2377 "%s: line %d: missing filename in \"srvtab <filename>\" line\n",
2383 ldap_srvtab = ch_strdup( cargv[1] );
2385 #ifdef SLAPD_MODULES
2386 } else if (strcasecmp( cargv[0], "moduleload") == 0 ) {
2389 LDAP_LOG( CONFIG, INFO,
2390 "%s: line %d: missing filename in \"moduleload "
2391 "<filename>\" line.\n", fname, lineno , 0 );
2393 Debug( LDAP_DEBUG_ANY,
2394 "%s: line %d: missing filename in \"moduleload <filename>\" line\n",
2398 exit( EXIT_FAILURE );
2400 if (module_load(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) {
2402 LDAP_LOG( CONFIG, CRIT,
2403 "%s: line %d: failed to load or initialize module %s\n",
2404 fname, lineno, cargv[1] );
2406 Debug( LDAP_DEBUG_ANY,
2407 "%s: line %d: failed to load or initialize module %s\n",
2408 fname, lineno, cargv[1]);
2411 exit( EXIT_FAILURE );
2413 } else if (strcasecmp( cargv[0], "modulepath") == 0 ) {
2416 LDAP_LOG( CONFIG, INFO,
2417 "%s: line %d: missing path in \"modulepath <path>\""
2418 " line\n", fname, lineno , 0 );
2420 Debug( LDAP_DEBUG_ANY,
2421 "%s: line %d: missing path in \"modulepath <path>\" line\n",
2425 exit( EXIT_FAILURE );
2427 if (module_path( cargv[1] )) {
2429 LDAP_LOG( CONFIG, CRIT,
2430 "%s: line %d: failed to set module search path to %s.\n",
2431 fname, lineno, cargv[1] );
2433 Debug( LDAP_DEBUG_ANY,
2434 "%s: line %d: failed to set module search path to %s\n",
2435 fname, lineno, cargv[1]);
2438 exit( EXIT_FAILURE );
2441 #endif /*SLAPD_MODULES*/
2444 } else if ( !strcasecmp( cargv[0], "TLSRandFile" ) ) {
2445 rc = ldap_pvt_tls_set_option( NULL,
2446 LDAP_OPT_X_TLS_RANDOM_FILE,
2451 } else if ( !strcasecmp( cargv[0], "TLSCipherSuite" ) ) {
2452 rc = ldap_pvt_tls_set_option( NULL,
2453 LDAP_OPT_X_TLS_CIPHER_SUITE,
2458 } else if ( !strcasecmp( cargv[0], "TLSCertificateFile" ) ) {
2459 rc = ldap_pvt_tls_set_option( NULL,
2460 LDAP_OPT_X_TLS_CERTFILE,
2465 } else if ( !strcasecmp( cargv[0], "TLSCertificateKeyFile" ) ) {
2466 rc = ldap_pvt_tls_set_option( NULL,
2467 LDAP_OPT_X_TLS_KEYFILE,
2472 } else if ( !strcasecmp( cargv[0], "TLSCACertificatePath" ) ) {
2473 rc = ldap_pvt_tls_set_option( NULL,
2474 LDAP_OPT_X_TLS_CACERTDIR,
2479 } else if ( !strcasecmp( cargv[0], "TLSCACertificateFile" ) ) {
2480 rc = ldap_pvt_tls_set_option( NULL,
2481 LDAP_OPT_X_TLS_CACERTFILE,
2485 } else if ( !strcasecmp( cargv[0], "TLSVerifyClient" ) ) {
2486 if ( isdigit( (unsigned char) cargv[1][0] ) ) {
2488 rc = ldap_pvt_tls_set_option( NULL,
2489 LDAP_OPT_X_TLS_REQUIRE_CERT,
2492 rc = ldap_int_tls_config( NULL,
2493 LDAP_OPT_X_TLS_REQUIRE_CERT,
2502 } else if ( !strcasecmp( cargv[0], "reverse-lookup" ) ) {
2503 #ifdef SLAPD_RLOOKUPS
2506 LDAP_LOG( CONFIG, INFO,
2507 "%s: line %d: reverse-lookup: missing \"on\" or \"off\"\n",
2508 fname, lineno , 0 );
2510 Debug( LDAP_DEBUG_ANY,
2511 "%s: line %d: reverse-lookup: missing \"on\" or \"off\"\n",
2517 if ( !strcasecmp( cargv[1], "on" ) ) {
2518 use_reverse_lookup = 1;
2519 } else if ( !strcasecmp( cargv[1], "off" ) ) {
2520 use_reverse_lookup = 0;
2523 LDAP_LOG( CONFIG, INFO,
2524 "%s: line %d: reverse-lookup: "
2525 "must be \"on\" (default) or \"off\"\n", fname, lineno, 0 );
2527 Debug( LDAP_DEBUG_ANY,
2528 "%s: line %d: reverse-lookup: must be \"on\" (default) or \"off\"\n",
2534 #else /* !SLAPD_RLOOKUPS */
2536 LDAP_LOG( CONFIG, INFO,
2537 "%s: line %d: reverse lookups "
2538 "are not configured (ignored).\n", fname, lineno , 0 );
2540 Debug( LDAP_DEBUG_ANY,
2541 "%s: line %d: reverse lookups are not configured (ignored).\n",
2544 #endif /* !SLAPD_RLOOKUPS */
2546 /* Netscape plugins */
2547 } else if ( strcasecmp( cargv[0], "plugin" ) == 0 ) {
2548 #if defined( LDAP_SLAPI )
2550 #ifdef notdef /* allow global plugins, too */
2552 * a "plugin" line must be inside a database
2553 * definition, since we implement pre-,post-
2554 * and extended operation plugins
2558 LDAP_LOG( CONFIG, INFO,
2559 "%s: line %d: plugin line must appear "
2560 "insid a database definition.\n",
2563 Debug( LDAP_DEBUG_ANY, "%s: line %d: plugin "
2564 "line must appear inside a database "
2565 "definition\n", fname, lineno, 0 );
2571 if ( slapi_int_read_config( be, fname, lineno, cargc, cargv )
2575 slapi_plugins_used++;
2577 #else /* !defined( LDAP_SLAPI ) */
2579 LDAP_LOG( CONFIG, INFO,
2580 "%s: line %d: SLAPI not supported.\n",
2583 Debug( LDAP_DEBUG_ANY, "%s: line %d: SLAPI "
2584 "not supported.\n", fname, lineno, 0 );
2588 #endif /* !defined( LDAP_SLAPI ) */
2590 /* Netscape plugins */
2591 } else if ( strcasecmp( cargv[0], "pluginlog" ) == 0 ) {
2592 #if defined( LDAP_SLAPI )
2595 LDAP_LOG( CONFIG, INFO,
2596 "%s: line %d: missing file name "
2597 "in pluginlog <filename> line.\n",
2600 Debug( LDAP_DEBUG_ANY,
2601 "%s: line %d: missing file name "
2602 "in pluginlog <filename> line.\n",
2608 if ( slapi_log_file != NULL ) {
2609 ch_free( slapi_log_file );
2612 slapi_log_file = ch_strdup( cargv[1] );
2613 #endif /* !defined( LDAP_SLAPI ) */
2615 /* pass anything else to the current backend info/db config routine */
2618 if ( bi->bi_config ) {
2619 rc = (*bi->bi_config)( bi, fname, lineno, cargc, cargv );
2625 case SLAP_CONF_UNKNOWN:
2627 LDAP_LOG( CONFIG, INFO,
2628 "%s: line %d: unknown directive \"%s\" inside "
2629 "backend info definition (ignored).\n",
2630 fname, lineno, cargv[0] );
2632 Debug( LDAP_DEBUG_ANY,
2633 "%s: line %d: unknown directive \"%s\" inside backend info definition (ignored)\n",
2634 fname, lineno, cargv[0] );
2643 } else if ( be != NULL ) {
2644 if ( be->be_config ) {
2645 rc = (*be->be_config)( be, fname, lineno, cargc, cargv );
2651 case SLAP_CONF_UNKNOWN:
2653 LDAP_LOG( CONFIG, INFO,
2654 "%s: line %d: unknown directive \"%s\" inside "
2655 "backend database definition (ignored).\n",
2656 fname, lineno, cargv[0] );
2658 Debug( LDAP_DEBUG_ANY,
2659 "%s: line %d: unknown directive \"%s\" inside backend database definition (ignored)\n",
2660 fname, lineno, cargv[0] );
2671 LDAP_LOG( CONFIG, INFO,
2672 "%s: line %d: unknown directive \"%s\" outside backend "
2673 "info and database definitions (ignored).\n",
2674 fname, lineno, cargv[0] );
2676 Debug( LDAP_DEBUG_ANY,
2677 "%s: line %d: unknown directive \"%s\" outside backend info and database definitions (ignored)\n",
2678 fname, lineno, cargv[0] );
2687 if ( depth == 0 ) ch_free( cargv );
2689 if ( !global_schemadn.bv_val ) {
2690 ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1,
2692 dnNormalize( 0, NULL, NULL, &global_schemadn, &global_schemandn, NULL );
2695 if ( load_ucdata( NULL ) < 0 ) return 1;
2707 char logbuf[sizeof("pseudorootpw ***")];
2710 token = strtok_quote( line, " \t" );
2714 if ( token && ( strcasecmp( token, "rootpw" ) == 0 ||
2715 strcasecmp( token, "replica" ) == 0 || /* contains "credentials" */
2716 strcasecmp( token, "bindpw" ) == 0 || /* used in back-ldap */
2717 strcasecmp( token, "pseudorootpw" ) == 0 || /* used in back-meta */
2718 strcasecmp( token, "dbpasswd" ) == 0 ) ) /* used in back-sql */
2720 snprintf( logline = logbuf, sizeof logbuf, "%s ***", token );
2723 if ( strtok_quote_ptr ) {
2724 *strtok_quote_ptr = ' ';
2728 LDAP_LOG( CONFIG, DETAIL1, "line %d (%s)\n", lineno, logline , 0 );
2730 Debug( LDAP_DEBUG_CONFIG, "line %d (%s)\n", lineno, logline, 0 );
2733 if ( strtok_quote_ptr ) {
2734 *strtok_quote_ptr = '\0';
2737 for ( ; token != NULL; token = strtok_quote( NULL, " \t" ) ) {
2738 if ( cargc == cargv_size - 1 ) {
2740 tmp = ch_realloc( cargv, (cargv_size + ARGS_STEP) *
2742 if ( tmp == NULL ) {
2744 LDAP_LOG( CONFIG, ERR, "line %d: out of memory\n", lineno, 0,0 );
2746 Debug( LDAP_DEBUG_ANY,
2747 "line %d: out of memory\n",
2753 cargv_size += ARGS_STEP;
2755 cargv[cargc++] = token;
2757 cargv[cargc] = NULL;
2762 strtok_quote( char *line, char *sep )
2768 strtok_quote_ptr = NULL;
2769 if ( line != NULL ) {
2772 while ( *next && strchr( sep, *next ) ) {
2776 if ( *next == '\0' ) {
2782 for ( inquote = 0; *next; ) {
2790 AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
2796 next + 1, strlen( next + 1 ) + 1 );
2797 next++; /* dont parse the escaped character */
2802 if ( strchr( sep, *next ) != NULL ) {
2803 strtok_quote_ptr = next;
2816 static char buf[BUFSIZ];
2818 static size_t lmax, lcur;
2820 #define CATLINE( buf ) \
2822 size_t len = strlen( buf ); \
2823 while ( lcur + len + 1 > lmax ) { \
2825 line = (char *) ch_realloc( line, lmax ); \
2827 strcpy( line + lcur, buf ); \
2832 fp_getline( FILE *fp, int *lineno )
2840 /* hack attack - keeps us from having to keep a stack of bufs... */
2841 if ( strncasecmp( line, "include", 7 ) == 0 ) {
2846 while ( fgets( buf, sizeof(buf), fp ) != NULL ) {
2847 /* trim off \r\n or \n */
2848 if ( (p = strchr( buf, '\n' )) != NULL ) {
2849 if( p > buf && p[-1] == '\r' ) --p;
2853 /* trim off trailing \ and append the next line */
2854 if ( line[ 0 ] != '\0'
2855 && (p = line + strlen( line ) - 1)[ 0 ] == '\\'
2856 && p[ -1 ] != '\\' ) {
2861 if ( ! isspace( (unsigned char) buf[0] ) ) {
2865 /* change leading whitespace to a space */
2874 return( line[0] ? line : NULL );
2878 fp_getline_init( int *lineno )
2884 /* Loads ucdata, returns 1 if loading, 0 if already loaded, -1 on error */
2886 load_ucdata( char *path )
2888 static int loaded = 0;
2894 err = ucdata_load( path ? path : SLAPD_DEFAULT_UCDATA, UCDATA_ALL );
2897 LDAP_LOG( CONFIG, CRIT,
2898 "load_ucdata: Error %d loading ucdata.\n", err, 0,0 );
2900 Debug( LDAP_DEBUG_ANY, "error loading ucdata (error %d)\n",
2913 ucdata_unload( UCDATA_ALL );
2914 free( global_schemandn.bv_val );
2915 free( global_schemadn.bv_val );
2917 if ( slapd_args_file )
2918 free ( slapd_args_file );
2919 if ( slapd_pid_file )
2920 free ( slapd_pid_file );
2921 if ( default_passwd_hash )
2922 ldap_charray_free( default_passwd_hash );
2923 acl_destroy( global_acl, NULL );
2934 syncinfo_t *si_entry;
2936 int duplicated_replica_id = 0;
2938 si = (syncinfo_t *) ch_calloc( 1, sizeof( syncinfo_t ) );
2942 LDAP_LOG( CONFIG, ERR, "out of memory in add_syncrepl\n", 0, 0,0 );
2944 Debug( LDAP_DEBUG_ANY, "out of memory in add_syncrepl\n", 0, 0, 0 );
2949 si->si_tls = SYNCINFO_TLS_OFF;
2950 if ( be->be_rootndn.bv_val ) {
2951 ber_dupbv( &si->si_updatedn, &be->be_rootndn );
2953 si->si_bindmethod = LDAP_AUTH_SIMPLE;
2954 si->si_schemachecking = 0;
2955 ber_str2bv( "(objectclass=*)", STRLENOF("(objectclass=*)"), 1,
2956 &si->si_filterstr );
2957 si->si_base.bv_val = NULL;
2958 si->si_scope = LDAP_SCOPE_SUBTREE;
2959 si->si_attrsonly = 0;
2960 si->si_attrs = (char **) ch_calloc( 1, sizeof( char * ));
2961 si->si_attrs[0] = NULL;
2962 si->si_exattrs = (char **) ch_calloc( 1, sizeof( char * ));
2963 si->si_exattrs[0] = NULL;
2964 si->si_type = LDAP_SYNC_REFRESH_ONLY;
2965 si->si_interval = 86400;
2966 si->si_retryinterval = NULL;
2967 si->si_retrynum_init = NULL;
2968 si->si_retrynum = NULL;
2969 si->si_syncCookie.ctxcsn = NULL;
2970 si->si_syncCookie.octet_str = NULL;
2971 si->si_syncCookie.sid = -1;
2972 si->si_manageDSAit = 0;
2976 si->si_presentlist = NULL;
2977 LDAP_LIST_INIT( &si->si_nonpresentlist );
2979 rc = parse_syncrepl_line( cargv, cargc, si );
2981 LDAP_STAILQ_FOREACH( si_entry, &be->be_syncinfo, si_next ) {
2982 if ( si->si_rid == si_entry->si_rid ) {
2984 LDAP_LOG( CONFIG, ERR,
2985 "add_syncrepl: duplicated replica id\n", 0, 0,0 );
2987 Debug( LDAP_DEBUG_ANY,
2988 "add_syncrepl: duplicated replica id\n",0, 0, 0 );
2990 duplicated_replica_id = 1;
2995 if ( rc < 0 || duplicated_replica_id ) {
2996 Debug( LDAP_DEBUG_ANY, "failed to add syncinfo\n", 0, 0, 0 );
3000 LDAP_LOG ( CONFIG, RESULTS,
3001 "add_syncrepl: Config: ** successfully added syncrepl \"%s\"\n",
3002 si->si_provideruri == NULL ? "(null)" : si->si_provideruri, 0, 0 );
3004 Debug( LDAP_DEBUG_CONFIG,
3005 "Config: ** successfully added syncrepl \"%s\"\n",
3006 si->si_provideruri == NULL ? "(null)" : si->si_provideruri, 0, 0 );
3008 if ( !si->si_schemachecking ) {
3009 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
3012 LDAP_STAILQ_INSERT_TAIL( &be->be_syncinfo, si, si_next );
3018 #define PROVIDERSTR "provider"
3019 #define SUFFIXSTR "suffix"
3020 #define UPDATEDNSTR "updatedn"
3021 #define BINDMETHSTR "bindmethod"
3022 #define SIMPLESTR "simple"
3023 #define SASLSTR "sasl"
3024 #define BINDDNSTR "binddn"
3025 #define CREDSTR "credentials"
3026 #define OLDAUTHCSTR "bindprincipal"
3027 #define AUTHCSTR "authcID"
3028 #define AUTHZSTR "authzID"
3029 #define SRVTABSTR "srvtab"
3030 #define SASLMECHSTR "saslmech"
3031 #define REALMSTR "realm"
3032 #define SECPROPSSTR "secprops"
3033 #define STARTTLSSTR "starttls"
3034 #define CRITICALSTR "critical"
3036 #define SCHEMASTR "schemachecking"
3037 #define FILTERSTR "filter"
3038 #define SEARCHBASESTR "searchbase"
3039 #define SCOPESTR "scope"
3040 #define ATTRSSTR "attrs"
3041 #define ATTRSONLYSTR "attrsonly"
3042 #define EXATTRSSTR "exattrs"
3043 #define TYPESTR "type"
3044 #define INTERVALSTR "interval"
3045 #define LASTMODSTR "lastmod"
3046 #define LMREQSTR "req"
3047 #define LMGENSTR "gen"
3048 #define LMNOSTR "no"
3049 #define MANAGEDSAITSTR "manageDSAit"
3050 #define SLIMITSTR "sizelimit"
3051 #define TLIMITSTR "timelimit"
3053 #define RETRYSTR "retry"
3055 #define GOT_ID 0x0001
3056 #define GOT_PROVIDER 0x0002
3057 #define GOT_METHOD 0x0004
3058 #define GOT_ALL 0x0007
3061 parse_syncrepl_line(
3072 for ( i = 1; i < cargc; i++ ) {
3073 if ( !strncasecmp( cargv[ i ], IDSTR, sizeof( IDSTR ) - 1 )) {
3075 /* '\0' string terminator accounts for '=' */
3076 val = cargv[ i ] + sizeof( IDSTR );
3078 if ( tmp >= 1000 || tmp < 0 ) {
3079 fprintf( stderr, "Error: parse_syncrepl_line: "
3080 "syncrepl id %d is out of range [0..999]\n", tmp );
3085 } else if ( !strncasecmp( cargv[ i ], PROVIDERSTR,
3086 sizeof( PROVIDERSTR ) - 1 )) {
3087 val = cargv[ i ] + sizeof( PROVIDERSTR );
3088 si->si_provideruri = ch_strdup( val );
3089 si->si_provideruri_bv = (BerVarray)
3090 ch_calloc( 2, sizeof( struct berval ));
3091 ber_str2bv( si->si_provideruri, strlen( si->si_provideruri ),
3092 1, &si->si_provideruri_bv[0] );
3093 si->si_provideruri_bv[1].bv_len = 0;
3094 si->si_provideruri_bv[1].bv_val = NULL;
3095 gots |= GOT_PROVIDER;
3096 } else if ( !strncasecmp( cargv[ i ], STARTTLSSTR,
3097 sizeof(STARTTLSSTR) - 1 ) )
3099 val = cargv[ i ] + sizeof( STARTTLSSTR );
3100 if( !strcasecmp( val, CRITICALSTR ) ) {
3101 si->si_tls = SYNCINFO_TLS_CRITICAL;
3103 si->si_tls = SYNCINFO_TLS_ON;
3105 } else if ( !strncasecmp( cargv[ i ],
3106 UPDATEDNSTR, sizeof( UPDATEDNSTR ) - 1 ) )
3108 struct berval updatedn = {0, NULL};
3109 val = cargv[ i ] + sizeof( UPDATEDNSTR );
3110 ber_str2bv( val, 0, 0, &updatedn );
3111 ch_free( si->si_updatedn.bv_val );
3112 dnNormalize( 0, NULL, NULL, &updatedn, &si->si_updatedn, NULL );
3113 } else if ( !strncasecmp( cargv[ i ], BINDMETHSTR,
3114 sizeof( BINDMETHSTR ) - 1 ) )
3116 val = cargv[ i ] + sizeof( BINDMETHSTR );
3117 if ( !strcasecmp( val, SIMPLESTR )) {
3118 si->si_bindmethod = LDAP_AUTH_SIMPLE;
3120 } else if ( !strcasecmp( val, SASLSTR )) {
3121 #ifdef HAVE_CYRUS_SASL
3122 si->si_bindmethod = LDAP_AUTH_SASL;
3124 #else /* HAVE_CYRUS_SASL */
3125 fprintf( stderr, "Error: parse_syncrepl_line: "
3126 "not compiled with SASL support\n" );
3128 #endif /* HAVE_CYRUS_SASL */
3130 si->si_bindmethod = -1;
3132 } else if ( !strncasecmp( cargv[ i ],
3133 BINDDNSTR, sizeof( BINDDNSTR ) - 1 ) ) {
3134 val = cargv[ i ] + sizeof( BINDDNSTR );
3135 si->si_binddn = ch_strdup( val );
3136 } else if ( !strncasecmp( cargv[ i ],
3137 CREDSTR, sizeof( CREDSTR ) - 1 ) ) {
3138 val = cargv[ i ] + sizeof( CREDSTR );
3139 si->si_passwd = ch_strdup( val );
3140 } else if ( !strncasecmp( cargv[ i ],
3141 SASLMECHSTR, sizeof( SASLMECHSTR ) - 1 ) ) {
3142 val = cargv[ i ] + sizeof( SASLMECHSTR );
3143 si->si_saslmech = ch_strdup( val );
3144 } else if ( !strncasecmp( cargv[ i ],
3145 SECPROPSSTR, sizeof( SECPROPSSTR ) - 1 ) ) {
3146 val = cargv[ i ] + sizeof( SECPROPSSTR );
3147 si->si_secprops = ch_strdup( val );
3148 } else if ( !strncasecmp( cargv[ i ],
3149 REALMSTR, sizeof( REALMSTR ) - 1 ) ) {
3150 val = cargv[ i ] + sizeof( REALMSTR );
3151 si->si_realm = ch_strdup( val );
3152 } else if ( !strncasecmp( cargv[ i ],
3153 AUTHCSTR, sizeof( AUTHCSTR ) - 1 ) ) {
3154 val = cargv[ i ] + sizeof( AUTHCSTR );
3155 if ( si->si_authcId )
3156 ch_free( si->si_authcId );
3157 si->si_authcId = ch_strdup( val );
3158 } else if ( !strncasecmp( cargv[ i ],
3159 OLDAUTHCSTR, sizeof( OLDAUTHCSTR ) - 1 ) ) {
3160 /* Old authcID is provided for some backwards compatibility */
3161 val = cargv[ i ] + sizeof( OLDAUTHCSTR );
3162 if ( si->si_authcId )
3163 ch_free( si->si_authcId );
3164 si->si_authcId = ch_strdup( val );
3165 } else if ( !strncasecmp( cargv[ i ],
3166 AUTHZSTR, sizeof( AUTHZSTR ) - 1 ) ) {
3167 val = cargv[ i ] + sizeof( AUTHZSTR );
3168 si->si_authzId = ch_strdup( val );
3169 } else if ( !strncasecmp( cargv[ i ],
3170 SCHEMASTR, sizeof( SCHEMASTR ) - 1 ) )
3172 val = cargv[ i ] + sizeof( SCHEMASTR );
3173 if ( !strncasecmp( val, "on", sizeof( "on" ) - 1 )) {
3174 si->si_schemachecking = 1;
3175 } else if ( !strncasecmp( val, "off", sizeof( "off" ) - 1 ) ) {
3176 si->si_schemachecking = 0;
3178 si->si_schemachecking = 1;
3180 } else if ( !strncasecmp( cargv[ i ],
3181 FILTERSTR, sizeof( FILTERSTR ) - 1 ) )
3183 val = cargv[ i ] + sizeof( FILTERSTR );
3184 ber_str2bv( val, 0, 1, &si->si_filterstr );
3185 } else if ( !strncasecmp( cargv[ i ],
3186 SEARCHBASESTR, sizeof( SEARCHBASESTR ) - 1 ) )
3189 val = cargv[ i ] + sizeof( SEARCHBASESTR );
3190 if ( si->si_base.bv_val ) {
3191 ch_free( si->si_base.bv_val );
3193 ber_str2bv( val, 0, 0, &bv );
3194 if ( dnNormalize( 0, NULL, NULL, &bv, &si->si_base, NULL )) {
3195 fprintf( stderr, "Invalid base DN \"%s\"\n", val );
3198 } else if ( !strncasecmp( cargv[ i ],
3199 SCOPESTR, sizeof( SCOPESTR ) - 1 ) )
3201 val = cargv[ i ] + sizeof( SCOPESTR );
3202 if ( !strncasecmp( val, "base", sizeof( "base" ) - 1 )) {
3203 si->si_scope = LDAP_SCOPE_BASE;
3204 } else if ( !strncasecmp( val, "one", sizeof( "one" ) - 1 )) {
3205 si->si_scope = LDAP_SCOPE_ONELEVEL;
3206 #ifdef LDAP_SCOPE_SUBORDINATE
3207 } else if ( !strcasecmp( val, "subordinate" ) ||
3208 !strcasecmp( val, "children" ))
3210 si->si_scope = LDAP_SCOPE_SUBORDINATE;
3212 } else if ( !strncasecmp( val, "sub", sizeof( "sub" ) - 1 )) {
3213 si->si_scope = LDAP_SCOPE_SUBTREE;
3215 fprintf( stderr, "Error: parse_syncrepl_line: "
3216 "unknown scope \"%s\"\n", val);
3219 } else if ( !strncasecmp( cargv[ i ],
3220 ATTRSONLYSTR, sizeof( ATTRSONLYSTR ) - 1 ) )
3222 si->si_attrsonly = 1;
3223 } else if ( !strncasecmp( cargv[ i ],
3224 ATTRSSTR, sizeof( ATTRSSTR ) - 1 ) )
3226 val = cargv[ i ] + sizeof( ATTRSSTR );
3227 str2clist( &si->si_attrs, val, "," );
3228 } else if ( !strncasecmp( cargv[ i ],
3229 EXATTRSSTR, sizeof( EXATTRSSTR ) - 1 ) )
3231 val = cargv[ i ] + sizeof( EXATTRSSTR );
3232 str2clist( &si->si_exattrs, val, "," );
3233 } else if ( !strncasecmp( cargv[ i ],
3234 TYPESTR, sizeof( TYPESTR ) - 1 ) )
3236 val = cargv[ i ] + sizeof( TYPESTR );
3237 if ( !strncasecmp( val, "refreshOnly", sizeof("refreshOnly")-1 )) {
3238 si->si_type = LDAP_SYNC_REFRESH_ONLY;
3239 } else if ( !strncasecmp( val, "refreshAndPersist",
3240 sizeof("refreshAndPersist")-1 ))
3242 si->si_type = LDAP_SYNC_REFRESH_AND_PERSIST;
3243 si->si_interval = 60;
3245 fprintf( stderr, "Error: parse_syncrepl_line: "
3246 "unknown sync type \"%s\"\n", val);
3249 } else if ( !strncasecmp( cargv[ i ],
3250 INTERVALSTR, sizeof( INTERVALSTR ) - 1 ) )
3252 val = cargv[ i ] + sizeof( INTERVALSTR );
3253 if ( si->si_type == LDAP_SYNC_REFRESH_AND_PERSIST ) {
3254 si->si_interval = 0;
3262 hstr = strchr( dstr, ':' );
3263 if ( hstr == NULL ) {
3264 fprintf( stderr, "Error: parse_syncrepl_line: "
3265 "invalid interval \"%s\"\n", val );
3269 mstr = strchr( hstr, ':' );
3270 if ( mstr == NULL ) {
3271 fprintf( stderr, "Error: parse_syncrepl_line: "
3272 "invalid interval \"%s\"\n", val );
3276 sstr = strchr( mstr, ':' );
3277 if ( sstr == NULL ) {
3278 fprintf( stderr, "Error: parse_syncrepl_line: "
3279 "invalid interval \"%s\"\n", val );
3288 if (( hh > 24 ) || ( hh < 0 ) ||
3289 ( mm > 60 ) || ( mm < 0 ) ||
3290 ( ss > 60 ) || ( ss < 0 ) || ( dd < 0 )) {
3291 fprintf( stderr, "Error: parse_syncrepl_line: "
3292 "invalid interval \"%s\"\n", val );
3295 si->si_interval = (( dd * 24 + hh ) * 60 + mm ) * 60 + ss;
3297 if ( si->si_interval < 0 ) {
3298 fprintf( stderr, "Error: parse_syncrepl_line: "
3299 "invalid interval \"%ld\"\n",
3300 (long) si->si_interval);
3303 } else if ( !strncasecmp( cargv[ i ],
3304 RETRYSTR, sizeof( RETRYSTR ) - 1 ) )
3310 val = cargv[ i ] + sizeof( RETRYSTR );
3311 retry_list = (char **) ch_calloc( 1, sizeof( char * ));
3312 retry_list[0] = NULL;
3314 str2clist( &retry_list, val, " ,\t" );
3316 for ( k = 0; retry_list && retry_list[k]; k++ ) ;
3320 "Error: incomplete syncrepl retry list\n" );
3321 for ( k = 0; retry_list && retry_list[k]; k++ ) {
3322 ch_free( retry_list[k] );
3324 ch_free( retry_list );
3325 exit( EXIT_FAILURE );
3327 si->si_retryinterval = (time_t *) ch_calloc( n + 1, sizeof( time_t ));
3328 si->si_retrynum = (int *) ch_calloc( n + 1, sizeof( int ));
3329 si->si_retrynum_init = (int *) ch_calloc( n + 1, sizeof( int ));
3330 for ( j = 0; j < n; j++ ) {
3331 si->si_retryinterval[j] = atoi( retry_list[j*2] );
3332 if ( *retry_list[j*2+1] == '+' ) {
3333 si->si_retrynum_init[j] = -1;
3334 si->si_retrynum[j] = -1;
3338 si->si_retrynum_init[j] = atoi( retry_list[j*2+1] );
3339 si->si_retrynum[j] = atoi( retry_list[j*2+1] );
3342 si->si_retrynum_init[j] = -2;
3343 si->si_retrynum[j] = -2;
3344 si->si_retryinterval[j] = 0;
3346 for ( k = 0; retry_list && retry_list[k]; k++ ) {
3347 ch_free( retry_list[k] );
3349 ch_free( retry_list );
3350 } else if ( !strncasecmp( cargv[ i ],
3351 MANAGEDSAITSTR, sizeof( MANAGEDSAITSTR ) - 1 ) )
3353 val = cargv[ i ] + sizeof( MANAGEDSAITSTR );
3354 si->si_manageDSAit = atoi( val );
3355 } else if ( !strncasecmp( cargv[ i ],
3356 SLIMITSTR, sizeof( SLIMITSTR ) - 1 ) )
3358 val = cargv[ i ] + sizeof( SLIMITSTR );
3359 si->si_slimit = atoi( val );
3360 } else if ( !strncasecmp( cargv[ i ],
3361 TLIMITSTR, sizeof( TLIMITSTR ) - 1 ) )
3363 val = cargv[ i ] + sizeof( TLIMITSTR );
3364 si->si_tlimit = atoi( val );
3366 fprintf( stderr, "Error: parse_syncrepl_line: "
3367 "unknown keyword \"%s\"\n", cargv[ i ] );
3372 if ( gots != GOT_ALL ) {
3374 "Error: Malformed \"syncrepl\" line in slapd config file" );
3382 str2clist( char ***out, char *in, const char *brkstr )
3391 /* find last element in list */
3392 for (i = 0; *out && *out[i]; i++);
3394 /* protect the input string from strtok */
3395 str = ch_strdup( in );
3397 if ( *str == '\0' ) {
3402 /* Count words in string */
3404 for ( s = str; *s; s++ ) {
3405 if ( strchr( brkstr, *s ) != NULL ) {
3410 *out = ch_realloc( *out, ( i + j + 1 ) * sizeof( char * ) );
3412 for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
3414 s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
3416 *new = ch_strdup( s );