/* config.c - configuration file handling routines */
/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "portable.h"
#include <stdio.h>
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
#include <ac/string.h>
#include <ac/ctype.h>
int global_idletimeout = 0;
char *global_realm = NULL;
char *ldap_srvtab = "";
+char *default_passwd_hash;
char *slapd_pid_file = NULL;
char *slapd_args_file = NULL;
Debug( LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0 );
- if ( schema_init( ) != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "error initializing the schema\n",
- 0, 0, 0 );
- return( 1 );
- }
-
fp_getline_init( &lineno );
while ( (line = fp_getline( fp, &lineno )) != NULL ) {
return( 1 );
}
+ /* set thread concurrency */
+ } else if ( strcasecmp( cargv[0], "concurrency" ) == 0 ) {
+ int c;
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing level in \"concurrency <level>\" line\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
+
+ c = atoi( cargv[1] );
+
+ if( c < 1 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: invalid level (%d) in \"concurrency <level>\" line\n",
+ fname, lineno, c );
+ return( 1 );
+ }
+
+ ldap_pvt_thread_set_concurrency( c );
+
/* get pid file name */
} else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
if ( cargc < 2 ) {
slapd_args_file = ch_strdup( cargv[1] );
+ /* default password hash */
+ } else if ( strcasecmp( cargv[0], "password-hash" ) == 0 ) {
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing realm in \"password-hash <hash>\" line\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
+ if ( default_passwd_hash != NULL ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: already set default password_hash!\n",
+ fname, lineno, 0 );
+ return 1;
+
+ } else {
+ default_passwd_hash = ch_strdup( cargv[1] );
+ }
+
/* set DIGEST realm */
} else if ( strcasecmp( cargv[0], "digest-realm" ) == 0 ) {
if ( cargc < 2 ) {
"%s: line %d: rootpw line must appear inside a database definition (ignored)\n",
fname, lineno, 0 );
} else {
- be->be_root_pw = ch_strdup( cargv[1] );
+ be->be_root_pw.bv_val = ch_strdup( cargv[1] );
+ be->be_root_pw.bv_len = strlen( be->be_root_pw.bv_val );
}
/* make this database read-only */
vals[0]->bv_len = strlen( vals[0]->bv_val );
value_add( &default_referral, vals );
- /* specify locale */
- } else if ( strcasecmp( cargv[0], "locale" ) == 0 ) {
-#ifdef HAVE_LOCALE_H
- char *locale;
- if ( cargc < 2 ) {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: missing locale in \"locale <name | on | off>\" line\n",
- fname, lineno, 0 );
- return( 1 );
- }
-
- locale = (strcasecmp( cargv[1], "on" ) == 0 ? ""
- : strcasecmp( cargv[1], "off" ) == 0 ? "C"
- : ch_strdup( cargv[1] ) );
-
- if ( setlocale( LC_CTYPE, locale ) == 0 ) {
- Debug( LDAP_DEBUG_ANY,
- (*locale
- ? "%s: line %d: bad locale \"%s\"\n"
- : "%s: line %d: bad locale\n"),
- fname, lineno, locale );
- return( 1 );
- }
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: \"locale\" unsupported\n",
- fname, lineno, 0 );
- return( 1 );
-#endif
/* specify an Object Identifier macro */
} else if ( strcasecmp( cargv[0], "objectidentifier" ) == 0 ) {
parse_oidm( fname, lineno, cargc, cargv );
p = strchr(saveline,'(');
parse_oc( fname, lineno, p, cargv );
} else {
- parse_oc_old( be, fname, lineno, cargc, cargv );
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: old objectclass format not supported.\n",
+ fname, lineno, 0 );
}
/* specify an attribute type */
p = strchr(saveline,'(');
parse_at( fname, lineno, p, cargv );
} else {
- attr_syntax_config( fname, lineno, cargc - 1,
- &cargv[1] );
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: old attribute type format not supported.\n",
+ fname, lineno, 0 );
}
/* turn on/off schema checking */
#endif
-#ifdef SLAPD_EXTERNAL_EXTENSIONS
- } else if ( !strcasecmp( cargv[0], "extension" ) ) {
- if ( cargc < 2 ) {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: missing oid in \"extension <oid> <libpath>\" line\n",
- fname, lineno, 0 );
- } else if ( cargc < 3 ) {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: missing libpath in \"extension <oid> <libpath>\" line\n",
- fname, lineno, 0 );
- } else {
- rc = load_extension(cargv[1], cargv[2], cargc - 3, (cargc > 3) ? cargv + 3 : NULL);
- if (rc != 0) {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: failed to load or initialize extension library %s\n",
- fname, lineno, cargv[2]);
- return rc;
- }
- }
-#endif
-
/* pass anything else to the current backend info/db config routine */
} else {
if ( bi != NULL ) {