/* 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
*/
int defsize = SLAPD_DEFAULT_SIZELIMIT;
int deftime = SLAPD_DEFAULT_TIMELIMIT;
AccessControl *global_acl = NULL;
-int global_default_access = ACL_READ;
+slap_access_t global_default_access = ACL_READ;
int global_readonly = 0;
char *replogfile;
int global_lastmod = ON;
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 ) {
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 */
p = strchr(saveline,'(');
parse_oc( fname, lineno, p, cargv );
} else {
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: old objectclass format not supported.\n",
+ fname, lineno, 0 );
+#else
parse_oc_old( be, fname, lineno, cargc, cargv );
+#endif
}
/* specify an attribute type */
p = strchr(saveline,'(');
parse_at( fname, lineno, p, cargv );
} else {
- attr_syntax_config( fname, lineno, cargc - 1,
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: old attribute type format not supported.\n",
+ fname, lineno, 0 );
+#else
+ at_config( fname, lineno, cargc - 1,
&cargv[1] );
+#endif
}
/* turn on/off schema checking */
/* specify default access control info */
} else if ( strcasecmp( cargv[0], "defaultaccess" ) == 0 ) {
+ slap_access_t access;
+
if ( cargc < 2 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing limit in \"defaultaccess <access>\" line\n",
fname, lineno, 0 );
return( 1 );
}
+
+ access = str2access( cargv[1] );
+
+ if ( access == ACL_INVALID_ACCESS ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: bad access level \"%s\", "
+ "expecting none|auth|compare|search|read|write\n",
+ fname, lineno, cargv[1] );
+ return( 1 );
+ }
+
if ( be == NULL ) {
- if ( ACL_IS_INVALID(ACL_SET(global_default_access,
- str2access(cargv[1]))) )
- {
- Debug( LDAP_DEBUG_ANY,
-"%s: line %d: bad access \"%s\" expecting [self]{none|auth|compare|search|read|write}\n",
- fname, lineno, cargv[1] );
- return( 1 );
- }
+ global_default_access = access;
} else {
- if ( ACL_IS_INVALID(ACL_SET(be->be_dfltaccess,
- str2access(cargv[1]))) )
- {
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: bad access \"%s\", "
- "expecting [self]{none|auth|compare|search|read|write}\n",
- fname, lineno, cargv[1] );
- return( 1 );
- }
+ be->be_dfltaccess = access;
}
/* debug level to log things to syslog */