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>
39 #include "slapi/slapi.h"
44 #endif /* HAVE_LIMITS_H */
47 #endif /* ! PATH_MAX */
53 * defaults for various global variables
55 slap_mask_t global_allows = 0;
56 slap_mask_t global_disallows = 0;
57 int global_gentlehup = 0;
58 int global_idletimeout = 0;
59 char *global_host = NULL;
60 char *global_realm = NULL;
61 char *ldap_srvtab = "";
62 char **default_passwd_hash = NULL;
63 struct berval default_search_base = BER_BVNULL;
64 struct berval default_search_nbase = BER_BVNULL;
66 ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
67 ber_len_t sockbuf_max_incoming_auth= SLAP_SB_MAX_INCOMING_AUTH;
69 int slap_conn_max_pending = SLAP_CONN_MAX_PENDING_DEFAULT;
70 int slap_conn_max_pending_auth = SLAP_CONN_MAX_PENDING_AUTH;
72 char *slapd_pid_file = NULL;
73 char *slapd_args_file = NULL;
75 int use_reverse_lookup = 0;
78 int slapi_plugins_used = 0;
81 static int fp_getline(FILE *fp, ConfigArgs *c);
82 static void fp_getline_init(ConfigArgs *c);
83 static int fp_parse_line(ConfigArgs *c);
85 static char *strtok_quote(char *line, char *sep, char **quote_ptr);
87 int read_config_file(const char *fname, int depth, ConfigArgs *cf);
90 new_config_args( BackendDB *be, const char *fname, int lineno, int argc, char **argv )
93 c = ch_calloc( 1, sizeof( ConfigArgs ) );
94 if ( c == NULL ) return(NULL);
100 snprintf( c->log, sizeof( c->log ), "%s: line %lu", fname, lineno );
104 ConfigTable *config_find_keyword(ConfigTable *Conf, ConfigArgs *c) {
107 for(i = 0; Conf[i].name; i++)
108 if( (Conf[i].length && (!strncasecmp(c->argv[0], Conf[i].name, Conf[i].length))) ||
109 (!strcasecmp(c->argv[0], Conf[i].name)) ) break;
110 if ( !Conf[i].name ) return NULL;
114 int config_add_vals(ConfigTable *Conf, ConfigArgs *c) {
115 int i, rc, arg_user, arg_type, iarg;
120 arg_type = Conf->arg_type;
121 if(arg_type == ARG_IGNORED) {
122 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> ignored\n",
123 c->log, Conf->name, 0);
126 if(Conf->min_args && (c->argc < Conf->min_args)) {
127 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> missing <%s> argument\n",
128 c->log, Conf->name, Conf->what);
129 return(ARG_BAD_CONF);
131 if(Conf->max_args && (c->argc > Conf->max_args)) {
132 Debug(LDAP_DEBUG_CONFIG, "%s: extra cruft after <%s> in <%s> line (ignored)\n",
133 c->log, Conf->what, Conf->name);
135 if((arg_type & ARG_DB) && !c->be) {
136 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> allowed only within database declaration\n",
137 c->log, Conf->name, 0);
138 return(ARG_BAD_CONF);
140 if((arg_type & ARG_PRE_BI) && c->bi) {
141 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> must appear before any backend %sdeclaration\n",
142 c->log, Conf->name, ((arg_type & ARG_PRE_DB)
143 ? "or database " : "") );
144 return(ARG_BAD_CONF);
146 if((arg_type & ARG_PRE_DB) && c->be && c->be != frontendDB) {
147 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> must appear before any database declaration\n",
148 c->log, Conf->name, 0);
149 return(ARG_BAD_CONF);
151 if((arg_type & ARG_PAREN) && *c->argv[1] != '(' /*')'*/) {
152 Debug(LDAP_DEBUG_CONFIG, "%s: old <%s> format not supported\n",
153 c->log, Conf->name, 0);
154 return(ARG_BAD_CONF);
156 if((arg_type & ARGS_POINTER) && !Conf->arg_item && !(arg_type & ARG_OFFSET)) {
157 Debug(LDAP_DEBUG_CONFIG, "%s: null arg_item for <%s>\n",
158 c->log, Conf->name, 0);
159 return(ARG_BAD_CONF);
161 c->type = arg_user = (arg_type & ARGS_USERLAND);
162 memset(&c->values, 0, sizeof(c->values));
163 if(arg_type & ARGS_NUMERIC) {
165 iarg = 0; larg = 0; barg = 0;
166 switch(arg_type & ARGS_NUMERIC) {
167 case ARG_INT: iarg = atoi(c->argv[1]); break;
168 case ARG_LONG: larg = strtol(c->argv[1], NULL, 0); break;
169 case ARG_BER_LEN_T: barg = (ber_len_t)atol(c->argv[1]); break;
173 } else if(!strcasecmp(c->argv[1], "on") ||
174 !strcasecmp(c->argv[1], "true")) {
176 } else if(!strcasecmp(c->argv[1], "off") ||
177 !strcasecmp(c->argv[1], "false")) {
180 Debug(LDAP_DEBUG_CONFIG, "%s: ignoring ", c->log, 0, 0);
181 Debug(LDAP_DEBUG_CONFIG, "invalid %s value (%s) in <%s> line\n",
182 Conf->what, c->argv[1], Conf->name);
187 j = (arg_type & ARG_NONZERO) ? 1 : 0;
188 if(iarg < j || larg < j || barg < j ) {
189 larg = larg ? larg : (barg ? barg : iarg);
190 Debug(LDAP_DEBUG_CONFIG, "%s: " , c->log, 0, 0);
191 Debug(LDAP_DEBUG_CONFIG, "invalid %s value (%ld) in <%s> line\n", Conf->what, larg, Conf->name);
192 return(ARG_BAD_CONF);
194 switch(arg_type & ARGS_NUMERIC) {
196 case ARG_INT: c->value_int = iarg; break;
197 case ARG_LONG: c->value_long = larg; break;
198 case ARG_BER_LEN_T: c->value_ber_t = barg; break;
200 } else if(arg_type & ARG_STRING) {
201 c->value_string = ch_strdup(c->argv[1]);
202 } else if(arg_type & ARG_BERVAL) {
203 ber_str2bv( c->argv[1], 0, 1, &c->value_bv );
204 } else if(arg_type & ARG_DN) {
206 ber_str2bv( c->argv[1], 0, 0, &bv );
207 rc = dnPrettyNormal( NULL, &bv, &c->value_dn, &c->value_ndn, NULL );
208 if ( rc != LDAP_SUCCESS ) {
209 Debug(LDAP_DEBUG_CONFIG, "%s: " , c->log, 0, 0);
210 Debug(LDAP_DEBUG_CONFIG, "%s DN is invalid %d (%s)\n",
211 Conf->name, rc, ldap_err2string( rc ));
212 return(ARG_BAD_CONF);
215 if(arg_type & ARG_MAGIC) {
216 if(!c->be) c->be = frontendDB;
217 rc = (*((ConfigDriver*)Conf->arg_item))(c);
218 if(c->be == frontendDB) c->be = NULL;
220 Debug(LDAP_DEBUG_CONFIG, "%s: handler for <%s> exited with %d!\n",
221 c->log, Conf->name, rc);
222 return(ARG_BAD_CONF);
226 if(arg_type & ARG_OFFSET) {
228 ptr = c->be->be_private;
230 ptr = c->bi->bi_private;
232 Debug(LDAP_DEBUG_CONFIG, "%s: offset for <%s> missing base pointer!\n",
233 c->log, Conf->name, 0);
234 return(ARG_BAD_CONF);
236 ptr = (void *)((char *)ptr + (int)Conf->arg_item);
237 } else if (arg_type & ARGS_POINTER) {
238 ptr = Conf->arg_item;
240 if(arg_type & ARGS_POINTER)
241 switch(arg_type & ARGS_POINTER) {
243 case ARG_INT: *(int*)ptr = iarg; break;
244 case ARG_LONG: *(long*)ptr = larg; break;
245 case ARG_BER_LEN_T: *(ber_len_t*)ptr = barg; break;
247 char *cc = *(char**)ptr;
249 if (arg_type & ARG_UNIQUE) {
250 Debug(LDAP_DEBUG_CONFIG, "%s: already set %s!\n",
251 c->log, Conf->name, 0 );
252 return(ARG_BAD_CONF);
254 ch_free(cc); /* potential memory leak */
256 *(char **)ptr = c->value_string;
260 *(struct berval *)ptr = c->value_bv;
267 config_del_vals(ConfigTable *cf, ConfigArgs *c)
273 config_get_vals(ConfigTable *cf, ConfigArgs *c)
279 if ( cf->arg_type & ARG_IGNORED ) {
283 memset(&c->values, 0, sizeof(c->values));
284 c->rvalue_vals = NULL;
285 c->rvalue_nvals = NULL;
286 c->op = SLAP_CONFIG_EMIT;
287 c->type = cf->arg_type & ARGS_USERLAND;
289 if ( cf->arg_type & ARG_MAGIC ) {
290 rc = (*((ConfigDriver*)cf->arg_item))(c);
293 if ( cf->arg_type & ARG_OFFSET ) {
295 ptr = c->be->be_private;
297 ptr = c->bi->bi_private;
300 ptr = (void *)((char *)ptr + (int)cf->arg_item);
305 switch(cf->arg_type & ARGS_POINTER) {
307 case ARG_INT: c->value_int = *(int *)ptr; break;
308 case ARG_LONG: c->value_long = *(long *)ptr; break;
309 case ARG_BER_LEN_T: c->value_ber_t = *(ber_len_t *)ptr; break;
312 c->value_string = ch_strdup(*(char **)ptr);
315 ber_dupbv( &c->value_bv, (struct berval *)ptr ); break;
318 if ( cf->arg_type & ARGS_POINTER) {
320 switch(cf->arg_type & ARGS_POINTER) {
321 case ARG_INT: bv.bv_len = sprintf(bv.bv_val, "%d", c->value_int); break;
322 case ARG_LONG: bv.bv_len = sprintf(bv.bv_val, "%ld", c->value_long); break;
323 case ARG_BER_LEN_T: bv.bv_len = sprintf(bv.bv_val, "%ld", c->value_ber_t); break;
324 case ARG_ON_OFF: bv.bv_len = sprintf(bv.bv_val, "%s",
325 c->value_int ? "TRUE" : "FALSE"); break;
327 if ( c->value_string && c->value_string[0]) {
328 ber_str2bv( c->value_string, 0, 0, &bv);
334 if ( !BER_BVISEMPTY( &c->value_bv )) {
341 if (( cf->arg_type & ARGS_POINTER ) == ARG_STRING )
342 ber_bvarray_add(&c->rvalue_vals, &bv);
344 value_add_one(&c->rvalue_vals, &bv);
350 init_config_attrs(ConfigTable *ct) {
351 LDAPAttributeType *at;
355 for (i=0; ct[i].name; i++ ) {
356 if ( !ct[i].attribute ) continue;
357 at = ldap_str2attributetype( ct[i].attribute,
358 &code, &err, LDAP_SCHEMA_ALLOW_ALL );
360 fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
361 ct[i].attribute, ldap_scherr2str(code), err );
364 code = at_add( at, &err );
365 if ( code && code != SLAP_SCHERR_ATTR_DUP ) {
366 fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
367 ct[i].attribute, scherr2str(code), err );
370 code = slap_str2ad( at->at_names[0], &ct[i].ad, &err );
372 fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s\n",
373 ct[i].attribute, err );
383 init_config_ocs( ConfigOCs *ocs ) {
386 for (i=0;ocs[i].def;i++) {
391 oc = ldap_str2objectclass( ocs[i].def, &code, &err,
392 LDAP_SCHEMA_ALLOW_ALL );
394 fprintf( stderr, "init_config_ocs: objectclass \"%s\": %s, %s\n",
395 ocs[i].def, ldap_scherr2str(code), err );
398 code = oc_add(oc,0,&err);
399 if ( code && code != SLAP_SCHERR_CLASS_DUP ) {
400 fprintf( stderr, "init_config_ocs: objectclass \"%s\": %s, %s\n",
401 ocs[i].def, scherr2str(code), err );
405 *ocs[i].oc = oc_find(oc->oc_names[0]);
413 read_config_file(const char *fname, int depth, ConfigArgs *cf)
420 c = ch_calloc( 1, sizeof( ConfigArgs ) );
426 memcpy( c, cf, sizeof( ConfigArgs ) );
428 c->depth = depth; /* XXX */
434 c->argv = ch_calloc( ARGS_STEP + 1, sizeof( *c->argv ) );
435 c->argv_size = ARGS_STEP + 1;
437 fp = fopen( fname, "r" );
440 Debug(LDAP_DEBUG_ANY,
441 "could not open config file \"%s\": %s (%d)\n",
442 fname, strerror(errno), errno);
446 Debug(LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0);
450 while ( fp_getline( fp, c ) ) {
451 /* skip comments and blank lines */
452 if ( c->line[0] == '#' || c->line[0] == '\0' ) {
456 snprintf( c->log, sizeof( c->log ), "%s: line %lu",
457 c->fname, c->lineno );
460 if ( fp_parse_line( c ) ) {
465 Debug(LDAP_DEBUG_CONFIG, "%s: bad config line (ignored)\n", c->log, 0, 0);
469 c->op = LDAP_MOD_ADD;
471 ct = config_find_keyword( config_back_cf_table, c );
473 rc = config_add_vals( ct, c );
476 if ( rc & ARGS_USERLAND ) {
477 /* XXX a usertype would be opaque here */
478 Debug(LDAP_DEBUG_CONFIG, "%s: unknown user type <%s>\n",
479 c->log, c->argv[0], 0);
482 } else if ( rc == ARG_BAD_CONF ) {
486 } else if ( c->bi ) {
487 rc = SLAP_CONF_UNKNOWN;
488 if ( c->bi->bi_cf_table ) {
489 ct = config_find_keyword( c->bi->bi_cf_table, c );
491 rc = config_add_vals( ct, c );
494 if ( c->bi->bi_config && rc == SLAP_CONF_UNKNOWN ) {
495 rc = (*c->bi->bi_config)(c->bi, c->fname, c->lineno,
500 case SLAP_CONF_UNKNOWN:
501 Debug(LDAP_DEBUG_CONFIG, "%s: "
502 "unknown directive <%s> inside backend info definition (ignored)\n",
503 c->log, *c->argv, 0);
510 } else if ( c->be ) {
511 rc = SLAP_CONF_UNKNOWN;
512 if ( c->be->be_cf_table ) {
513 ct = config_find_keyword( c->be->be_cf_table, c );
515 rc = config_add_vals( ct, c );
518 if ( c->be->be_config && rc == SLAP_CONF_UNKNOWN ) {
519 rc = (*c->be->be_config)(c->be, c->fname, c->lineno,
524 case SLAP_CONF_UNKNOWN:
525 Debug( LDAP_DEBUG_CONFIG, "%s: "
526 "unknown directive <%s> inside backend database "
527 "definition (ignored)\n",
528 c->log, *c->argv, 0);
535 } else if ( frontendDB->be_config ) {
536 rc = (*frontendDB->be_config)(frontendDB, c->fname, (int)c->lineno, c->argc, c->argv);
539 case SLAP_CONF_UNKNOWN:
540 Debug( LDAP_DEBUG_CONFIG, "%s: "
541 "unknown directive <%s> inside global database definition (ignored)\n",
542 c->log, *c->argv, 0);
550 Debug(LDAP_DEBUG_CONFIG, "%s: "
551 "unknown directive <%s> outside backend info and database definitions (ignored)\n",
552 c->log, *c->argv, 0);
560 if ( BER_BVISNULL( &frontendDB->be_schemadn ) ) {
561 ber_str2bv( SLAPD_SCHEMA_DN, STRLENOF( SLAPD_SCHEMA_DN ), 1,
562 &frontendDB->be_schemadn );
563 rc = dnNormalize( 0, NULL, NULL, &frontendDB->be_schemadn, &frontendDB->be_schemandn, NULL );
564 if ( rc != LDAP_SUCCESS ) {
565 Debug(LDAP_DEBUG_ANY, "%s: "
566 "unable to normalize default schema DN \"%s\"\n",
567 c->log, frontendDB->be_schemadn.bv_val, 0 );
568 /* must not happen */
584 /* restrictops, allows, disallows, requires, loglevel */
587 verb_to_mask(const char *word, slap_verbmasks *v) {
589 for(i = 0; !BER_BVISNULL(&v[i].word); i++)
590 if(!strcasecmp(word, v[i].word.bv_val))
596 verbs_to_mask(int argc, char *argv[], slap_verbmasks *v, slap_mask_t *m) {
598 for(i = 1; i < argc; i++) {
599 j = verb_to_mask(argv[i], v);
600 if(BER_BVISNULL(&v[j].word)) return(1);
601 while (!v[j].mask) j--;
608 mask_to_verbs(slap_verbmasks *v, slap_mask_t m, BerVarray *bva) {
613 for (i=0; !BER_BVISNULL(&v[i].word); i++) {
614 if (!v[i].mask) continue;
615 if (( m & v[i].mask ) == v[i].mask ) {
616 value_add_one( bva, &v[i].word );
622 static slap_verbmasks tlskey[] = {
623 { BER_BVC("no"), SB_TLS_OFF },
624 { BER_BVC("yes"), SB_TLS_ON },
625 { BER_BVC("critical"), SB_TLS_CRITICAL },
629 static slap_verbmasks methkey[] = {
630 { BER_BVC("simple"), LDAP_AUTH_SIMPLE },
631 #ifdef HAVE_CYRUS_SASL
632 { BER_BVC("sasl"), LDAP_AUTH_SASL },
637 typedef struct cf_aux_table {
644 static cf_aux_table bindkey[] = {
645 { BER_BVC("starttls="), offsetof(slap_bindconf, sb_tls), 0, tlskey },
646 { BER_BVC("bindmethod="), offsetof(slap_bindconf, sb_method), 0, methkey },
647 { BER_BVC("binddn="), offsetof(slap_bindconf, sb_binddn), 1, NULL },
648 { BER_BVC("credentials="), offsetof(slap_bindconf, sb_cred), 1, NULL },
649 { BER_BVC("saslmech="), offsetof(slap_bindconf, sb_saslmech), 0, NULL },
650 { BER_BVC("secprops="), offsetof(slap_bindconf, sb_secprops), 0, NULL },
651 { BER_BVC("realm="), offsetof(slap_bindconf, sb_realm), 0, NULL },
652 { BER_BVC("authcID="), offsetof(slap_bindconf, sb_authcId), 0, NULL },
653 { BER_BVC("authzID="), offsetof(slap_bindconf, sb_authzId), 1, NULL },
654 { BER_BVNULL, 0, 0, NULL }
657 int bindconf_parse( const char *word, slap_bindconf *bc ) {
662 for (tab = bindkey; !BER_BVISNULL(&tab->key); tab++) {
663 if ( !strncasecmp( word, tab->key.bv_val, tab->key.bv_len )) {
664 cptr = (char **)((char *)bc + tab->off);
668 for (j=0; !BER_BVISNULL(&tab->aux[j].word); j++) {
669 if (!strcasecmp(word+tab->key.bv_len, tab->aux[j].word.bv_val)) {
670 int *ptr = (int *)cptr;
671 *ptr = tab->aux[j].mask;
676 Debug(LDAP_DEBUG_ANY, "invalid bind config value %s\n",
681 *cptr = ch_strdup(word+tab->key.bv_len);
688 int bindconf_unparse( slap_bindconf *bc, struct berval *bv ) {
689 char buf[BUFSIZ], *ptr;
695 for (tab = bindkey; !BER_BVISNULL(&tab->key); tab++) {
696 cptr = (char **)((char *)bc + tab->off);
698 int *ip = (int *)cptr, i;
699 for ( i=0; !BER_BVISNULL(&tab->aux[i].word); i++ ) {
700 if ( *ip == tab->aux[i].mask ) {
702 ptr = lutil_strcopy( ptr, tab->key.bv_val );
703 ptr = lutil_strcopy( ptr, tab->aux[i].word.bv_val );
707 } else if ( *cptr ) {
709 ptr = lutil_strcopy( ptr, tab->key.bv_val );
710 if ( tab->quote ) *ptr++ = '"';
711 ptr = lutil_strcopy( ptr, *cptr );
712 if ( tab->quote ) *ptr++ = '"';
716 tmp.bv_len = ptr - buf;
717 ber_dupbv( bv, &tmp );
721 void bindconf_free( slap_bindconf *bc ) {
722 if ( bc->sb_binddn ) {
723 ch_free( bc->sb_binddn );
726 ch_free( bc->sb_cred );
728 if ( bc->sb_saslmech ) {
729 ch_free( bc->sb_saslmech );
731 if ( bc->sb_secprops ) {
732 ch_free( bc->sb_secprops );
734 if ( bc->sb_realm ) {
735 ch_free( bc->sb_realm );
737 if ( bc->sb_authcId ) {
738 ch_free( bc->sb_authcId );
740 if ( bc->sb_authzId ) {
741 ch_free( bc->sb_authzId );
746 /* -------------------------------------- */
750 strtok_quote( char *line, char *sep, char **quote_ptr )
757 if ( line != NULL ) {
760 while ( *next && strchr( sep, *next ) ) {
764 if ( *next == '\0' ) {
770 for ( inquote = 0; *next; ) {
778 AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
784 next + 1, strlen( next + 1 ) + 1 );
785 next++; /* dont parse the escaped character */
790 if ( strchr( sep, *next ) != NULL ) {
804 static char buf[BUFSIZ];
806 static size_t lmax, lcur;
808 #define CATLINE( buf ) \
810 size_t len = strlen( buf ); \
811 while ( lcur + len + 1 > lmax ) { \
813 line = (char *) ch_realloc( line, lmax ); \
815 strcpy( line + lcur, buf ); \
820 fp_getline_init(ConfigArgs *c) {
826 fp_getline( FILE *fp, ConfigArgs *c )
834 /* avoid stack of bufs */
835 if ( strncasecmp( line, "include", STRLENOF( "include" ) ) == 0 ) {
841 while ( fgets( buf, sizeof( buf ), fp ) ) {
842 p = strchr( buf, '\n' );
844 if ( p > buf && p[-1] == '\r' ) {
852 && ( p = line + strlen( line ) - 1 )[0] == '\\'
859 if ( !isspace( (unsigned char)buf[0] ) ) {
870 return(line[0] ? 1 : 0);
874 fp_parse_line(ConfigArgs *c)
877 char *tline = ch_strdup(c->line);
878 char *hide[] = { "rootpw", "replica", "bindpw", "pseudorootpw", "dbpasswd", '\0' };
882 token = strtok_quote(tline, " \t", "e_ptr);
884 if(token) for(i = 0; hide[i]; i++) if(!strcasecmp(token, hide[i])) break;
885 if(quote_ptr) *quote_ptr = ' ';
886 Debug(LDAP_DEBUG_CONFIG, "line %lu (%s%s)\n", c->lineno,
887 hide[i] ? hide[i] : c->line, hide[i] ? " ***" : "");
888 if(quote_ptr) *quote_ptr = '\0';
890 for(; token; token = strtok_quote(NULL, " \t", "e_ptr)) {
891 if(c->argc == c->argv_size - 1) {
893 tmp = ch_realloc(c->argv, (c->argv_size + ARGS_STEP) * sizeof(*c->argv));
895 Debug(LDAP_DEBUG_ANY, "line %lu: out of memory\n", c->lineno, 0, 0);
899 c->argv_size += ARGS_STEP;
901 c->argv[c->argc++] = token;
903 c->argv[c->argc] = NULL;
910 ucdata_unload( UCDATA_ALL );
912 /* NOTE: in case of early exit, frontendDB can be NULL */
913 if ( frontendDB->be_schemandn.bv_val )
914 free( frontendDB->be_schemandn.bv_val );
915 if ( frontendDB->be_schemadn.bv_val )
916 free( frontendDB->be_schemadn.bv_val );
917 if ( frontendDB->be_acl )
918 acl_destroy( frontendDB->be_acl, NULL );
921 if ( slapd_args_file )
922 free ( slapd_args_file );
923 if ( slapd_pid_file )
924 free ( slapd_pid_file );
925 if ( default_passwd_hash )
926 ldap_charray_free( default_passwd_hash );
930 slap_str2clist( char ***out, char *in, const char *brkstr )
938 /* find last element in list */
939 for (i = 0; *out && (*out)[i]; i++);
941 /* protect the input string from strtok */
942 str = ch_strdup( in );
944 if ( *str == '\0' ) {
949 /* Count words in string */
951 for ( s = str; *s; s++ ) {
952 if ( strchr( brkstr, *s ) != NULL ) {
957 *out = ch_realloc( *out, ( i + j + 1 ) * sizeof( char * ) );
959 for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
961 s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
963 *new = ch_strdup( s );
972 int config_generic_wrapper( Backend *be, const char *fname, int lineno,
973 int argc, char **argv )
975 ConfigArgs c = { 0 };
984 sprintf( c.log, "%s: line %lu", fname, lineno );
986 rc = SLAP_CONF_UNKNOWN;
987 ct = config_find_keyword( be->be_cf_table, &c );
989 rc = config_add_vals( ct, &c );