1 /* config.c - configuration file handling routines */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2004 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;
124 vals[1].bv_val = NULL;
127 cargv = ch_calloc( ARGS_STEP + 1, sizeof(*cargv) );
128 cargv_size = ARGS_STEP + 1;
131 if ( (fp = fopen( fname, "r" )) == NULL ) {
134 LDAP_LOG( CONFIG, ENTRY,
135 "read_config: " "could not open config file \"%s\": %s (%d)\n",
136 fname, strerror(errno), errno );
138 Debug( LDAP_DEBUG_ANY,
139 "could not open config file \"%s\": %s (%d)\n",
140 fname, strerror(errno), errno );
146 LDAP_LOG( CONFIG, ENTRY,
147 "read_config: reading config file %s\n", fname, 0, 0 );
149 Debug( LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0 );
153 fp_getline_init( &lineno );
155 while ( (line = fp_getline( fp, &lineno )) != NULL ) {
156 /* skip comments and blank lines */
157 if ( line[0] == '#' || line[0] == '\0' ) {
161 /* fp_parse_line is destructive, we save a copy */
162 saveline = ch_strdup( line );
164 if ( fp_parse_line( lineno, line ) != 0 ) {
170 LDAP_LOG( CONFIG, INFO,
171 "%s: line %d: bad config line (ignored)\n", fname, lineno, 0 );
173 Debug( LDAP_DEBUG_ANY,
174 "%s: line %d: bad config line (ignored)\n",
181 if ( strcasecmp( cargv[0], "backend" ) == 0 ) {
184 LDAP_LOG( CONFIG, CRIT,
185 "%s : line %d: missing type in \"backend\" line.\n",
188 Debug( LDAP_DEBUG_ANY,
189 "%s: line %d: missing type in \"backend <type>\" line\n",
198 LDAP_LOG( CONFIG, CRIT,
199 "%s: line %d: backend line must appear before any "
200 "database definition.\n", fname, lineno , 0 );
202 Debug( LDAP_DEBUG_ANY,
203 "%s: line %d: backend line must appear before any database definition\n",
210 bi = backend_info( cargv[1] );
214 LDAP_LOG( CONFIG, CRIT,
215 "read_config: backend %s initialization failed.\n",
218 Debug( LDAP_DEBUG_ANY,
219 "backend %s initialization failed.\n",
225 } else if ( strcasecmp( cargv[0], "database" ) == 0 ) {
228 LDAP_LOG( CONFIG, CRIT,
229 "%s: line %d: missing type in \"database <type>\" line\n",
232 Debug( LDAP_DEBUG_ANY,
233 "%s: line %d: missing type in \"database <type>\" line\n",
241 be = backend_db_init( cargv[1] );
245 LDAP_LOG( CONFIG, CRIT,
246 "database %s initialization failed.\n", cargv[1], 0, 0 );
248 Debug( LDAP_DEBUG_ANY,
249 "database %s initialization failed.\n",
256 /* set thread concurrency */
257 } else if ( strcasecmp( cargv[0], "concurrency" ) == 0 ) {
261 LDAP_LOG( CONFIG, CRIT,
262 "%s: line %d: missing level in \"concurrency <level\" "
263 " line\n", fname, lineno, 0 );
265 Debug( LDAP_DEBUG_ANY,
266 "%s: line %d: missing level in \"concurrency <level>\" line\n",
273 c = atoi( cargv[1] );
277 LDAP_LOG( CONFIG, CRIT,
278 "%s: line %d: invalid level (%d) in "
279 "\"concurrency <level>\" line.\n", fname, lineno, c );
281 Debug( LDAP_DEBUG_ANY,
282 "%s: line %d: invalid level (%d) in \"concurrency <level>\" line\n",
289 ldap_pvt_thread_set_concurrency( c );
291 /* set sockbuf max */
292 } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming" ) == 0 ) {
296 LDAP_LOG( CONFIG, CRIT,
297 "%s: line %d: missing max in \"sockbuf_max_incoming "
298 "<bytes>\" line\n", fname, lineno, 0 );
300 Debug( LDAP_DEBUG_ANY,
301 "%s: line %d: missing max in \"sockbuf_max_incoming <bytes>\" line\n",
308 max = atol( cargv[1] );
312 LDAP_LOG( CONFIG, CRIT,
313 "%s: line %d: invalid max value (%ld) in "
314 "\"sockbuf_max_incoming <bytes>\" line.\n",
315 fname, lineno, max );
317 Debug( LDAP_DEBUG_ANY,
318 "%s: line %d: invalid max value (%ld) in "
319 "\"sockbuf_max_incoming <bytes>\" line.\n",
320 fname, lineno, max );
326 sockbuf_max_incoming = max;
328 /* set sockbuf max authenticated */
329 } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming_auth" ) == 0 ) {
333 LDAP_LOG( CONFIG, CRIT,
334 "%s: line %d: missing max in \"sockbuf_max_incoming_auth "
335 "<bytes>\" line\n", fname, lineno, 0 );
337 Debug( LDAP_DEBUG_ANY,
338 "%s: line %d: missing max in \"sockbuf_max_incoming_auth <bytes>\" line\n",
345 max = atol( cargv[1] );
349 LDAP_LOG( CONFIG, CRIT,
350 "%s: line %d: invalid max value (%ld) in "
351 "\"sockbuf_max_incoming_auth <bytes>\" line.\n",
352 fname, lineno, max );
354 Debug( LDAP_DEBUG_ANY,
355 "%s: line %d: invalid max value (%ld) in "
356 "\"sockbuf_max_incoming_auth <bytes>\" line.\n",
357 fname, lineno, max );
363 sockbuf_max_incoming_auth = max;
365 /* set conn pending max */
366 } else if ( strcasecmp( cargv[0], "conn_max_pending" ) == 0 ) {
370 LDAP_LOG( CONFIG, CRIT,
371 "%s: line %d: missing max in \"conn_max_pending "
372 "<requests>\" line\n", fname, lineno, 0 );
374 Debug( LDAP_DEBUG_ANY,
375 "%s: line %d: missing max in \"conn_max_pending <requests>\" line\n",
382 max = atol( cargv[1] );
386 LDAP_LOG( CONFIG, CRIT,
387 "%s: line %d: invalid max value (%ld) in "
388 "\"conn_max_pending <requests>\" line.\n",
389 fname, lineno, max );
391 Debug( LDAP_DEBUG_ANY,
392 "%s: line %d: invalid max value (%ld) in "
393 "\"conn_max_pending <requests>\" line.\n",
394 fname, lineno, max );
400 slap_conn_max_pending = max;
402 /* set conn pending max authenticated */
403 } else if ( strcasecmp( cargv[0], "conn_max_pending_auth" ) == 0 ) {
407 LDAP_LOG( CONFIG, CRIT,
408 "%s: line %d: missing max in \"conn_max_pending_auth "
409 "<requests>\" line\n", fname, lineno, 0 );
411 Debug( LDAP_DEBUG_ANY,
412 "%s: line %d: missing max in \"conn_max_pending_auth <requests>\" line\n",
419 max = atol( cargv[1] );
423 LDAP_LOG( CONFIG, CRIT,
424 "%s: line %d: invalid max value (%ld) in "
425 "\"conn_max_pending_auth <requests>\" line.\n",
426 fname, lineno, max );
428 Debug( LDAP_DEBUG_ANY,
429 "%s: line %d: invalid max value (%ld) in "
430 "\"conn_max_pending_auth <requests>\" line.\n",
431 fname, lineno, max );
437 slap_conn_max_pending_auth = max;
439 /* default search base */
440 } else if ( strcasecmp( cargv[0], "defaultSearchBase" ) == 0 ) {
443 LDAP_LOG( CONFIG, CRIT,
444 "%s: line %d: missing dn in \"defaultSearchBase <dn\" "
445 "line\n", fname, lineno, 0 );
447 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
448 "missing dn in \"defaultSearchBase <dn>\" line\n",
454 } else if ( cargc > 2 ) {
456 LDAP_LOG( CONFIG, INFO,
457 "%s: line %d: extra cruft after <dn> in "
458 "\"defaultSearchBase %s\" line (ignored)\n",
459 fname, lineno, cargv[1] );
461 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
462 "extra cruft after <dn> in \"defaultSearchBase %s\", "
464 fname, lineno, cargv[1] );
468 if ( bi != NULL || be != NULL ) {
470 LDAP_LOG( CONFIG, CRIT,
471 "%s: line %d: defaultSearchBase line must appear "
472 "prior to any backend or database definitions\n",
475 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
476 "defaultSearchBaase line must appear prior to "
477 "any backend or database definition\n",
484 if ( default_search_nbase.bv_len ) {
486 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
487 "default search base \"%s\" already defined "
488 "(discarding old)\n", fname, lineno,
489 default_search_base.bv_val );
491 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
492 "default search base \"%s\" already defined "
493 "(discarding old)\n",
494 fname, lineno, default_search_base.bv_val );
497 free( default_search_base.bv_val );
498 free( default_search_nbase.bv_val );
501 if ( load_ucdata( NULL ) < 0 ) return 1;
506 dn.bv_val = cargv[1];
507 dn.bv_len = strlen( dn.bv_val );
509 rc = dnPrettyNormal( NULL, &dn,
510 &default_search_base,
511 &default_search_nbase, NULL );
513 if( rc != LDAP_SUCCESS ) {
515 LDAP_LOG( CONFIG, CRIT,
516 "%s: line %d: defaultSearchBase DN is invalid.\n",
519 Debug( LDAP_DEBUG_ANY,
520 "%s: line %d: defaultSearchBase DN is invalid\n",
527 /* set maximum threads in thread pool */
528 } else if ( strcasecmp( cargv[0], "threads" ) == 0 ) {
532 LDAP_LOG( CONFIG, CRIT,
533 "%s: line %d: missing count in \"threads <count>\" line\n",
536 Debug( LDAP_DEBUG_ANY,
537 "%s: line %d: missing count in \"threads <count>\" line\n",
544 c = atoi( cargv[1] );
548 LDAP_LOG( CONFIG, CRIT,
549 "%s: line %d: invalid level (%d) in \"threads <count>\""
550 "line\n", fname, lineno, c );
552 Debug( LDAP_DEBUG_ANY,
553 "%s: line %d: invalid level (%d) in \"threads <count>\" line\n",
560 ldap_pvt_thread_pool_maxthreads( &connection_pool, c );
562 /* save for later use */
563 connection_pool_max = c;
565 /* get pid file name */
566 } else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
569 LDAP_LOG( CONFIG, CRIT,
570 "%s: line %d missing file name in \"pidfile <file>\" "
571 "line.\n", fname, lineno, 0 );
573 Debug( LDAP_DEBUG_ANY,
574 "%s: line %d: missing file name in \"pidfile <file>\" line\n",
581 slapd_pid_file = ch_strdup( cargv[1] );
583 /* get args file name */
584 } else if ( strcasecmp( cargv[0], "argsfile" ) == 0 ) {
587 LDAP_LOG( CONFIG, CRIT,
588 "%s: %d: missing file name in "
589 "\"argsfile <file>\" line.\n",
592 Debug( LDAP_DEBUG_ANY,
593 "%s: line %d: missing file name in \"argsfile <file>\" line\n",
600 slapd_args_file = ch_strdup( cargv[1] );
602 } else if ( strcasecmp( cargv[0], "replica-pidfile" ) == 0 ) {
605 } else if ( strcasecmp( cargv[0], "replica-argsfile" ) == 0 ) {
608 /* default password hash */
609 } else if ( strcasecmp( cargv[0], "password-hash" ) == 0 ) {
612 LDAP_LOG( CONFIG, CRIT,
613 "%s: line %d: missing hash in "
614 "\"password-hash <hash>\" line.\n",
617 Debug( LDAP_DEBUG_ANY,
618 "%s: line %d: missing hash in \"password-hash <hash>\" line\n",
624 if ( default_passwd_hash != NULL ) {
626 LDAP_LOG( CONFIG, CRIT,
627 "%s: line %d: already set default password_hash!\n",
630 Debug( LDAP_DEBUG_ANY,
631 "%s: line %d: already set default password_hash!\n",
638 for(i = 1; i < cargc; i++) {
639 if ( lutil_passwd_scheme( cargv[i] ) == 0 ) {
641 LDAP_LOG( CONFIG, CRIT,
642 "%s: line %d: password scheme \"%s\" not available\n",
643 fname, lineno, cargv[i] );
645 Debug( LDAP_DEBUG_ANY,
646 "%s: line %d: password scheme \"%s\" not available\n",
647 fname, lineno, cargv[i] );
650 ldap_charray_add( &default_passwd_hash, cargv[i] );
653 if( !default_passwd_hash ) {
655 LDAP_LOG( CONFIG, CRIT,
656 "%s: line %d: no valid hashes found\n",
659 Debug( LDAP_DEBUG_ANY,
660 "%s: line %d: no valid hashes found\n",
666 } else if ( strcasecmp( cargv[0], "password-crypt-salt-format" ) == 0 )
670 LDAP_LOG( CONFIG, CRIT,
671 "%s: line %d: missing format in "
672 "\"password-crypt-salt-format <format>\" line\n",
675 Debug( LDAP_DEBUG_ANY, "%s: line %d: missing format in "
676 "\"password-crypt-salt-format <format>\" line\n",
683 lutil_salt_format( cargv[1] );
685 #ifdef SLAP_AUTH_REWRITE
686 /* use authid rewrite instead of sasl regexp */
687 } else if ( strncasecmp( cargv[0], "auth-rewrite",
688 STRLENOF("auth-rewrite") ) == 0 )
690 int rc = slap_sasl_rewrite_config( fname, lineno,
695 #endif /* SLAP_AUTH_REWRITE */
697 /* Auth + SASL config options */
698 } else if ( !strncasecmp( cargv[0], "auth", STRLENOF("auth") ) ||
699 !strncasecmp( cargv[0], "sasl", STRLENOF("sasl") ))
701 if ( slap_sasl_config( cargc, cargv, line, fname, lineno ) )
705 } else if ( strcasecmp( cargv[0], "schemadn" ) == 0 ) {
709 LDAP_LOG( CONFIG, CRIT,
710 "%s: line %d: missing dn in "
711 "\"schemadn <dn>\" line.\n", fname, lineno, 0 );
713 Debug( LDAP_DEBUG_ANY,
714 "%s: line %d: missing dn in \"schemadn <dn>\" line\n",
719 ber_str2bv( cargv[1], 0, 0, &dn );
721 rc = dnPrettyNormal( NULL, &dn, &be->be_schemadn,
722 &be->be_schemandn, NULL );
724 rc = dnPrettyNormal( NULL, &dn, &global_schemadn,
725 &global_schemandn, NULL );
727 if ( rc != LDAP_SUCCESS ) {
729 LDAP_LOG( CONFIG, CRIT,
730 "%s: line %d: schemadn DN is invalid.\n",
733 Debug( LDAP_DEBUG_ANY,
734 "%s: line %d: schemadn DN is invalid\n",
740 /* set UCDATA path */
741 } else if ( strcasecmp( cargv[0], "ucdata-path" ) == 0 ) {
745 LDAP_LOG( CONFIG, CRIT,
746 "%s: line %d: missing path in "
747 "\"ucdata-path <path>\" line.\n", fname, lineno, 0 );
749 Debug( LDAP_DEBUG_ANY,
750 "%s: line %d: missing path in \"ucdata-path <path>\" line\n",
757 err = load_ucdata( cargv[1] );
761 LDAP_LOG( CONFIG, CRIT,
762 "%s: line %d: ucdata already loaded, ucdata-path "
763 "must be set earlier in the file and/or be "
764 "specified only once!\n", fname, lineno, 0 );
766 Debug( LDAP_DEBUG_ANY,
767 "%s: line %d: ucdata already loaded, ucdata-path must be set earlier in the file and/or be specified only once!\n",
776 } else if ( strcasecmp( cargv[0], "sizelimit" ) == 0 ) {
778 struct slap_limits_set *lim;
782 LDAP_LOG( CONFIG, CRIT,
783 "%s: line %d: missing limit in \"sizelimit <limit>\" "
784 "line.\n", fname, lineno, 0 );
786 Debug( LDAP_DEBUG_ANY,
787 "%s: line %d: missing limit in \"sizelimit <limit>\" line\n",
797 lim = &be->be_def_limit;
800 for ( i = 1; i < cargc; i++ ) {
801 if ( strncasecmp( cargv[i], "size", 4 ) == 0 ) {
802 rc = limits_parse_one( cargv[i], lim );
805 LDAP_LOG( CONFIG, CRIT,
806 "%s: line %d: unable "
807 "to parse value \"%s\" in \"sizelimit "
808 "<limit>\" line.\n", fname, lineno, cargv[i] );
810 Debug( LDAP_DEBUG_ANY,
811 "%s: line %d: unable "
812 "to parse value \"%s\" "
815 fname, lineno, cargv[i] );
821 if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) {
822 lim->lms_s_soft = -1;
826 lim->lms_s_soft = strtol( cargv[i] , &next, 0 );
827 if ( next == cargv[i] ) {
829 LDAP_LOG( CONFIG, CRIT,
830 "%s: line %d: unable to parse limit \"%s\" in \"sizelimit <limit>\" "
831 "line.\n", fname, lineno, cargv[i] );
833 Debug( LDAP_DEBUG_ANY,
834 "%s: line %d: unable to parse limit \"%s\" in \"sizelimit <limit>\" line\n",
835 fname, lineno, cargv[i] );
839 } else if ( next[0] != '\0' ) {
841 LDAP_LOG( CONFIG, CRIT,
842 "%s: line %d: trailing chars \"%s\" in \"sizelimit <limit>\" "
843 "line ignored.\n", fname, lineno, next );
845 Debug( LDAP_DEBUG_ANY,
846 "%s: line %d: trailing chars \"%s\" in \"sizelimit <limit>\" line ignored\n",
847 fname, lineno, next );
856 } else if ( strcasecmp( cargv[0], "timelimit" ) == 0 ) {
858 struct slap_limits_set *lim;
862 LDAP_LOG( CONFIG, CRIT,
863 "%s: line %d missing limit in \"timelimit <limit>\" "
864 "line.\n", fname, lineno, 0 );
866 Debug( LDAP_DEBUG_ANY,
867 "%s: line %d: missing limit in \"timelimit <limit>\" line\n",
877 lim = &be->be_def_limit;
880 for ( i = 1; i < cargc; i++ ) {
881 if ( strncasecmp( cargv[i], "time", 4 ) == 0 ) {
882 rc = limits_parse_one( cargv[i], lim );
885 LDAP_LOG( CONFIG, CRIT,
886 "%s: line %d: unable to parse value \"%s\" "
887 "in \"timelimit <limit>\" line.\n",
888 fname, lineno, cargv[i] );
890 Debug( LDAP_DEBUG_ANY,
891 "%s: line %d: unable "
892 "to parse value \"%s\" "
895 fname, lineno, cargv[i] );
901 if ( strcasecmp( cargv[i], "unlimited" ) == 0 ) {
902 lim->lms_t_soft = -1;
906 lim->lms_t_soft = strtol( cargv[i] , &next, 0 );
907 if ( next == cargv[i] ) {
909 LDAP_LOG( CONFIG, CRIT,
910 "%s: line %d: unable to parse limit \"%s\" in \"timelimit <limit>\" "
911 "line.\n", fname, lineno, cargv[i] );
913 Debug( LDAP_DEBUG_ANY,
914 "%s: line %d: unable to parse limit \"%s\" in \"timelimit <limit>\" line\n",
915 fname, lineno, cargv[i] );
919 } else if ( next[0] != '\0' ) {
921 LDAP_LOG( CONFIG, CRIT,
922 "%s: line %d: trailing chars \"%s\" in \"timelimit <limit>\" "
923 "line ignored.\n", fname, lineno, next );
925 Debug( LDAP_DEBUG_ANY,
926 "%s: line %d: trailing chars \"%s\" in \"timelimit <limit>\" line ignored\n",
927 fname, lineno, next );
935 /* set regex-based limits */
936 } else if ( strcasecmp( cargv[0], "limits" ) == 0 ) {
939 LDAP_LOG( CONFIG, WARNING,
940 "%s: line %d \"limits\" allowed only in database "
941 "environment.\n", fname, lineno, 0 );
943 Debug( LDAP_DEBUG_ANY,
944 "%s: line %d \"limits\" allowed only in database environment.\n%s",
950 if ( limits_parse( be, fname, lineno, cargc, cargv ) ) {
954 /* mark this as a subordinate database */
955 } else if ( strcasecmp( cargv[0], "subordinate" ) == 0 ) {
958 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
959 "subordinate keyword must appear inside a database "
960 "definition.\n", fname, lineno, 0 );
962 Debug( LDAP_DEBUG_ANY, "%s: line %d: subordinate keyword "
963 "must appear inside a database definition.\n",
969 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_GLUE_SUBORDINATE;
973 /* add an overlay to this backend */
974 } else if ( strcasecmp( cargv[0], "overlay" ) == 0 ) {
977 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
978 "overlay keyword must appear inside a database "
979 "definition.\n", fname, lineno, 0 );
981 Debug( LDAP_DEBUG_ANY, "%s: line %d: overlay keyword "
982 "must appear inside a database definition.\n",
988 if ( cargv[1][0] == '-' && overlay_config( be, &cargv[1][1] ) ) {
991 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
992 "(optional) overlay \"%s\" configuration "
993 "failed (ignored)\n", fname, lineno, &cargv[1][1] );
995 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
996 "(optional) overlay \"%s\" configuration "
997 "failed (ignored)\n", fname, lineno, &cargv[1][1] );
999 } else if ( overlay_config( be, cargv[1] ) ) {
1004 /* set database suffix */
1005 } else if ( strcasecmp( cargv[0], "suffix" ) == 0 ) {
1007 struct berval dn, pdn, ndn;
1011 LDAP_LOG( CONFIG, CRIT,
1012 "%s: line %d: missing dn in \"suffix <dn>\" line.\n",
1015 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1016 "missing dn in \"suffix <dn>\" line\n",
1022 } else if ( cargc > 2 ) {
1024 LDAP_LOG( CONFIG, INFO,
1025 "%s: line %d: extra cruft after <dn> in \"suffix %s\""
1026 " line (ignored).\n", fname, lineno, cargv[1] );
1028 Debug( LDAP_DEBUG_ANY, "%s: line %d: extra cruft "
1029 "after <dn> in \"suffix %s\" line (ignored)\n",
1030 fname, lineno, cargv[1] );
1036 LDAP_LOG( CONFIG, INFO,
1037 "%s: line %d: suffix line must appear inside a database "
1038 "definition.\n", fname, lineno, 0 );
1040 Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix line "
1041 "must appear inside a database definition\n",
1046 #if defined(SLAPD_MONITOR_DN)
1047 /* "cn=Monitor" is reserved for monitoring slap */
1048 } else if ( strcasecmp( cargv[1], SLAPD_MONITOR_DN ) == 0 ) {
1050 LDAP_LOG( CONFIG, CRIT, "%s: line %d: \""
1051 "%s\" is reserved for monitoring slapd\n",
1052 fname, lineno, SLAPD_MONITOR_DN );
1054 Debug( LDAP_DEBUG_ANY, "%s: line %d: \""
1055 "%s\" is reserved for monitoring slapd\n",
1056 fname, lineno, SLAPD_MONITOR_DN );
1059 #endif /* SLAPD_MONITOR_DN */
1062 if ( load_ucdata( NULL ) < 0 ) return 1;
1064 dn.bv_val = cargv[1];
1065 dn.bv_len = strlen( cargv[1] );
1067 rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn, NULL );
1068 if( rc != LDAP_SUCCESS ) {
1070 LDAP_LOG( CONFIG, CRIT,
1071 "%s: line %d: suffix DN is invalid.\n",
1074 Debug( LDAP_DEBUG_ANY,
1075 "%s: line %d: suffix DN is invalid\n",
1081 tmp_be = select_backend( &ndn, 0, 0 );
1082 if ( tmp_be == be ) {
1084 LDAP_LOG( CONFIG, INFO,
1085 "%s: line %d: suffix already served by this backend "
1086 "(ignored)\n", fname, lineno, 0 );
1088 Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
1089 "already served by this backend (ignored)\n",
1095 } else if ( tmp_be != NULL ) {
1097 LDAP_LOG( CONFIG, INFO,
1098 "%s: line %d: suffix already served by a preceding "
1099 "backend \"%s\"\n", fname, lineno,
1100 tmp_be->be_suffix[0].bv_val );
1102 Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
1103 "already served by a preceeding backend \"%s\"\n",
1104 fname, lineno, tmp_be->be_suffix[0].bv_val );
1110 } else if( pdn.bv_len == 0 && default_search_nbase.bv_len ) {
1112 LDAP_LOG( CONFIG, INFO,
1113 "%s: line %d: suffix DN empty and default search "
1114 "base provided \"%s\" (assuming okay).\n",
1115 fname, lineno, default_search_base.bv_val );
1117 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1118 "suffix DN empty and default "
1119 "search base provided \"%s\" (assuming okay)\n",
1120 fname, lineno, default_search_base.bv_val );
1124 ber_bvarray_add( &be->be_suffix, &pdn );
1125 ber_bvarray_add( &be->be_nsuffix, &ndn );
1127 /* set max deref depth */
1128 } else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) {
1132 LDAP_LOG( CONFIG, CRIT,
1133 "%s: line %d: missing depth in \"maxDerefDepth <depth>\""
1134 " line\n", fname, lineno, 0 );
1136 Debug( LDAP_DEBUG_ANY,
1137 "%s: line %d: missing depth in \"maxDerefDepth <depth>\" line\n",
1145 LDAP_LOG( CONFIG, INFO,
1146 "%s: line %d: depth line must appear inside a database "
1147 "definition.\n", fname, lineno ,0 );
1149 Debug( LDAP_DEBUG_ANY,
1150 "%s: line %d: depth line must appear inside a database definition.\n",
1155 } else if ((i = atoi(cargv[1])) < 0) {
1157 LDAP_LOG( CONFIG, INFO,
1158 "%s: line %d: depth must be positive.\n",
1161 Debug( LDAP_DEBUG_ANY,
1162 "%s: line %d: depth must be positive.\n",
1169 be->be_max_deref_depth = i;
1173 /* set magic "root" dn for this database */
1174 } else if ( strcasecmp( cargv[0], "rootdn" ) == 0 ) {
1177 LDAP_LOG( CONFIG, INFO,
1178 "%s: line %d: missing dn in \"rootdn <dn>\" line.\n",
1181 Debug( LDAP_DEBUG_ANY,
1182 "%s: line %d: missing dn in \"rootdn <dn>\" line\n",
1191 LDAP_LOG( CONFIG, INFO,
1192 "%s: line %d: rootdn line must appear inside a database "
1193 "definition.\n", fname, lineno ,0 );
1195 Debug( LDAP_DEBUG_ANY,
1196 "%s: line %d: rootdn line must appear inside a database definition.\n",
1204 if ( load_ucdata( NULL ) < 0 ) return 1;
1206 dn.bv_val = cargv[1];
1207 dn.bv_len = strlen( cargv[1] );
1209 rc = dnPrettyNormal( NULL, &dn,
1211 &be->be_rootndn, NULL );
1213 if( rc != LDAP_SUCCESS ) {
1215 LDAP_LOG( CONFIG, CRIT,
1216 "%s: line %d: rootdn DN is invalid.\n",
1219 Debug( LDAP_DEBUG_ANY,
1220 "%s: line %d: rootdn DN is invalid\n",
1227 /* set super-secret magic database password */
1228 } else if ( strcasecmp( cargv[0], "rootpw" ) == 0 ) {
1231 LDAP_LOG( CONFIG, CRIT,
1232 "%s: line %d: missing passwd in \"rootpw <passwd>\""
1233 " line\n", fname, lineno ,0 );
1235 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1236 "missing passwd in \"rootpw <passwd>\" line\n",
1245 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
1246 "rootpw line must appear inside a database "
1247 "definition.\n", fname, lineno ,0 );
1249 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1250 "rootpw line must appear inside a database "
1257 Backend *tmp_be = select_backend( &be->be_rootndn, 0, 0 );
1259 if( tmp_be != be ) {
1261 LDAP_LOG( CONFIG, INFO,
1263 "rootpw can only be set when rootdn is under suffix\n",
1264 fname, lineno, "" );
1266 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1267 "rootpw can only be set when rootdn is under suffix\n",
1273 be->be_rootpw.bv_val = ch_strdup( cargv[1] );
1274 be->be_rootpw.bv_len = strlen( be->be_rootpw.bv_val );
1277 /* make this database read-only */
1278 } else if ( strcasecmp( cargv[0], "readonly" ) == 0 ) {
1281 LDAP_LOG( CONFIG, CRIT,
1282 "%s: line %d: missing on|off in \"readonly <on|off>\" "
1283 "line.\n", fname, lineno ,0 );
1285 Debug( LDAP_DEBUG_ANY,
1286 "%s: line %d: missing on|off in \"readonly <on|off>\" line\n",
1293 if ( strcasecmp( cargv[1], "on" ) == 0 ) {
1294 global_restrictops |= SLAP_RESTRICT_OP_WRITES;
1296 global_restrictops &= ~SLAP_RESTRICT_OP_WRITES;
1299 if ( strcasecmp( cargv[1], "on" ) == 0 ) {
1300 be->be_restrictops |= SLAP_RESTRICT_OP_WRITES;
1302 be->be_restrictops &= ~SLAP_RESTRICT_OP_WRITES;
1306 /* restricts specific operations */
1307 } else if ( strcasecmp( cargv[0], "restrict" ) == 0 ) {
1308 slap_mask_t restrict = 0;
1309 struct restrictable_exops_t {
1312 } restrictable_exops[] = {
1313 { LDAP_EXOP_START_TLS, SLAP_RESTRICT_EXOP_START_TLS },
1314 { LDAP_EXOP_MODIFY_PASSWD, SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
1315 { LDAP_EXOP_X_WHO_AM_I, SLAP_RESTRICT_EXOP_WHOAMI },
1316 { LDAP_EXOP_X_CANCEL, SLAP_RESTRICT_EXOP_CANCEL },
1323 LDAP_LOG( CONFIG, CRIT,
1324 "%s: line %d: missing <op_list> in \"restrict <op_list>\" "
1325 "line.\n", fname, lineno ,0 );
1327 Debug( LDAP_DEBUG_ANY,
1328 "%s: line %d: missing <op_list> in \"restrict <op_list>\" "
1329 "line.\n", fname, lineno, 0 );
1335 for ( i = 1; i < cargc; i++ ) {
1336 if ( strcasecmp( cargv[ i ], "read" ) == 0 ) {
1337 restrict |= SLAP_RESTRICT_OP_READS;
1339 } else if ( strcasecmp( cargv[ i ], "write" ) == 0 ) {
1340 restrict |= SLAP_RESTRICT_OP_WRITES;
1342 } else if ( strcasecmp( cargv[ i ], "add" ) == 0 ) {
1343 restrict |= SLAP_RESTRICT_OP_ADD;
1345 } else if ( strcasecmp( cargv[ i ], "bind" ) == 0 ) {
1346 restrict |= SLAP_RESTRICT_OP_BIND;
1348 } else if ( strcasecmp( cargv[ i ], "compare" ) == 0 ) {
1349 restrict |= SLAP_RESTRICT_OP_COMPARE;
1351 } else if ( strcasecmp( cargv[ i ], "delete" ) == 0 ) {
1352 restrict |= SLAP_RESTRICT_OP_DELETE;
1354 } else if ( strncasecmp( cargv[ i ], "extended",
1355 STRLENOF( "extended" ) ) == 0 ) {
1356 char *e = cargv[ i ] + STRLENOF( "extended" );
1358 if ( e[0] == '=' ) {
1362 for ( j = 0; restrictable_exops[ j ].name; j++ ) {
1363 if ( strcmp( e, restrictable_exops[ j ].name ) == 0 ) {
1364 restrict |= restrictable_exops[ j ].flag;
1369 if ( restrictable_exops[ j ].name == NULL ) {
1370 goto restrict_unknown;
1373 restrict &= ~SLAP_RESTRICT_OP_EXTENDED;
1375 } else if ( e[0] == '\0' ) {
1376 restrict &= ~SLAP_RESTRICT_EXOP_MASK;
1377 restrict |= SLAP_RESTRICT_OP_EXTENDED;
1380 goto restrict_unknown;
1383 } else if ( strcasecmp( cargv[ i ], "modify" ) == 0 ) {
1384 restrict |= SLAP_RESTRICT_OP_MODIFY;
1386 } else if ( strcasecmp( cargv[ i ], "rename" ) == 0
1387 || strcasecmp( cargv[ i ], "modrdn" ) == 0 ) {
1388 restrict |= SLAP_RESTRICT_OP_RENAME;
1390 } else if ( strcasecmp( cargv[ i ], "search" ) == 0 ) {
1391 restrict |= SLAP_RESTRICT_OP_SEARCH;
1397 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
1398 "unknown operation %s in \"allow <features>\" line.\n",
1399 fname, lineno, cargv[i] );
1401 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1402 "unknown operation %s in \"allow <features>\" line\n",
1403 fname, lineno, cargv[i] );
1410 global_restrictops |= restrict;
1413 be->be_restrictops |= restrict;
1416 /* allow these features */
1417 } else if ( strcasecmp( cargv[0], "allows" ) == 0 ||
1418 strcasecmp( cargv[0], "allow" ) == 0 )
1424 LDAP_LOG( CONFIG, INFO,
1425 "%s: line %d: allow line must appear prior to "
1426 "database definitions.\n", fname, lineno ,0 );
1428 Debug( LDAP_DEBUG_ANY,
1429 "%s: line %d: allow line must appear prior to database definitions\n",
1437 LDAP_LOG( CONFIG, CRIT,
1438 "%s: line %d: missing feature(s) in \"allow <features>\""
1439 " line\n", fname, lineno ,0 );
1441 Debug( LDAP_DEBUG_ANY,
1442 "%s: line %d: missing feature(s) in \"allow <features>\" line\n",
1451 for( i=1; i < cargc; i++ ) {
1452 if( strcasecmp( cargv[i], "bind_v2" ) == 0 ) {
1453 allows |= SLAP_ALLOW_BIND_V2;
1455 } else if( strcasecmp( cargv[i], "bind_anon_cred" ) == 0 ) {
1456 allows |= SLAP_ALLOW_BIND_ANON_CRED;
1458 } else if( strcasecmp( cargv[i], "bind_anon_dn" ) == 0 ) {
1459 allows |= SLAP_ALLOW_BIND_ANON_DN;
1461 } else if( strcasecmp( cargv[i], "update_anon" ) == 0 ) {
1462 allows |= SLAP_ALLOW_UPDATE_ANON;
1464 } else if( strcasecmp( cargv[i], "none" ) != 0 ) {
1466 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
1467 "unknown feature %s in \"allow <features>\" line.\n",
1468 fname, lineno, cargv[i] );
1470 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1471 "unknown feature %s in \"allow <features>\" line\n",
1472 fname, lineno, cargv[i] );
1479 global_allows = allows;
1481 /* disallow these features */
1482 } else if ( strcasecmp( cargv[0], "disallows" ) == 0 ||
1483 strcasecmp( cargv[0], "disallow" ) == 0 )
1485 slap_mask_t disallows;
1489 LDAP_LOG( CONFIG, INFO,
1490 "%s: line %d: disallow line must appear prior to "
1491 "database definitions.\n", fname, lineno ,0 );
1493 Debug( LDAP_DEBUG_ANY,
1494 "%s: line %d: disallow line must appear prior to database definitions\n",
1502 LDAP_LOG( CONFIG, CRIT,
1503 "%s: line %d: missing feature(s) in \"disallow <features>\""
1504 " line.\n", fname, lineno ,0 );
1506 Debug( LDAP_DEBUG_ANY,
1507 "%s: line %d: missing feature(s) in \"disallow <features>\" line\n",
1516 for( i=1; i < cargc; i++ ) {
1517 if( strcasecmp( cargv[i], "bind_anon" ) == 0 ) {
1518 disallows |= SLAP_DISALLOW_BIND_ANON;
1520 } else if( strcasecmp( cargv[i], "bind_simple" ) == 0 ) {
1521 disallows |= SLAP_DISALLOW_BIND_SIMPLE;
1523 } else if( strcasecmp( cargv[i], "bind_krbv4" ) == 0 ) {
1524 disallows |= SLAP_DISALLOW_BIND_KRBV4;
1526 } else if( strcasecmp( cargv[i], "tls_2_anon" ) == 0 ) {
1527 disallows |= SLAP_DISALLOW_TLS_2_ANON;
1529 } else if( strcasecmp( cargv[i], "tls_authc" ) == 0 ) {
1530 disallows |= SLAP_DISALLOW_TLS_AUTHC;
1532 } else if( strcasecmp( cargv[i], "none" ) != 0 ) {
1534 LDAP_LOG( CONFIG, CRIT,
1535 "%s: line %d: unknown feature %s in "
1536 "\"disallow <features>\" line.\n",
1537 fname, lineno, cargv[i] );
1539 Debug( LDAP_DEBUG_ANY,
1540 "%s: line %d: unknown feature %s in \"disallow <features>\" line\n",
1541 fname, lineno, cargv[i] );
1548 global_disallows = disallows;
1550 /* require these features */
1551 } else if ( strcasecmp( cargv[0], "requires" ) == 0 ||
1552 strcasecmp( cargv[0], "require" ) == 0 )
1554 slap_mask_t requires;
1558 LDAP_LOG( CONFIG, CRIT,
1559 "%s: line %d: missing feature(s) in "
1560 "\"require <features>\" line.\n", fname, lineno ,0 );
1562 Debug( LDAP_DEBUG_ANY,
1563 "%s: line %d: missing feature(s) in \"require <features>\" line\n",
1572 for( i=1; i < cargc; i++ ) {
1573 if( strcasecmp( cargv[i], "bind" ) == 0 ) {
1574 requires |= SLAP_REQUIRE_BIND;
1576 } else if( strcasecmp( cargv[i], "LDAPv3" ) == 0 ) {
1577 requires |= SLAP_REQUIRE_LDAP_V3;
1579 } else if( strcasecmp( cargv[i], "authc" ) == 0 ) {
1580 requires |= SLAP_REQUIRE_AUTHC;
1582 } else if( strcasecmp( cargv[i], "SASL" ) == 0 ) {
1583 requires |= SLAP_REQUIRE_SASL;
1585 } else if( strcasecmp( cargv[i], "strong" ) == 0 ) {
1586 requires |= SLAP_REQUIRE_STRONG;
1588 } else if( strcasecmp( cargv[i], "none" ) != 0 ) {
1590 LDAP_LOG( CONFIG, CRIT,
1591 "%s: line %d: unknown feature %s in "
1592 "\"require <features>\" line.\n",
1593 fname, lineno , cargv[i] );
1595 Debug( LDAP_DEBUG_ANY,
1596 "%s: line %d: unknown feature %s in \"require <features>\" line\n",
1597 fname, lineno, cargv[i] );
1605 global_requires = requires;
1607 be->be_requires = requires;
1610 /* required security factors */
1611 } else if ( strcasecmp( cargv[0], "security" ) == 0 ) {
1612 slap_ssf_set_t *set;
1616 LDAP_LOG( CONFIG, CRIT,
1617 "%s: line %d: missing factor(s) in \"security <factors>\""
1618 " line.\n", fname, lineno ,0 );
1620 Debug( LDAP_DEBUG_ANY,
1621 "%s: line %d: missing factor(s) in \"security <factors>\" line\n",
1629 set = &global_ssf_set;
1631 set = &be->be_ssf_set;
1634 for( i=1; i < cargc; i++ ) {
1635 if( strncasecmp( cargv[i], "ssf=",
1636 sizeof("ssf") ) == 0 )
1639 atoi( &cargv[i][sizeof("ssf")] );
1641 } else if( strncasecmp( cargv[i], "transport=",
1642 sizeof("transport") ) == 0 )
1644 set->sss_transport =
1645 atoi( &cargv[i][sizeof("transport")] );
1647 } else if( strncasecmp( cargv[i], "tls=",
1648 sizeof("tls") ) == 0 )
1651 atoi( &cargv[i][sizeof("tls")] );
1653 } else if( strncasecmp( cargv[i], "sasl=",
1654 sizeof("sasl") ) == 0 )
1657 atoi( &cargv[i][sizeof("sasl")] );
1659 } else if( strncasecmp( cargv[i], "update_ssf=",
1660 sizeof("update_ssf") ) == 0 )
1662 set->sss_update_ssf =
1663 atoi( &cargv[i][sizeof("update_ssf")] );
1665 } else if( strncasecmp( cargv[i], "update_transport=",
1666 sizeof("update_transport") ) == 0 )
1668 set->sss_update_transport =
1669 atoi( &cargv[i][sizeof("update_transport")] );
1671 } else if( strncasecmp( cargv[i], "update_tls=",
1672 sizeof("update_tls") ) == 0 )
1674 set->sss_update_tls =
1675 atoi( &cargv[i][sizeof("update_tls")] );
1677 } else if( strncasecmp( cargv[i], "update_sasl=",
1678 sizeof("update_sasl") ) == 0 )
1680 set->sss_update_sasl =
1681 atoi( &cargv[i][sizeof("update_sasl")] );
1683 } else if( strncasecmp( cargv[i], "simple_bind=",
1684 sizeof("simple_bind") ) == 0 )
1686 set->sss_simple_bind =
1687 atoi( &cargv[i][sizeof("simple_bind")] );
1691 LDAP_LOG( CONFIG, CRIT,
1692 "%s: line %d: unknown factor %S in "
1693 "\"security <factors>\" line.\n",
1694 fname, lineno, cargv[1] );
1696 Debug( LDAP_DEBUG_ANY,
1697 "%s: line %d: unknown factor %s in \"security <factors>\" line\n",
1698 fname, lineno, cargv[i] );
1704 /* where to send clients when we don't hold it */
1705 } else if ( strcasecmp( cargv[0], "referral" ) == 0 ) {
1708 LDAP_LOG( CONFIG, CRIT,
1709 "%s: line %d: missing URL in \"referral <URL>\""
1710 " line.\n", fname, lineno , 0 );
1712 Debug( LDAP_DEBUG_ANY,
1713 "%s: line %d: missing URL in \"referral <URL>\" line\n",
1720 if( validate_global_referral( cargv[1] ) ) {
1722 LDAP_LOG( CONFIG, CRIT,
1723 "%s: line %d: invalid URL (%s) in \"referral\" line.\n",
1724 fname, lineno, cargv[1] );
1726 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1727 "invalid URL (%s) in \"referral\" line.\n",
1728 fname, lineno, cargv[1] );
1733 vals[0].bv_val = cargv[1];
1734 vals[0].bv_len = strlen( vals[0].bv_val );
1735 if( value_add( &default_referral, vals ) )
1739 } else if ( strcasecmp( cargv[0], "logfile" ) == 0 ) {
1743 LDAP_LOG( CONFIG, CRIT,
1744 "%s: line %d: Error in logfile directive, "
1745 "\"logfile <filename>\"\n", fname, lineno , 0 );
1747 Debug( LDAP_DEBUG_ANY,
1748 "%s: line %d: Error in logfile directive, \"logfile filename\"\n",
1754 logfile = fopen( cargv[1], "w" );
1755 if ( logfile != NULL ) lutil_debug_file( logfile );
1758 /* start of a new database definition */
1759 } else if ( strcasecmp( cargv[0], "debug" ) == 0 ) {
1763 LDAP_LOG( CONFIG, CRIT,
1764 "%s: line %d: Error in debug directive, "
1765 "\"debug <subsys> <level>\"\n", fname, lineno , 0 );
1767 Debug( LDAP_DEBUG_ANY,
1768 "%s: line %d: Error in debug directive, \"debug subsys level\"\n",
1774 level = atoi( cargv[2] );
1775 if ( level <= 0 ) level = lutil_mnem2level( cargv[2] );
1776 lutil_set_debug_level( cargv[1], level );
1777 /* specify an Object Identifier macro */
1778 } else if ( strcasecmp( cargv[0], "objectidentifier" ) == 0 ) {
1779 rc = parse_oidm( fname, lineno, cargc, cargv );
1782 /* specify an objectclass */
1783 } else if ( strcasecmp( cargv[0], "objectclass" ) == 0 ) {
1786 LDAP_LOG( CONFIG, INFO,
1787 "%s: line %d: illegal objectclass format.\n",
1788 fname, lineno , 0 );
1790 Debug( LDAP_DEBUG_ANY,
1791 "%s: line %d: illegal objectclass format.\n",
1796 } else if ( *cargv[1] == '(' /*')'*/) {
1798 p = strchr(saveline,'(' /*')'*/);
1799 rc = parse_oc( fname, lineno, p, cargv );
1804 LDAP_LOG( CONFIG, INFO,
1805 "%s: line %d: old objectclass format not supported\n",
1806 fname, lineno , 0 );
1808 Debug( LDAP_DEBUG_ANY,
1809 "%s: line %d: old objectclass format not supported.\n",
1814 } else if ( strcasecmp( cargv[0], "ditcontentrule" ) == 0 ) {
1816 p = strchr(saveline,'(' /*')'*/);
1817 rc = parse_cr( fname, lineno, p, cargv );
1820 /* specify an attribute type */
1821 } else if (( strcasecmp( cargv[0], "attributetype" ) == 0 )
1822 || ( strcasecmp( cargv[0], "attribute" ) == 0 ))
1826 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
1827 "illegal attribute type format.\n",
1828 fname, lineno , 0 );
1830 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
1831 "illegal attribute type format.\n",
1836 } else if ( *cargv[1] == '(' /*')'*/) {
1838 p = strchr(saveline,'(' /*')'*/);
1839 rc = parse_at( fname, lineno, p, cargv );
1844 LDAP_LOG( CONFIG, INFO,
1845 "%s: line %d: old attribute type format not supported.\n",
1846 fname, lineno , 0 );
1848 Debug( LDAP_DEBUG_ANY,
1849 "%s: line %d: old attribute type format not supported.\n",
1855 /* define attribute option(s) */
1856 } else if ( strcasecmp( cargv[0], "attributeoptions" ) == 0 ) {
1857 ad_define_option( NULL, NULL, 0 );
1858 for ( i = 1; i < cargc; i++ )
1859 if ( ad_define_option( cargv[i], fname, lineno ) != 0 )
1862 /* turn on/off schema checking */
1863 } else if ( strcasecmp( cargv[0], "schemacheck" ) == 0 ) {
1866 LDAP_LOG( CONFIG, CRIT,
1867 "%s: line %d: missing on|off in \"schemacheck <on|off>\""
1868 " line.\n", fname, lineno , 0 );
1870 Debug( LDAP_DEBUG_ANY,
1871 "%s: line %d: missing on|off in \"schemacheck <on|off>\" line\n",
1877 if ( strcasecmp( cargv[1], "off" ) == 0 ) {
1879 LDAP_LOG( CONFIG, CRIT,
1880 "%s: line %d: schema checking disabled! your mileage may "
1881 "vary!\n", fname, lineno , 0 );
1883 Debug( LDAP_DEBUG_ANY,
1884 "%s: line %d: schema checking disabled! your mileage may vary!\n",
1887 global_schemacheck = 0;
1889 global_schemacheck = 1;
1892 /* specify access control info */
1893 } else if ( strcasecmp( cargv[0], "access" ) == 0 ) {
1894 parse_acl( be, fname, lineno, cargc, cargv );
1896 /* debug level to log things to syslog */
1897 } else if ( strcasecmp( cargv[0], "loglevel" ) == 0 ) {
1900 LDAP_LOG( CONFIG, CRIT,
1901 "%s: line %d: missing level in \"loglevel <level>\""
1902 " line.\n", fname, lineno , 0 );
1904 Debug( LDAP_DEBUG_ANY,
1905 "%s: line %d: missing level in \"loglevel <level>\" line\n",
1914 for( i=1; i < cargc; i++ ) {
1915 ldap_syslog += atoi( cargv[1] );
1918 /* list of sync replication information in this backend (slave only) */
1919 } else if ( strcasecmp( cargv[0], "syncrepl" ) == 0 ) {
1923 LDAP_LOG( CONFIG, INFO,
1924 "%s: line %d: syncrepl line must appear inside "
1925 "a database definition.\n", fname, lineno, 0);
1927 Debug( LDAP_DEBUG_ANY,
1928 "%s: line %d: syncrepl line must appear inside "
1929 "a database definition.\n", fname, lineno, 0);
1933 } else if ( SLAP_SHADOW( be )) {
1935 LDAP_LOG( CONFIG, INFO,
1936 "%s: line %d: syncrepl: database already shadowed.\n",
1939 Debug( LDAP_DEBUG_ANY,
1940 "%s: line %d: syncrepl: database already shadowed.\n",
1945 } else if ( add_syncrepl( be, cargv, cargc )) {
1949 SLAP_DBFLAGS(be) |= ( SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SYNC_SHADOW );
1951 /* list of replicas of the data in this backend (master only) */
1952 } else if ( strcasecmp( cargv[0], "replica" ) == 0 ) {
1955 LDAP_LOG( CONFIG, CRIT,
1956 "%s: line %d: missing host or uri in \"replica "
1957 " <host[:port]\" line\n", fname, lineno , 0 );
1959 Debug( LDAP_DEBUG_ANY,
1960 "%s: line %d: missing host or uri in \"replica <host[:port]>\" line\n",
1968 LDAP_LOG( CONFIG, INFO,
1969 "%s: line %d: replica line must appear inside "
1970 "a database definition.\n", fname, lineno, 0);
1972 Debug( LDAP_DEBUG_ANY,
1973 "%s: line %d: replica line must appear inside a database definition\n",
1981 for ( i = 1; i < cargc; i++ ) {
1982 if ( strncasecmp( cargv[i], "host=", 5 )
1984 nr = add_replica_info( be,
1987 } else if (strncasecmp( cargv[i], "uri=", 4 )
1989 if ( ldap_url_parse( cargv[ i ] + 4, &ludp )
1992 LDAP_LOG( CONFIG, INFO,
1993 "%s: line %d: replica line contains invalid "
1994 "uri definition.\n", fname, lineno, 0);
1996 Debug( LDAP_DEBUG_ANY,
1997 "%s: line %d: replica line contains invalid "
1998 "uri definition.\n", fname, lineno, 0);
2002 if (ludp->lud_host == NULL ) {
2004 LDAP_LOG( CONFIG, INFO,
2005 "%s: line %d: replica line contains invalid "
2006 "uri definition - missing hostname.\n",
2009 Debug( LDAP_DEBUG_ANY,
2010 "%s: line %d: replica line contains invalid "
2011 "uri definition - missing hostname.\n", fname, lineno, 0);
2015 replicahost = ch_malloc( strlen( cargv[ i ] ) );
2016 if ( replicahost == NULL ) {
2018 LDAP_LOG( CONFIG, ERR,
2019 "out of memory in read_config\n", 0, 0,0 );
2021 Debug( LDAP_DEBUG_ANY,
2022 "out of memory in read_config\n", 0, 0, 0 );
2024 ldap_free_urldesc( ludp );
2025 exit( EXIT_FAILURE );
2027 sprintf(replicahost, "%s:%d",
2028 ludp->lud_host, ludp->lud_port);
2029 nr = add_replica_info( be, replicahost );
2030 ldap_free_urldesc( ludp );
2031 ch_free(replicahost);
2037 LDAP_LOG( CONFIG, INFO,
2038 "%s: line %d: missing host or uri in \"replica\" line\n",
2039 fname, lineno , 0 );
2041 Debug( LDAP_DEBUG_ANY,
2042 "%s: line %d: missing host or uri in \"replica\" line\n",
2047 } else if ( nr == -1 ) {
2049 LDAP_LOG( CONFIG, INFO,
2050 "%s: line %d: unable to add"
2051 " replica \"%s\"\n",
2055 Debug( LDAP_DEBUG_ANY,
2056 "%s: line %d: unable to add replica \"%s\"\n",
2057 fname, lineno, cargv[i] + 5 );
2061 for ( i = 1; i < cargc; i++ ) {
2062 if ( strncasecmp( cargv[i], "suffix=", 7 ) == 0 ) {
2064 switch ( add_replica_suffix( be, nr, cargv[i] + 7 ) ) {
2067 LDAP_LOG( CONFIG, INFO,
2068 "%s: line %d: suffix \"%s\" in \"replica\""
2069 " line is not valid for backend(ignored)\n",
2070 fname, lineno, cargv[i] + 7 );
2072 Debug( LDAP_DEBUG_ANY,
2073 "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
2074 fname, lineno, cargv[i] + 7 );
2080 LDAP_LOG( CONFIG, INFO,
2081 "%s: line %d: unable to normalize suffix"
2082 " in \"replica\" line (ignored)\n",
2083 fname, lineno , 0 );
2085 Debug( LDAP_DEBUG_ANY,
2086 "%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
2092 } else if ( strncasecmp( cargv[i], "attr", 4 ) == 0 ) {
2094 char *arg = cargv[i] + 4;
2096 if ( arg[0] == '!' ) {
2101 if ( arg[0] != '=' ) {
2105 if ( add_replica_attrs( be, nr, arg + 1, exclude ) ) {
2107 LDAP_LOG( CONFIG, INFO,
2108 "%s: line %d: attribute \"%s\" in "
2109 "\"replica\" line is unknown\n",
2110 fname, lineno, arg + 1 );
2112 Debug( LDAP_DEBUG_ANY,
2113 "%s: line %d: attribute \"%s\" in \"replica\" line is unknown\n",
2114 fname, lineno, arg + 1 );
2123 } else if ( strcasecmp( cargv[0], "replicationInterval" ) == 0 ) {
2126 /* dn of slave entity allowed to write to replica */
2127 } else if ( strcasecmp( cargv[0], "updatedn" ) == 0 ) {
2130 LDAP_LOG( CONFIG, CRIT,
2131 "%s: line %d: missing dn in \"updatedn <dn>\""
2132 " line.\n", fname, lineno , 0 );
2134 Debug( LDAP_DEBUG_ANY,
2135 "%s: line %d: missing dn in \"updatedn <dn>\" line\n",
2143 LDAP_LOG( CONFIG, INFO,
2144 "%s: line %d: updatedn line must appear inside "
2145 "a database definition\n",
2146 fname, lineno , 0 );
2148 Debug( LDAP_DEBUG_ANY,
2149 "%s: line %d: updatedn line must appear inside a database definition\n",
2154 } else if ( SLAP_SHADOW(be) ) {
2156 LDAP_LOG( CONFIG, INFO,
2157 "%s: line %d: updatedn: database already shadowed.\n",
2160 Debug( LDAP_DEBUG_ANY,
2161 "%s: line %d: updatedn: database already shadowed.\n",
2169 if ( load_ucdata( NULL ) < 0 ) return 1;
2171 dn.bv_val = cargv[1];
2172 dn.bv_len = strlen( cargv[1] );
2174 rc = dnNormalize( 0, NULL, NULL, &dn, &be->be_update_ndn, NULL );
2175 if( rc != LDAP_SUCCESS ) {
2177 LDAP_LOG( CONFIG, CRIT,
2178 "%s: line %d: updatedn DN is invalid.\n",
2179 fname, lineno , 0 );
2181 Debug( LDAP_DEBUG_ANY,
2182 "%s: line %d: updatedn DN is invalid\n",
2189 SLAP_DBFLAGS(be) |= ( SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW );
2191 } else if ( strcasecmp( cargv[0], "updateref" ) == 0 ) {
2194 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2195 "missing url in \"updateref <ldapurl>\" line.\n",
2196 fname, lineno , 0 );
2198 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2199 "missing url in \"updateref <ldapurl>\" line\n",
2207 LDAP_LOG( CONFIG, INFO, "%s: line %d: updateref"
2208 " line must appear inside a database definition\n",
2209 fname, lineno , 0 );
2211 Debug( LDAP_DEBUG_ANY, "%s: line %d: updateref"
2212 " line must appear inside a database definition\n",
2217 } else if ( !SLAP_SHADOW(be) ) {
2219 LDAP_LOG( CONFIG, INFO, "%s: line %d: "
2220 "updateref line must come after syncrepl or updatedn.\n",
2221 fname, lineno , 0 );
2223 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2224 "updateref line must after syncrepl or updatedn.\n",
2230 if( validate_global_referral( cargv[1] ) ) {
2232 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2233 "invalid URL (%s) in \"updateref\" line.\n",
2234 fname, lineno, cargv[1] );
2236 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2237 "invalid URL (%s) in \"updateref\" line.\n",
2238 fname, lineno, cargv[1] );
2243 vals[0].bv_val = cargv[1];
2244 vals[0].bv_len = strlen( vals[0].bv_val );
2245 if( value_add( &be->be_update_refs, vals ) ) {
2249 /* replication log file to which changes are appended */
2250 } else if ( strcasecmp( cargv[0], "replogfile" ) == 0 ) {
2253 LDAP_LOG( CONFIG, CRIT,
2254 "%s: line %d: missing filename in \"replogfile <filename>\""
2255 " line.\n", fname, lineno , 0 );
2257 Debug( LDAP_DEBUG_ANY,
2258 "%s: line %d: missing filename in \"replogfile <filename>\" line\n",
2265 be->be_replogfile = ch_strdup( cargv[1] );
2267 replogfile = ch_strdup( cargv[1] );
2270 /* file from which to read additional rootdse attrs */
2271 } else if ( strcasecmp( cargv[0], "rootDSE" ) == 0) {
2274 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2275 "missing filename in \"rootDSE <filename>\" line.\n",
2276 fname, lineno , 0 );
2278 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2279 "missing filename in \"rootDSE <filename>\" line.\n",
2285 if( read_root_dse_file( cargv[1] ) ) {
2287 LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
2288 "could not read \"rootDSE <filename>\" line.\n",
2289 fname, lineno , 0 );
2291 Debug( LDAP_DEBUG_ANY, "%s: line %d: "
2292 "could not read \"rootDSE <filename>\" line\n",
2298 /* maintain lastmodified{by,time} attributes */
2299 } else if ( strcasecmp( cargv[0], "lastmod" ) == 0 ) {
2302 LDAP_LOG( CONFIG, CRIT,
2303 "%s: line %d: missing on|off in \"lastmod <on|off>\""
2304 " line.\n", fname, lineno , 0 );
2306 Debug( LDAP_DEBUG_ANY,
2307 "%s: line %d: missing on|off in \"lastmod <on|off>\" line\n",
2316 LDAP_LOG( CONFIG, INFO, "%s: line %d: lastmod"
2317 " line must appear inside a database definition\n",
2318 fname, lineno , 0 );
2320 Debug( LDAP_DEBUG_ANY, "%s: line %d: lastmod"
2321 " line must appear inside a database definition\n",
2326 } else if ( SLAP_NOLASTMODCMD(be) ) {
2328 LDAP_LOG( CONFIG, INFO, "%s: line %d: lastmod"
2329 " not available for %s database\n",
2330 fname, lineno , be->bd_info->bi_type );
2332 Debug( LDAP_DEBUG_ANY, "%s: line %d: lastmod"
2333 " not available for %s databases\n",
2334 fname, lineno, be->bd_info->bi_type );
2339 if ( strcasecmp( cargv[1], "on" ) == 0 ) {
2340 SLAP_DBFLAGS(be) &= ~SLAP_DBFLAG_NOLASTMOD;
2342 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NOLASTMOD;
2346 /* turn on/off gentle SIGHUP handling */
2347 } else if ( strcasecmp( cargv[0], "gentlehup" ) == 0 ) {
2349 Debug( LDAP_DEBUG_ANY,
2350 "%s: line %d: missing on|off in \"gentlehup <on|off>\" line\n",
2354 if ( strcasecmp( cargv[1], "off" ) == 0 ) {
2355 global_gentlehup = 0;
2357 global_gentlehup = 1;
2361 /* set idle timeout value */
2362 } else if ( strcasecmp( cargv[0], "idletimeout" ) == 0 ) {
2366 LDAP_LOG( CONFIG, CRIT,
2367 "%s: line %d: missing timeout value in "
2368 "\"idletimeout <seconds>\" line.\n", fname, lineno , 0 );
2370 Debug( LDAP_DEBUG_ANY,
2371 "%s: line %d: missing timeout value in \"idletimeout <seconds>\" line\n",
2378 i = atoi( cargv[1] );
2382 LDAP_LOG( CONFIG, CRIT,
2383 "%s: line %d: timeout value (%d) invalid "
2384 "\"idletimeout <seconds>\" line.\n", fname, lineno, i );
2386 Debug( LDAP_DEBUG_ANY,
2387 "%s: line %d: timeout value (%d) invalid \"idletimeout <seconds>\" line\n",
2394 global_idletimeout = i;
2396 /* include another config file */
2397 } else if ( strcasecmp( cargv[0], "include" ) == 0 ) {
2400 LDAP_LOG( CONFIG, CRIT,
2401 "%s: line %d: missing filename in \"include "
2402 "<filename>\" line.\n", fname, lineno , 0 );
2404 Debug( LDAP_DEBUG_ANY,
2405 "%s: line %d: missing filename in \"include <filename>\" line\n",
2411 savefname = ch_strdup( cargv[1] );
2412 savelineno = lineno;
2414 if ( read_config( savefname, depth+1 ) != 0 ) {
2419 lineno = savelineno - 1;
2421 /* location of kerberos srvtab file */
2422 } else if ( strcasecmp( cargv[0], "srvtab" ) == 0 ) {
2425 LDAP_LOG( CONFIG, CRIT,
2426 "%s: line %d: missing filename in \"srvtab "
2427 "<filename>\" line.\n", fname, lineno , 0 );
2429 Debug( LDAP_DEBUG_ANY,
2430 "%s: line %d: missing filename in \"srvtab <filename>\" line\n",
2436 ldap_srvtab = ch_strdup( cargv[1] );
2438 #ifdef SLAPD_MODULES
2439 } else if (strcasecmp( cargv[0], "moduleload") == 0 ) {
2442 LDAP_LOG( CONFIG, INFO,
2443 "%s: line %d: missing filename in \"moduleload "
2444 "<filename>\" line.\n", fname, lineno , 0 );
2446 Debug( LDAP_DEBUG_ANY,
2447 "%s: line %d: missing filename in \"moduleload <filename>\" line\n",
2451 exit( EXIT_FAILURE );
2453 if (module_load(cargv[1], cargc - 2, (cargc > 2) ? cargv + 2 : NULL)) {
2455 LDAP_LOG( CONFIG, CRIT,
2456 "%s: line %d: failed to load or initialize module %s\n",
2457 fname, lineno, cargv[1] );
2459 Debug( LDAP_DEBUG_ANY,
2460 "%s: line %d: failed to load or initialize module %s\n",
2461 fname, lineno, cargv[1]);
2464 exit( EXIT_FAILURE );
2466 } else if (strcasecmp( cargv[0], "modulepath") == 0 ) {
2469 LDAP_LOG( CONFIG, INFO,
2470 "%s: line %d: missing path in \"modulepath <path>\""
2471 " line\n", fname, lineno , 0 );
2473 Debug( LDAP_DEBUG_ANY,
2474 "%s: line %d: missing path in \"modulepath <path>\" line\n",
2478 exit( EXIT_FAILURE );
2480 if (module_path( cargv[1] )) {
2482 LDAP_LOG( CONFIG, CRIT,
2483 "%s: line %d: failed to set module search path to %s.\n",
2484 fname, lineno, cargv[1] );
2486 Debug( LDAP_DEBUG_ANY,
2487 "%s: line %d: failed to set module search path to %s\n",
2488 fname, lineno, cargv[1]);
2491 exit( EXIT_FAILURE );
2494 #endif /*SLAPD_MODULES*/
2497 } else if ( !strcasecmp( cargv[0], "TLSRandFile" ) ) {
2498 rc = ldap_pvt_tls_set_option( NULL,
2499 LDAP_OPT_X_TLS_RANDOM_FILE,
2504 } else if ( !strcasecmp( cargv[0], "TLSCipherSuite" ) ) {
2505 rc = ldap_pvt_tls_set_option( NULL,
2506 LDAP_OPT_X_TLS_CIPHER_SUITE,
2511 } else if ( !strcasecmp( cargv[0], "TLSCertificateFile" ) ) {
2512 rc = ldap_pvt_tls_set_option( NULL,
2513 LDAP_OPT_X_TLS_CERTFILE,
2518 } else if ( !strcasecmp( cargv[0], "TLSCertificateKeyFile" ) ) {
2519 rc = ldap_pvt_tls_set_option( NULL,
2520 LDAP_OPT_X_TLS_KEYFILE,
2525 } else if ( !strcasecmp( cargv[0], "TLSCACertificatePath" ) ) {
2526 rc = ldap_pvt_tls_set_option( NULL,
2527 LDAP_OPT_X_TLS_CACERTDIR,
2532 } else if ( !strcasecmp( cargv[0], "TLSCACertificateFile" ) ) {
2533 rc = ldap_pvt_tls_set_option( NULL,
2534 LDAP_OPT_X_TLS_CACERTFILE,
2538 } else if ( !strcasecmp( cargv[0], "TLSVerifyClient" ) ) {
2539 if ( isdigit( (unsigned char) cargv[1][0] ) ) {
2541 rc = ldap_pvt_tls_set_option( NULL,
2542 LDAP_OPT_X_TLS_REQUIRE_CERT,
2545 rc = ldap_int_tls_config( NULL,
2546 LDAP_OPT_X_TLS_REQUIRE_CERT,
2555 } else if ( !strcasecmp( cargv[0], "reverse-lookup" ) ) {
2556 #ifdef SLAPD_RLOOKUPS
2559 LDAP_LOG( CONFIG, INFO,
2560 "%s: line %d: reverse-lookup: missing \"on\" or \"off\"\n",
2561 fname, lineno , 0 );
2563 Debug( LDAP_DEBUG_ANY,
2564 "%s: line %d: reverse-lookup: missing \"on\" or \"off\"\n",
2570 if ( !strcasecmp( cargv[1], "on" ) ) {
2571 use_reverse_lookup = 1;
2572 } else if ( !strcasecmp( cargv[1], "off" ) ) {
2573 use_reverse_lookup = 0;
2576 LDAP_LOG( CONFIG, INFO,
2577 "%s: line %d: reverse-lookup: "
2578 "must be \"on\" (default) or \"off\"\n", fname, lineno, 0 );
2580 Debug( LDAP_DEBUG_ANY,
2581 "%s: line %d: reverse-lookup: must be \"on\" (default) or \"off\"\n",
2587 #else /* !SLAPD_RLOOKUPS */
2589 LDAP_LOG( CONFIG, INFO,
2590 "%s: line %d: reverse lookups "
2591 "are not configured (ignored).\n", fname, lineno , 0 );
2593 Debug( LDAP_DEBUG_ANY,
2594 "%s: line %d: reverse lookups are not configured (ignored).\n",
2597 #endif /* !SLAPD_RLOOKUPS */
2599 /* Netscape plugins */
2600 } else if ( strcasecmp( cargv[0], "plugin" ) == 0 ) {
2601 #if defined( LDAP_SLAPI )
2603 #ifdef notdef /* allow global plugins, too */
2605 * a "plugin" line must be inside a database
2606 * definition, since we implement pre-,post-
2607 * and extended operation plugins
2611 LDAP_LOG( CONFIG, INFO,
2612 "%s: line %d: plugin line must appear "
2613 "insid a database definition.\n",
2616 Debug( LDAP_DEBUG_ANY, "%s: line %d: plugin "
2617 "line must appear inside a database "
2618 "definition\n", fname, lineno, 0 );
2624 if ( slapi_int_read_config( be, fname, lineno, cargc, cargv )
2628 LDAP_LOG( CONFIG, INFO,
2629 "%s: line %d: SLAPI config read failed.\n",
2632 Debug( LDAP_DEBUG_ANY, "%s: line %d: SLAPI "
2633 "config read failed.\n", fname, lineno, 0 );
2637 slapi_plugins_used++;
2639 #else /* !defined( LDAP_SLAPI ) */
2641 LDAP_LOG( CONFIG, INFO,
2642 "%s: line %d: SLAPI not supported.\n",
2645 Debug( LDAP_DEBUG_ANY, "%s: line %d: SLAPI "
2646 "not supported.\n", fname, lineno, 0 );
2650 #endif /* !defined( LDAP_SLAPI ) */
2652 /* Netscape plugins */
2653 } else if ( strcasecmp( cargv[0], "pluginlog" ) == 0 ) {
2654 #if defined( LDAP_SLAPI )
2657 LDAP_LOG( CONFIG, INFO,
2658 "%s: line %d: missing file name "
2659 "in pluginlog <filename> line.\n",
2662 Debug( LDAP_DEBUG_ANY,
2663 "%s: line %d: missing file name "
2664 "in pluginlog <filename> line.\n",
2670 if ( slapi_log_file != NULL ) {
2671 ch_free( slapi_log_file );
2674 slapi_log_file = ch_strdup( cargv[1] );
2675 #endif /* !defined( LDAP_SLAPI ) */
2677 /* pass anything else to the current backend info/db config routine */
2680 if ( bi->bi_config ) {
2681 rc = (*bi->bi_config)( bi, fname, lineno, cargc, cargv );
2687 case SLAP_CONF_UNKNOWN:
2689 LDAP_LOG( CONFIG, INFO,
2690 "%s: line %d: unknown directive \"%s\" inside "
2691 "backend info definition (ignored).\n",
2692 fname, lineno, cargv[0] );
2694 Debug( LDAP_DEBUG_ANY,
2695 "%s: line %d: unknown directive \"%s\" inside backend info definition (ignored)\n",
2696 fname, lineno, cargv[0] );
2705 } else if ( be != NULL ) {
2706 if ( be->be_config ) {
2707 rc = (*be->be_config)( be, fname, lineno, cargc, cargv );
2713 case SLAP_CONF_UNKNOWN:
2715 LDAP_LOG( CONFIG, INFO,
2716 "%s: line %d: unknown directive \"%s\" inside "
2717 "backend database definition (ignored).\n",
2718 fname, lineno, cargv[0] );
2720 Debug( LDAP_DEBUG_ANY,
2721 "%s: line %d: unknown directive \"%s\" inside backend database definition (ignored)\n",
2722 fname, lineno, cargv[0] );
2733 LDAP_LOG( CONFIG, INFO,
2734 "%s: line %d: unknown directive \"%s\" outside backend "
2735 "info and database definitions (ignored).\n",
2736 fname, lineno, cargv[0] );
2738 Debug( LDAP_DEBUG_ANY,
2739 "%s: line %d: unknown directive \"%s\" outside backend info and database definitions (ignored)\n",
2740 fname, lineno, cargv[0] );
2749 if ( depth == 0 ) ch_free( cargv );
2751 if ( !global_schemadn.bv_val ) {
2752 ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1,
2754 dnNormalize( 0, NULL, NULL, &global_schemadn, &global_schemandn, NULL );
2757 if ( load_ucdata( NULL ) < 0 ) return 1;
2769 char logbuf[sizeof("pseudorootpw ***")];
2772 token = strtok_quote( line, " \t" );
2776 if ( token && ( strcasecmp( token, "rootpw" ) == 0 ||
2777 strcasecmp( token, "replica" ) == 0 || /* contains "credentials" */
2778 strcasecmp( token, "bindpw" ) == 0 || /* used in back-ldap */
2779 strcasecmp( token, "pseudorootpw" ) == 0 || /* used in back-meta */
2780 strcasecmp( token, "dbpasswd" ) == 0 ) ) /* used in back-sql */
2782 snprintf( logline = logbuf, sizeof logbuf, "%s ***", token );
2785 if ( strtok_quote_ptr ) {
2786 *strtok_quote_ptr = ' ';
2790 LDAP_LOG( CONFIG, DETAIL1, "line %d (%s)\n", lineno, logline , 0 );
2792 Debug( LDAP_DEBUG_CONFIG, "line %d (%s)\n", lineno, logline, 0 );
2795 if ( strtok_quote_ptr ) {
2796 *strtok_quote_ptr = '\0';
2799 for ( ; token != NULL; token = strtok_quote( NULL, " \t" ) ) {
2800 if ( cargc == cargv_size - 1 ) {
2802 tmp = ch_realloc( cargv, (cargv_size + ARGS_STEP) *
2804 if ( tmp == NULL ) {
2806 LDAP_LOG( CONFIG, ERR, "line %d: out of memory\n", lineno, 0,0 );
2808 Debug( LDAP_DEBUG_ANY,
2809 "line %d: out of memory\n",
2815 cargv_size += ARGS_STEP;
2817 cargv[cargc++] = token;
2819 cargv[cargc] = NULL;
2824 strtok_quote( char *line, char *sep )
2830 strtok_quote_ptr = NULL;
2831 if ( line != NULL ) {
2834 while ( *next && strchr( sep, *next ) ) {
2838 if ( *next == '\0' ) {
2844 for ( inquote = 0; *next; ) {
2852 AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
2858 next + 1, strlen( next + 1 ) + 1 );
2859 next++; /* dont parse the escaped character */
2864 if ( strchr( sep, *next ) != NULL ) {
2865 strtok_quote_ptr = next;
2878 static char buf[BUFSIZ];
2880 static size_t lmax, lcur;
2882 #define CATLINE( buf ) \
2884 size_t len = strlen( buf ); \
2885 while ( lcur + len + 1 > lmax ) { \
2887 line = (char *) ch_realloc( line, lmax ); \
2889 strcpy( line + lcur, buf ); \
2894 fp_getline( FILE *fp, int *lineno )
2902 /* hack attack - keeps us from having to keep a stack of bufs... */
2903 if ( strncasecmp( line, "include", 7 ) == 0 ) {
2908 while ( fgets( buf, sizeof(buf), fp ) != NULL ) {
2909 /* trim off \r\n or \n */
2910 if ( (p = strchr( buf, '\n' )) != NULL ) {
2911 if( p > buf && p[-1] == '\r' ) --p;
2915 /* trim off trailing \ and append the next line */
2916 if ( line[ 0 ] != '\0'
2917 && (p = line + strlen( line ) - 1)[ 0 ] == '\\'
2918 && p[ -1 ] != '\\' ) {
2923 if ( ! isspace( (unsigned char) buf[0] ) ) {
2927 /* change leading whitespace to a space */
2936 return( line[0] ? line : NULL );
2940 fp_getline_init( int *lineno )
2946 /* Loads ucdata, returns 1 if loading, 0 if already loaded, -1 on error */
2948 load_ucdata( char *path )
2951 static int loaded = 0;
2957 err = ucdata_load( path ? path : SLAPD_DEFAULT_UCDATA, UCDATA_ALL );
2960 LDAP_LOG( CONFIG, CRIT,
2961 "load_ucdata: Error %d loading ucdata.\n", err, 0,0 );
2963 Debug( LDAP_DEBUG_ANY, "error loading ucdata (error %d)\n",
2972 /* ucdata is now hardcoded */
2980 ucdata_unload( UCDATA_ALL );
2981 free( global_schemandn.bv_val );
2982 free( global_schemadn.bv_val );
2984 if ( slapd_args_file )
2985 free ( slapd_args_file );
2986 if ( slapd_pid_file )
2987 free ( slapd_pid_file );
2988 if ( default_passwd_hash )
2989 ldap_charray_free( default_passwd_hash );
2990 acl_destroy( global_acl, NULL );
3001 syncinfo_t *si_entry;
3003 int duplicated_replica_id = 0;
3005 si = (syncinfo_t *) ch_calloc( 1, sizeof( syncinfo_t ) );
3009 LDAP_LOG( CONFIG, ERR, "out of memory in add_syncrepl\n", 0, 0,0 );
3011 Debug( LDAP_DEBUG_ANY, "out of memory in add_syncrepl\n", 0, 0, 0 );
3016 si->si_tls = SYNCINFO_TLS_OFF;
3017 if ( be->be_rootndn.bv_val ) {
3018 ber_dupbv( &si->si_updatedn, &be->be_rootndn );
3020 si->si_bindmethod = LDAP_AUTH_SIMPLE;
3021 si->si_schemachecking = 0;
3022 ber_str2bv( "(objectclass=*)", STRLENOF("(objectclass=*)"), 0,
3023 &si->si_filterstr );
3024 si->si_base.bv_val = NULL;
3025 si->si_scope = LDAP_SCOPE_SUBTREE;
3026 si->si_attrsonly = 0;
3027 si->si_attrs = (char **) ch_calloc( 1, sizeof( char * ));
3028 si->si_attrs[0] = NULL;
3029 si->si_type = LDAP_SYNC_REFRESH_ONLY;
3030 si->si_interval = 86400;
3031 si->si_syncCookie.ctxcsn = NULL;
3032 si->si_syncCookie.octet_str = NULL;
3033 si->si_syncCookie.sid = -1;
3034 si->si_manageDSAit = 0;
3037 si->si_syncUUID_ndn.bv_val = NULL;
3038 si->si_syncUUID_ndn.bv_len = 0;
3040 si->si_presentlist = NULL;
3041 LDAP_LIST_INIT( &si->si_nonpresentlist );
3043 rc = parse_syncrepl_line( cargv, cargc, si );
3045 LDAP_STAILQ_FOREACH( si_entry, &be->be_syncinfo, si_next ) {
3046 if ( si->si_rid == si_entry->si_rid ) {
3048 LDAP_LOG( CONFIG, ERR,
3049 "add_syncrepl: duplicated replica id\n", 0, 0,0 );
3051 Debug( LDAP_DEBUG_ANY,
3052 "add_syncrepl: duplicated replica id\n",0, 0, 0 );
3054 duplicated_replica_id = 1;
3059 if ( rc < 0 || duplicated_replica_id ) {
3060 syncinfo_t *si_entry;
3061 /* Something bad happened - back out */
3063 LDAP_LOG( CONFIG, ERR, "failed to add syncinfo\n", 0, 0,0 );
3065 Debug( LDAP_DEBUG_ANY, "failed to add syncinfo\n", 0, 0, 0 );
3068 /* If error, remove all syncinfo */
3069 LDAP_STAILQ_FOREACH( si_entry, &be->be_syncinfo, si_next ) {
3070 if ( si_entry->si_updatedn.bv_val ) {
3071 ch_free( si->si_updatedn.bv_val );
3073 if ( si_entry->si_filterstr.bv_val ) {
3074 ch_free( si->si_filterstr.bv_val );
3076 if ( si_entry->si_attrs ) {
3078 while ( si_entry->si_attrs[i] != NULL ) {
3079 ch_free( si_entry->si_attrs[i] );
3082 ch_free( si_entry->si_attrs );
3086 while ( !LDAP_STAILQ_EMPTY( &be->be_syncinfo )) {
3087 si_entry = LDAP_STAILQ_FIRST( &be->be_syncinfo );
3088 LDAP_STAILQ_REMOVE_HEAD( &be->be_syncinfo, si_next );
3089 ch_free( si_entry );
3091 LDAP_STAILQ_INIT( &be->be_syncinfo );
3095 LDAP_LOG ( CONFIG, RESULTS,
3096 "add_syncrepl: Config: ** successfully added syncrepl \"%s\"\n",
3097 si->si_provideruri == NULL ? "(null)" : si->si_provideruri, 0, 0 );
3099 Debug( LDAP_DEBUG_CONFIG,
3100 "Config: ** successfully added syncrepl \"%s\"\n",
3101 si->si_provideruri == NULL ? "(null)" : si->si_provideruri, 0, 0 );
3103 if ( !si->si_schemachecking ) {
3104 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
3107 LDAP_STAILQ_INSERT_TAIL( &be->be_syncinfo, si, si_next );
3113 #define PROVIDERSTR "provider"
3114 #define SUFFIXSTR "suffix"
3115 #define UPDATEDNSTR "updatedn"
3116 #define BINDMETHSTR "bindmethod"
3117 #define SIMPLESTR "simple"
3118 #define SASLSTR "sasl"
3119 #define BINDDNSTR "binddn"
3120 #define CREDSTR "credentials"
3121 #define OLDAUTHCSTR "bindprincipal"
3122 #define AUTHCSTR "authcID"
3123 #define AUTHZSTR "authzID"
3124 #define SRVTABSTR "srvtab"
3125 #define SASLMECHSTR "saslmech"
3126 #define REALMSTR "realm"
3127 #define SECPROPSSTR "secprops"
3128 #define STARTTLSSTR "starttls"
3129 #define CRITICALSTR "critical"
3131 #define SCHEMASTR "schemachecking"
3132 #define FILTERSTR "filter"
3133 #define SEARCHBASESTR "searchbase"
3134 #define SCOPESTR "scope"
3135 #define ATTRSSTR "attrs"
3136 #define ATTRSONLYSTR "attrsonly"
3137 #define TYPESTR "type"
3138 #define INTERVALSTR "interval"
3139 #define LASTMODSTR "lastmod"
3140 #define LMREQSTR "req"
3141 #define LMGENSTR "gen"
3142 #define LMNOSTR "no"
3143 #define MANAGEDSAITSTR "manageDSAit"
3144 #define SLIMITSTR "sizelimit"
3145 #define TLIMITSTR "timelimit"
3147 #define GOT_ID 0x0001
3148 #define GOT_PROVIDER 0x0002
3149 #define GOT_METHOD 0x0004
3150 #define GOT_ALL 0x0007
3153 parse_syncrepl_line(
3164 for ( i = 1; i < cargc; i++ ) {
3165 if ( !strncasecmp( cargv[ i ], IDSTR, sizeof( IDSTR ) - 1 )) {
3167 /* '\0' string terminator accounts for '=' */
3168 val = cargv[ i ] + sizeof( IDSTR );
3170 if ( tmp >= 1000 || tmp < 0 ) {
3171 fprintf( stderr, "Error: parse_syncrepl_line: "
3172 "syncrepl id %d is out of range [0..999]\n", tmp );
3177 } else if ( !strncasecmp( cargv[ i ], PROVIDERSTR,
3178 sizeof( PROVIDERSTR ) - 1 )) {
3179 val = cargv[ i ] + sizeof( PROVIDERSTR );
3180 si->si_provideruri = ch_strdup( val );
3181 si->si_provideruri_bv = (BerVarray)
3182 ch_calloc( 2, sizeof( struct berval ));
3183 ber_str2bv( si->si_provideruri, strlen( si->si_provideruri ),
3184 0, &si->si_provideruri_bv[0] );
3185 si->si_provideruri_bv[1].bv_len = 0;
3186 si->si_provideruri_bv[1].bv_val = NULL;
3187 gots |= GOT_PROVIDER;
3188 } else if ( !strncasecmp( cargv[ i ], STARTTLSSTR,
3189 sizeof(STARTTLSSTR) - 1 ) )
3191 val = cargv[ i ] + sizeof( STARTTLSSTR );
3192 if( !strcasecmp( val, CRITICALSTR ) ) {
3193 si->si_tls = SYNCINFO_TLS_CRITICAL;
3195 si->si_tls = SYNCINFO_TLS_ON;
3197 } else if ( !strncasecmp( cargv[ i ],
3198 UPDATEDNSTR, sizeof( UPDATEDNSTR ) - 1 ) )
3200 struct berval updatedn = {0, NULL};
3201 val = cargv[ i ] + sizeof( UPDATEDNSTR );
3202 ber_str2bv( val, 0, 0, &updatedn );
3203 ch_free( si->si_updatedn.bv_val );
3204 dnNormalize( 0, NULL, NULL, &updatedn, &si->si_updatedn, NULL );
3205 } else if ( !strncasecmp( cargv[ i ], BINDMETHSTR,
3206 sizeof( BINDMETHSTR ) - 1 ) )
3208 val = cargv[ i ] + sizeof( BINDMETHSTR );
3209 if ( !strcasecmp( val, SIMPLESTR )) {
3210 si->si_bindmethod = LDAP_AUTH_SIMPLE;
3212 } else if ( !strcasecmp( val, SASLSTR )) {
3213 #ifdef HAVE_CYRUS_SASL
3214 si->si_bindmethod = LDAP_AUTH_SASL;
3216 #else /* HAVE_CYRUS_SASL */
3217 fprintf( stderr, "Error: parse_syncrepl_line: "
3218 "not compiled with SASL support\n" );
3220 #endif /* HAVE_CYRUS_SASL */
3222 si->si_bindmethod = -1;
3224 } else if ( !strncasecmp( cargv[ i ],
3225 BINDDNSTR, sizeof( BINDDNSTR ) - 1 ) ) {
3226 val = cargv[ i ] + sizeof( BINDDNSTR );
3227 si->si_binddn = ch_strdup( val );
3228 } else if ( !strncasecmp( cargv[ i ],
3229 CREDSTR, sizeof( CREDSTR ) - 1 ) ) {
3230 val = cargv[ i ] + sizeof( CREDSTR );
3231 si->si_passwd = ch_strdup( val );
3232 } else if ( !strncasecmp( cargv[ i ],
3233 SASLMECHSTR, sizeof( SASLMECHSTR ) - 1 ) ) {
3234 val = cargv[ i ] + sizeof( SASLMECHSTR );
3235 si->si_saslmech = ch_strdup( val );
3236 } else if ( !strncasecmp( cargv[ i ],
3237 SECPROPSSTR, sizeof( SECPROPSSTR ) - 1 ) ) {
3238 val = cargv[ i ] + sizeof( SECPROPSSTR );
3239 si->si_secprops = ch_strdup( val );
3240 } else if ( !strncasecmp( cargv[ i ],
3241 REALMSTR, sizeof( REALMSTR ) - 1 ) ) {
3242 val = cargv[ i ] + sizeof( REALMSTR );
3243 si->si_realm = ch_strdup( val );
3244 } else if ( !strncasecmp( cargv[ i ],
3245 AUTHCSTR, sizeof( AUTHCSTR ) - 1 ) ) {
3246 val = cargv[ i ] + sizeof( AUTHCSTR );
3247 si->si_authcId = ch_strdup( val );
3248 } else if ( !strncasecmp( cargv[ i ],
3249 OLDAUTHCSTR, sizeof( OLDAUTHCSTR ) - 1 ) ) {
3250 /* Old authcID is provided for some backwards compatibility */
3251 val = cargv[ i ] + sizeof( OLDAUTHCSTR );
3252 si->si_authcId = ch_strdup( val );
3253 } else if ( !strncasecmp( cargv[ i ],
3254 AUTHZSTR, sizeof( AUTHZSTR ) - 1 ) ) {
3255 val = cargv[ i ] + sizeof( AUTHZSTR );
3256 si->si_authzId = ch_strdup( val );
3257 } else if ( !strncasecmp( cargv[ i ],
3258 SCHEMASTR, sizeof( SCHEMASTR ) - 1 ) )
3260 val = cargv[ i ] + sizeof( SCHEMASTR );
3261 if ( !strncasecmp( val, "on", STRLENOF( "on" ) )) {
3262 si->si_schemachecking = 1;
3263 } else if ( !strncasecmp( val, "off", STRLENOF( "off" ) ) ) {
3264 si->si_schemachecking = 0;
3266 si->si_schemachecking = 1;
3268 } else if ( !strncasecmp( cargv[ i ],
3269 FILTERSTR, sizeof( FILTERSTR ) - 1 ) )
3271 val = cargv[ i ] + sizeof( FILTERSTR );
3272 ber_str2bv( val, 0, 1, &si->si_filterstr );
3273 } else if ( !strncasecmp( cargv[ i ],
3274 SEARCHBASESTR, sizeof( SEARCHBASESTR ) - 1 ) )
3277 val = cargv[ i ] + sizeof( SEARCHBASESTR );
3278 if ( si->si_base.bv_val ) {
3279 ch_free( si->si_base.bv_val );
3281 ber_str2bv( val, 0, 0, &bv );
3282 if ( dnNormalize( 0, NULL, NULL, &bv, &si->si_base, NULL )) {
3283 fprintf( stderr, "Invalid base DN \"%s\"\n", val );
3286 } else if ( !strncasecmp( cargv[ i ],
3287 SCOPESTR, sizeof( SCOPESTR ) - 1 ) )
3289 val = cargv[ i ] + sizeof( SCOPESTR );
3290 if ( !strncasecmp( val, "base", STRLENOF( "base" ) )) {
3291 si->si_scope = LDAP_SCOPE_BASE;
3292 } else if ( !strncasecmp( val, "one", STRLENOF( "one" ) )) {
3293 si->si_scope = LDAP_SCOPE_ONELEVEL;
3294 #ifdef LDAP_SCOPE_SUBORDINATE
3295 } else if ( !strcasecmp( val, "subordinate" ) ||
3296 !strcasecmp( val, "children" ))
3298 si->si_scope = LDAP_SCOPE_SUBORDINATE;
3300 } else if ( !strncasecmp( val, "sub", STRLENOF( "sub" ) )) {
3301 si->si_scope = LDAP_SCOPE_SUBTREE;
3303 fprintf( stderr, "Error: parse_syncrepl_line: "
3304 "unknown scope \"%s\"\n", val);
3307 } else if ( !strncasecmp( cargv[ i ],
3308 ATTRSONLYSTR, sizeof( ATTRSONLYSTR ) - 1 ) )
3310 si->si_attrsonly = 1;
3311 } else if ( !strncasecmp( cargv[ i ],
3312 ATTRSSTR, sizeof( ATTRSSTR ) - 1 ) )
3314 val = cargv[ i ] + sizeof( ATTRSSTR );
3315 str2clist( &si->si_attrs, val, "," );
3316 } else if ( !strncasecmp( cargv[ i ],
3317 TYPESTR, sizeof( TYPESTR ) - 1 ) )
3319 val = cargv[ i ] + sizeof( TYPESTR );
3320 if ( !strncasecmp( val, "refreshOnly", STRLENOF("refreshOnly") )) {
3321 si->si_type = LDAP_SYNC_REFRESH_ONLY;
3322 } else if ( !strncasecmp( val, "refreshAndPersist",
3323 STRLENOF("refreshAndPersist") ))
3325 si->si_type = LDAP_SYNC_REFRESH_AND_PERSIST;
3326 si->si_interval = 60;
3328 fprintf( stderr, "Error: parse_syncrepl_line: "
3329 "unknown sync type \"%s\"\n", val);
3332 } else if ( !strncasecmp( cargv[ i ],
3333 INTERVALSTR, sizeof( INTERVALSTR ) - 1 ) )
3340 val = cargv[ i ] + sizeof( INTERVALSTR );
3342 hstr = strchr( dstr, ':' );
3343 if ( hstr == NULL ) {
3344 fprintf( stderr, "Error: parse_syncrepl_line: "
3345 "invalid interval \"%s\"\n", val );
3349 mstr = strchr( hstr, ':' );
3350 if ( mstr == NULL ) {
3351 fprintf( stderr, "Error: parse_syncrepl_line: "
3352 "invalid interval \"%s\"\n", val );
3356 sstr = strchr( mstr, ':' );
3357 if ( sstr == NULL ) {
3358 fprintf( stderr, "Error: parse_syncrepl_line: "
3359 "invalid interval \"%s\"\n", val );
3368 if (( hh > 24 ) || ( hh < 0 ) ||
3369 ( mm > 60 ) || ( mm < 0 ) ||
3370 ( ss > 60 ) || ( ss < 0 ) || ( dd < 0 )) {
3371 fprintf( stderr, "Error: parse_syncrepl_line: "
3372 "invalid interval \"%s\"\n", val );
3375 si->si_interval = (( dd * 24 + hh ) * 60 + mm ) * 60 + ss;
3377 if ( si->si_interval < 0 ) {
3378 fprintf( stderr, "Error: parse_syncrepl_line: "
3379 "invalid interval \"%ld\"\n",
3380 (long) si->si_interval);
3383 } else if ( !strncasecmp( cargv[ i ],
3384 MANAGEDSAITSTR, sizeof( MANAGEDSAITSTR ) - 1 ) )
3386 val = cargv[ i ] + sizeof( MANAGEDSAITSTR );
3387 si->si_manageDSAit = atoi( val );
3388 } else if ( !strncasecmp( cargv[ i ],
3389 SLIMITSTR, sizeof( SLIMITSTR ) - 1 ) )
3391 val = cargv[ i ] + sizeof( SLIMITSTR );
3392 si->si_slimit = atoi( val );
3393 } else if ( !strncasecmp( cargv[ i ],
3394 TLIMITSTR, sizeof( TLIMITSTR ) - 1 ) )
3396 val = cargv[ i ] + sizeof( TLIMITSTR );
3397 si->si_tlimit = atoi( val );
3399 fprintf( stderr, "Error: parse_syncrepl_line: "
3400 "unknown keyword \"%s\"\n", cargv[ i ] );
3404 if ( gots != GOT_ALL ) {
3406 "Error: Malformed \"syncrepl\" line in slapd config file" );
3414 str2clist( char ***out, char *in, const char *brkstr )
3423 /* find last element in list */
3424 for (i = 0; *out && *out[i]; i++);
3426 /* protect the input string from strtok */
3427 str = ch_strdup( in );
3429 if ( *str == '\0' ) {
3434 /* Count words in string */
3436 for ( s = str; *s; s++ ) {
3437 if ( strchr( brkstr, *s ) != NULL ) {
3442 *out = ch_realloc( *out, ( i + j + 1 ) * sizeof( char * ) );
3444 for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
3446 s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
3448 *new = ch_strdup( s );