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 char *strtok_quote_ptr;
77 int use_reverse_lookup = 0;
80 int slapi_plugins_used = 0;
83 static int fp_getline(FILE *fp, ConfigArgs *c);
84 static void fp_getline_init(ConfigArgs *c);
85 static int fp_parse_line(ConfigArgs *c);
87 static char *strtok_quote(char *line, char *sep);
89 int read_config_file(const char *fname, int depth, ConfigArgs *cf);
92 new_config_args( BackendDB *be, const char *fname, int lineno, int argc, char **argv )
95 c = ch_calloc( 1, sizeof( ConfigArgs ) );
96 if ( c == NULL ) return(NULL);
102 snprintf( c->log, sizeof( c->log ), "%s: line %lu", fname, lineno );
106 int parse_config_table(ConfigTable *Conf, ConfigArgs *c) {
107 int i, rc, arg_user, arg_type, iarg;
112 for(i = 0; Conf[i].name; i++)
113 if( (Conf[i].length && (!strncasecmp(c->argv[0], Conf[i].name, Conf[i].length))) ||
114 (!strcasecmp(c->argv[0], Conf[i].name)) ) break;
115 if(!Conf[i].name) return(ARG_UNKNOWN);
116 arg_type = Conf[i].arg_type;
117 if(arg_type == ARG_IGNORED) {
118 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> ignored\n",
119 c->log, Conf[i].name, 0);
122 if(Conf[i].min_args && (c->argc < Conf[i].min_args)) {
123 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> missing <%s> argument\n",
124 c->log, Conf[i].name, Conf[i].what);
125 return(ARG_BAD_CONF);
127 if(Conf[i].max_args && (c->argc > Conf[i].max_args)) {
128 Debug(LDAP_DEBUG_CONFIG, "%s: extra cruft after <%s> in <%s> line (ignored)\n",
129 c->log, Conf[i].what, Conf[i].name);
131 if((arg_type & ARG_DB) && !c->be) {
132 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> allowed only within database declaration\n",
133 c->log, Conf[i].name, 0);
134 return(ARG_BAD_CONF);
136 if((arg_type & ARG_PRE_BI) && c->bi) {
137 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> must appear before any backend %sdeclaration\n",
138 c->log, Conf[i].name, ((arg_type & ARG_PRE_DB)
139 ? "or database " : "") );
140 return(ARG_BAD_CONF);
142 if((arg_type & ARG_PRE_DB) && c->be && c->be != frontendDB) {
143 Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> must appear before any database declaration\n",
144 c->log, Conf[i].name, 0);
145 return(ARG_BAD_CONF);
147 if((arg_type & ARG_PAREN) && *c->argv[1] != '(' /*')'*/) {
148 Debug(LDAP_DEBUG_CONFIG, "%s: old <%s> format not supported\n",
149 c->log, Conf[i].name, 0);
150 return(ARG_BAD_CONF);
152 if((arg_type & ARGS_POINTER) && !Conf[i].arg_item) {
153 Debug(LDAP_DEBUG_CONFIG, "%s: null arg_item for <%s>\n",
154 c->log, Conf[i].name, 0);
155 return(ARG_BAD_CONF);
157 c->type = arg_user = (arg_type & ARGS_USERLAND);
158 memset(&c->values, 0, sizeof(c->values));
159 if(arg_type & ARGS_NUMERIC) {
161 iarg = 0; larg = 0; barg = 0;
162 switch(arg_type & ARGS_NUMERIC) {
163 case ARG_INT: iarg = atoi(c->argv[1]); break;
164 case ARG_LONG: larg = strtol(c->argv[1], NULL, 0); break;
165 case ARG_BER_LEN_T: barg = (ber_len_t)atol(c->argv[1]); break;
169 } else if(!strcasecmp(c->argv[1], "on") ||
170 !strcasecmp(c->argv[1], "true")) {
172 } else if(!strcasecmp(c->argv[1], "off") ||
173 !strcasecmp(c->argv[1], "false")) {
176 Debug(LDAP_DEBUG_CONFIG, "%s: ignoring ", c->log, 0, 0);
177 Debug(LDAP_DEBUG_CONFIG, "invalid %s value (%s) in <%s> line\n",
178 Conf[i].what, c->argv[1], Conf[i].name);
183 j = (arg_type & ARG_NONZERO) ? 1 : 0;
184 if(iarg < j || larg < j || barg < j ) {
185 larg = larg ? larg : (barg ? barg : iarg);
186 Debug(LDAP_DEBUG_CONFIG, "%s: " , c->log, 0, 0);
187 Debug(LDAP_DEBUG_CONFIG, "invalid %s value (%ld) in <%s> line\n", Conf[i].what, larg, Conf[i].name);
188 return(ARG_BAD_CONF);
190 switch(arg_type & ARGS_NUMERIC) {
192 case ARG_INT: c->value_int = iarg; break;
193 case ARG_LONG: c->value_long = larg; break;
194 case ARG_BER_LEN_T: c->value_ber_t = barg; break;
196 } else if(arg_type & ARG_STRING) {
197 c->value_string = ch_strdup(c->argv[1]);
198 } else if(arg_type & ARG_DN) {
200 ber_str2bv( c->argv[1], 0, 0, &bv );
201 rc = dnPrettyNormal( NULL, &bv, &c->value_dn, &c->value_ndn, NULL );
202 if ( rc != LDAP_SUCCESS ) {
203 Debug(LDAP_DEBUG_CONFIG, "%s: " , c->log, 0, 0);
204 Debug(LDAP_DEBUG_CONFIG, "%s DN is invalid %d (%s)\n",
205 Conf[i].name, rc, ldap_err2string( rc ));
206 return(ARG_BAD_CONF);
209 if(arg_type & ARG_MAGIC) {
210 if(!c->be) c->be = frontendDB;
211 rc = (*((ConfigDriver*)Conf[i].arg_item))(c);
212 if(c->be == frontendDB) c->be = NULL;
214 Debug(LDAP_DEBUG_CONFIG, "%s: handler for <%s> exited with %d!",
215 c->log, Conf[i].name, rc);
216 return(ARG_BAD_CONF);
220 if(arg_type & ARG_OFFSET) {
222 ptr = c->be->be_private;
224 ptr = c->bi->bi_private;
226 Debug(LDAP_DEBUG_CONFIG, "%s: offset for <%s> missing base pointer!",
227 c->log, Conf[i].name, 0);
228 return(ARG_BAD_CONF);
230 ptr = (void *)((char *)ptr + (int)Conf[i].arg_item);
231 } else if (arg_type & ARGS_POINTER) {
232 ptr = Conf[i].arg_item;
234 if(arg_type & ARGS_POINTER) switch(arg_type & ARGS_POINTER) {
236 case ARG_INT: *(int*)ptr = iarg; break;
237 case ARG_LONG: *(long*)ptr = larg; break;
238 case ARG_BER_LEN_T: *(ber_len_t*)ptr = barg; break;
240 char *cc = *(char**)ptr;
242 if (arg_type & ARG_UNIQUE) {
243 Debug(LDAP_DEBUG_CONFIG, "%s: already set %s!\n",
244 c->log, Conf[i].name, 0 );
245 return(ARG_BAD_CONF);
247 ch_free(cc); /* potential memory leak */
249 *(char **)ptr = c->value_string;
257 config_get_vals(ConfigTable *cf, ConfigArgs *c)
263 if ( cf->arg_type & ARG_IGNORED ) {
267 memset(&c->values, 0, sizeof(c->values));
268 c->rvalue_vals = NULL;
269 c->rvalue_nvals = NULL;
271 c->type = cf->arg_type & ARGS_USERLAND;
273 if ( cf->arg_type & ARG_MAGIC ) {
274 rc = (*((ConfigDriver*)cf->arg_item))(c);
277 if ( cf->arg_type & ARG_OFFSET ) {
279 ptr = c->be->be_private;
281 ptr = c->bi->bi_private;
284 ptr = (void *)((char *)ptr + (int)cf->arg_item);
289 switch(cf->arg_type & ARGS_POINTER) {
291 case ARG_INT: c->value_int = *(int *)ptr; break;
292 case ARG_LONG: c->value_long = *(long *)ptr; break;
293 case ARG_BER_LEN_T: c->value_ber_t = *(ber_len_t *)ptr; break;
296 c->value_string = ch_strdup(*(char **)ptr);
300 if ( cf->arg_type & ARGS_POINTER) {
302 switch(cf->arg_type & ARGS_POINTER) {
303 case ARG_INT: bv.bv_len = sprintf(bv.bv_val, "%d", c->value_int); break;
304 case ARG_LONG: bv.bv_len = sprintf(bv.bv_val, "%l", c->value_long); break;
305 case ARG_BER_LEN_T: bv.bv_len =sprintf(bv.bv_val, "%l",c->value_ber_t); break;
306 case ARG_ON_OFF: bv.bv_len = sprintf(bv.bv_val, "%s",
307 c->value_int ? "TRUE" : "FALSE"); break;
309 if ( c->value_string && c->value_string[0]) {
310 ber_str2bv( c->value_string, 0, 0, &bv);
316 if (( cf->arg_type & ARGS_POINTER ) == ARG_STRING )
317 ber_bvarray_add(&c->rvalue_vals, &bv);
319 value_add_one(&c->rvalue_vals, &bv);
325 init_config_attrs(ConfigTable *ct) {
326 LDAPAttributeType *at;
330 for (i=0; ct[i].name; i++ ) {
331 if ( !ct[i].attribute ) continue;
332 at = ldap_str2attributetype( ct[i].attribute,
333 &code, &err, LDAP_SCHEMA_ALLOW_ALL );
335 fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
336 ct[i].attribute, ldap_scherr2str(code), err );
339 code = at_add( at, &err );
340 if ( code && code != SLAP_SCHERR_ATTR_DUP ) {
341 fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
342 ct[i].attribute, scherr2str(code), err );
345 code = slap_str2ad( at->at_names[0], &ct[i].ad, &err );
347 fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s\n",
348 ct[i].attribute, err );
358 init_config_ocs( ConfigOCs *ocs ) {
361 for (i=0;ocs[i].def;i++) {
366 oc = ldap_str2objectclass( ocs[i].def, &code, &err,
367 LDAP_SCHEMA_ALLOW_ALL );
369 fprintf( stderr, "init_config_ocs: objectclass \"%s\": %s, %s\n",
370 ocs[i].def, ldap_scherr2str(code), err );
373 code = oc_add(oc,0,&err);
374 if ( code && code != SLAP_SCHERR_CLASS_DUP ) {
375 fprintf( stderr, "init_config_ocs: objectclass \"%s\": %s, %s\n",
376 ocs[i].def, scherr2str(code), err );
380 *ocs[i].oc = oc_find(oc->oc_names[0]);
388 read_config_file(const char *fname, int depth, ConfigArgs *cf)
394 c = ch_calloc( 1, sizeof( ConfigArgs ) );
400 memcpy( c, cf, sizeof( ConfigArgs ) );
402 c->depth = depth; /* XXX */
408 c->argv = ch_calloc( ARGS_STEP + 1, sizeof( *c->argv ) );
409 c->argv_size = ARGS_STEP + 1;
411 fp = fopen( fname, "r" );
414 Debug(LDAP_DEBUG_ANY,
415 "could not open config file \"%s\": %s (%d)\n",
416 fname, strerror(errno), errno);
420 Debug(LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0);
424 while ( fp_getline( fp, c ) ) {
425 /* skip comments and blank lines */
426 if ( c->line[0] == '#' || c->line[0] == '\0' ) {
430 snprintf( c->log, sizeof( c->log ), "%s: line %lu",
431 c->fname, c->lineno );
433 if ( fp_parse_line( c ) ) {
438 Debug(LDAP_DEBUG_CONFIG, "%s: bad config line (ignored)\n", c->log, 0, 0);
442 rc = parse_config_table( config_back_cf_table, c );
446 if ( rc & ARGS_USERLAND ) {
447 switch(rc) { /* XXX a usertype would be opaque here */
449 Debug(LDAP_DEBUG_CONFIG, "%s: unknown user type <%d>\n",
450 c->log, *c->argv, 0);
454 } else if ( rc == ARG_BAD_CONF || rc != ARG_UNKNOWN ) {
457 } else if ( c->bi && c->bi->bi_config ) { /* XXX to check: could both be/bi_config? oops */
458 rc = (*c->bi->bi_config)(c->bi, c->fname, c->lineno, c->argc, c->argv);
461 case SLAP_CONF_UNKNOWN:
462 Debug(LDAP_DEBUG_CONFIG, "%s: "
463 "unknown directive <%s> inside backend info definition (ignored)\n",
464 c->log, *c->argv, 0);
471 } else if ( c->be ) {
472 if ( c->be->be_cf_table ) {
473 rc = parse_config_table( c->be->be_cf_table, c );
477 if ( rc != ARG_UNKNOWN ) goto badline;
480 if ( c->be->be_config ) {
481 rc = (*c->be->be_config)(c->be, c->fname, c->lineno,
485 case SLAP_CONF_UNKNOWN:
486 Debug( LDAP_DEBUG_CONFIG, "%s: "
487 "unknown directive <%s> inside backend database "
488 "definition (ignored)\n",
489 c->log, *c->argv, 0);
497 } else if ( frontendDB->be_config ) {
498 rc = (*frontendDB->be_config)(frontendDB, c->fname, (int)c->lineno, c->argc, c->argv);
501 case SLAP_CONF_UNKNOWN:
502 Debug( LDAP_DEBUG_CONFIG, "%s: "
503 "unknown directive <%s> inside global database definition (ignored)\n",
504 c->log, *c->argv, 0);
512 Debug(LDAP_DEBUG_CONFIG, "%s: "
513 "unknown directive <%s> outside backend info and database definitions (ignored)\n",
514 c->log, *c->argv, 0);
522 if ( BER_BVISNULL( &frontendDB->be_schemadn ) ) {
523 ber_str2bv( SLAPD_SCHEMA_DN, STRLENOF( SLAPD_SCHEMA_DN ), 1,
524 &frontendDB->be_schemadn );
525 rc = dnNormalize( 0, NULL, NULL, &frontendDB->be_schemadn, &frontendDB->be_schemandn, NULL );
526 if ( rc != LDAP_SUCCESS ) {
527 Debug(LDAP_DEBUG_ANY, "%s: "
528 "unable to normalize default schema DN \"%s\"\n",
529 c->log, frontendDB->be_schemadn.bv_val, 0 );
530 /* must not happen */
546 /* restrictops, allows, disallows, requires, loglevel */
549 verb_to_mask(const char *word, slap_verbmasks *v) {
551 for(i = 0; !BER_BVISNULL(&v[i].word); i++)
552 if(!strcasecmp(word, v[i].word.bv_val))
558 verbs_to_mask(int argc, char *argv[], slap_verbmasks *v, slap_mask_t *m) {
560 for(i = 1; i < argc; i++) {
561 j = verb_to_mask(argv[i], v);
562 if(BER_BVISNULL(&v[j].word)) return(1);
563 while (!v[j].mask) j--;
570 mask_to_verbs(slap_verbmasks *v, slap_mask_t m, BerVarray *bva) {
575 for (i=0; !BER_BVISNULL(&v[i].word); i++) {
576 if (!v[i].mask) continue;
577 if (( m & v[i].mask ) == v[i].mask ) {
578 value_add_one( bva, &v[i].word );
584 static slap_verbmasks tlskey[] = {
585 { BER_BVC("no"), SB_TLS_OFF },
586 { BER_BVC("yes"), SB_TLS_ON },
587 { BER_BVC("critical"), SB_TLS_CRITICAL },
591 static slap_verbmasks methkey[] = {
592 { BER_BVC("simple"), LDAP_AUTH_SIMPLE },
593 #ifdef HAVE_CYRUS_SASL
594 { BER_BVC("sasl"), LDAP_AUTH_SASL },
599 typedef struct cf_aux_table {
606 static cf_aux_table bindkey[] = {
607 { BER_BVC("starttls="), offsetof(slap_bindconf, sb_tls), 0, tlskey },
608 { BER_BVC("bindmethod="), offsetof(slap_bindconf, sb_method), 0, methkey },
609 { BER_BVC("binddn="), offsetof(slap_bindconf, sb_binddn), 1, NULL },
610 { BER_BVC("credentials="), offsetof(slap_bindconf, sb_cred), 1, NULL },
611 { BER_BVC("saslmech="), offsetof(slap_bindconf, sb_saslmech), 0, NULL },
612 { BER_BVC("secprops="), offsetof(slap_bindconf, sb_secprops), 0, NULL },
613 { BER_BVC("realm="), offsetof(slap_bindconf, sb_realm), 0, NULL },
614 { BER_BVC("authcID="), offsetof(slap_bindconf, sb_authcId), 0, NULL },
615 { BER_BVC("authzID="), offsetof(slap_bindconf, sb_authzId), 1, NULL },
616 { BER_BVNULL, 0, 0, NULL }
619 int bindconf_parse( const char *word, slap_bindconf *bc ) {
624 for (tab = bindkey; !BER_BVISNULL(&tab->key); tab++) {
625 if ( !strncasecmp( word, tab->key.bv_val, tab->key.bv_len )) {
626 cptr = (char **)((char *)bc + tab->off);
630 for (j=0; !BER_BVISNULL(&tab->aux[j].word); j++) {
631 if (!strcasecmp(word+tab->key.bv_len, tab->aux[j].word.bv_val)) {
632 int *ptr = (int *)cptr;
633 *ptr = tab->aux[j].mask;
638 Debug(LDAP_DEBUG_ANY, "invalid bind config value %s\n",
643 *cptr = ch_strdup(word+tab->key.bv_len);
650 int bindconf_unparse( slap_bindconf *bc, struct berval *bv ) {
651 char buf[BUFSIZ], *ptr;
657 for (tab = bindkey; !BER_BVISNULL(&tab->key); tab++) {
658 cptr = (char **)((char *)bc + tab->off);
660 int *ip = (int *)cptr, i;
661 for ( i=0; !BER_BVISNULL(&tab->aux[i].word); i++ ) {
662 if ( *ip == tab->aux[i].mask ) {
664 ptr = lutil_strcopy( ptr, tab->key.bv_val );
665 ptr = lutil_strcopy( ptr, tab->aux[i].word.bv_val );
669 } else if ( *cptr ) {
671 ptr = lutil_strcopy( ptr, tab->key.bv_val );
672 if ( tab->quote ) *ptr++ = '"';
673 ptr = lutil_strcopy( ptr, *cptr );
674 if ( tab->quote ) *ptr++ = '"';
678 tmp.bv_len = ptr - buf;
679 ber_dupbv( bv, &tmp );
683 void bindconf_free( slap_bindconf *bc ) {
684 if ( bc->sb_binddn ) {
685 ch_free( bc->sb_binddn );
688 ch_free( bc->sb_cred );
690 if ( bc->sb_saslmech ) {
691 ch_free( bc->sb_saslmech );
693 if ( bc->sb_secprops ) {
694 ch_free( bc->sb_secprops );
696 if ( bc->sb_realm ) {
697 ch_free( bc->sb_realm );
699 if ( bc->sb_authcId ) {
700 ch_free( bc->sb_authcId );
702 if ( bc->sb_authzId ) {
703 ch_free( bc->sb_authzId );
708 /* -------------------------------------- */
712 strtok_quote( char *line, char *sep )
718 strtok_quote_ptr = NULL;
719 if ( line != NULL ) {
722 while ( *next && strchr( sep, *next ) ) {
726 if ( *next == '\0' ) {
732 for ( inquote = 0; *next; ) {
740 AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
746 next + 1, strlen( next + 1 ) + 1 );
747 next++; /* dont parse the escaped character */
752 if ( strchr( sep, *next ) != NULL ) {
753 strtok_quote_ptr = next;
766 static char buf[BUFSIZ];
768 static size_t lmax, lcur;
770 #define CATLINE( buf ) \
772 size_t len = strlen( buf ); \
773 while ( lcur + len + 1 > lmax ) { \
775 line = (char *) ch_realloc( line, lmax ); \
777 strcpy( line + lcur, buf ); \
782 fp_getline_init(ConfigArgs *c) {
788 fp_getline( FILE *fp, ConfigArgs *c )
796 /* avoid stack of bufs */
797 if ( strncasecmp( line, "include", STRLENOF( "include" ) ) == 0 ) {
803 while ( fgets( buf, sizeof( buf ), fp ) ) {
804 p = strchr( buf, '\n' );
806 if ( p > buf && p[-1] == '\r' ) {
814 && ( p = line + strlen( line ) - 1 )[0] == '\\'
821 if ( !isspace( (unsigned char)buf[0] ) ) {
832 return(line[0] ? 1 : 0);
836 fp_parse_line(ConfigArgs *c)
839 char *tline = ch_strdup(c->line);
840 char *hide[] = { "rootpw", "replica", "bindpw", "pseudorootpw", "dbpasswd", '\0' };
844 token = strtok_quote(tline, " \t");
846 if(token) for(i = 0; hide[i]; i++) if(!strcasecmp(token, hide[i])) break;
847 if(strtok_quote_ptr) *strtok_quote_ptr = ' ';
848 Debug(LDAP_DEBUG_CONFIG, "line %lu (%s%s)\n", c->lineno, hide[i] ? hide[i] : c->line, hide[i] ? " ***" : "");
849 if(strtok_quote_ptr) *strtok_quote_ptr = '\0';
851 for(; token; token = strtok_quote(NULL, " \t")) {
852 if(c->argc == c->argv_size - 1) {
854 tmp = ch_realloc(c->argv, (c->argv_size + ARGS_STEP) * sizeof(*c->argv));
856 Debug(LDAP_DEBUG_ANY, "line %lu: out of memory\n", c->lineno, 0, 0);
860 c->argv_size += ARGS_STEP;
862 c->argv[c->argc++] = token;
864 c->argv[c->argc] = NULL;
871 ucdata_unload( UCDATA_ALL );
873 /* NOTE: in case of early exit, frontendDB can be NULL */
874 if ( frontendDB->be_schemandn.bv_val )
875 free( frontendDB->be_schemandn.bv_val );
876 if ( frontendDB->be_schemadn.bv_val )
877 free( frontendDB->be_schemadn.bv_val );
878 if ( frontendDB->be_acl )
879 acl_destroy( frontendDB->be_acl, NULL );
882 if ( slapd_args_file )
883 free ( slapd_args_file );
884 if ( slapd_pid_file )
885 free ( slapd_pid_file );
886 if ( default_passwd_hash )
887 ldap_charray_free( default_passwd_hash );
891 slap_str2clist( char ***out, char *in, const char *brkstr )
899 /* find last element in list */
900 for (i = 0; *out && (*out)[i]; i++);
902 /* protect the input string from strtok */
903 str = ch_strdup( in );
905 if ( *str == '\0' ) {
910 /* Count words in string */
912 for ( s = str; *s; s++ ) {
913 if ( strchr( brkstr, *s ) != NULL ) {
918 *out = ch_realloc( *out, ( i + j + 1 ) * sizeof( char * ) );
920 for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
922 s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
924 *new = ch_strdup( s );