]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/config.c
Added ppolicy_hide_lockout keyword
[openldap] / servers / slapd / config.c
index 56295fed6fdc5065683981a63f57682af6b3eaa1..aa75227507ce88da72c57c6cd3eca6cf2f242d99 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2003 The OpenLDAP Foundation.
+ * Copyright 1998-2004 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@
 #include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
-#include "slapi.h"
+#include "slapi/slapi.h"
 #endif
 #include "lutil.h"
 
@@ -70,7 +70,7 @@ int           global_idletimeout = 0;
 char   *global_host = NULL;
 char   *global_realm = NULL;
 char           *ldap_srvtab = "";
-char           *default_passwd_hash = NULL;
+char           **default_passwd_hash = NULL;
 int            cargc = 0, cargv_size = 0;
 char   **cargv;
 struct berval default_search_base = { 0, NULL };
@@ -96,15 +96,15 @@ int use_reverse_lookup = 0;
 int slapi_plugins_used = 0;
 #endif
 
-static char    *fp_getline(FILE *fp, int *lineno);
-static void    fp_getline_init(int *lineno);
-static int     fp_parse_line(int lineno, char *line);
+static char *fp_getline(FILE *fp, int *lineno);
+static void fp_getline_init(int *lineno);
+static int fp_parse_line(int lineno, char *line);
 
 static char    *strtok_quote(char *line, char *sep);
-static int      load_ucdata(char *path);
+static int load_ucdata(char *path);
 
-static int     add_syncrepl LDAP_P(( Backend *, char **, int ));
-static int      parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
+static int add_syncrepl LDAP_P(( Backend *, char **, int ));
+static int parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
 
 int
 read_config( const char *fname, int depth )
@@ -635,22 +635,34 @@ read_config( const char *fname, int depth )
                                return 1;
 
                        }
-
-                       if ( lutil_passwd_scheme( cargv[1] ) == 0 ) {
+                       for(i = 1; i < cargc; i++) {
+                               if ( lutil_passwd_scheme( cargv[i] ) == 0 ) {
+#ifdef NEW_LOGGING
+                                       LDAP_LOG( CONFIG, CRIT, 
+                                               "%s: line %d: password scheme \"%s\" not available\n",
+                                               fname, lineno, cargv[i] );
+#else
+                                       Debug( LDAP_DEBUG_ANY,
+                                               "%s: line %d: password scheme \"%s\" not available\n",
+                                               fname, lineno, cargv[i] );
+#endif
+                               } else {
+                                       ldap_charray_add( &default_passwd_hash, cargv[i] );
+                               }
+                       }
+                       if( !default_passwd_hash ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG( CONFIG, CRIT, 
-                                          "%s: line %d: password scheme \"%s\" not available\n",
-                                          fname, lineno, cargv[1] );
+                                       "%s: line %d: no valid hashes found\n",
+                                       fname, lineno, 0 );
 #else
                                Debug( LDAP_DEBUG_ANY,
-                                       "%s: line %d: password scheme \"%s\" not available\n",
-                                       fname, lineno, cargv[1] );
-#endif
+                                       "%s: line %d: no valid hashes found\n",
+                                       fname, lineno, 0 );
                                return 1;
+#endif
                        }
 
-                       default_passwd_hash = ch_strdup( cargv[1] );
-
                } else if ( strcasecmp( cargv[0], "password-crypt-salt-format" ) == 0 ) 
                {
                        if ( cargc < 2 ) {
@@ -674,6 +686,15 @@ read_config( const char *fname, int depth )
                } else if ( strncasecmp( cargv[0], "sasl", 4 ) == 0 ) {
                        if ( slap_sasl_config( cargc, cargv, line, fname, lineno ) )
                                return 1;
+#ifdef SLAP_X_SASL_REWRITE
+               /* use authid rewrite instead of sasl regexp */
+               } else if ( strncasecmp( cargv[0], "authid-rewrite", sizeof("authid-rewrite") - 1 ) == 0 ) {
+                       int rc = slap_sasl_rewrite_config( fname, lineno,
+                                       cargc, cargv );
+                       if ( rc ) {
+                               return rc;
+                       }
+#endif /* SLAP_X_SASL_REWRITE */
 
                } else if ( strcasecmp( cargv[0], "schemadn" ) == 0 ) {
                        struct berval dn;
@@ -772,7 +793,7 @@ read_config( const char *fname, int depth )
 
                        for ( i = 1; i < cargc; i++ ) {
                                if ( strncasecmp( cargv[i], "size", 4 ) == 0 ) {
-                                       rc = parse_limit( cargv[i], lim );
+                                       rc = limits_parse_one( cargv[i], lim );
                                        if ( rc ) {
 #ifdef NEW_LOGGING
                                                LDAP_LOG( CONFIG, CRIT, 
@@ -852,7 +873,7 @@ read_config( const char *fname, int depth )
 
                        for ( i = 1; i < cargc; i++ ) {
                                if ( strncasecmp( cargv[i], "time", 4 ) == 0 ) {
-                                       rc = parse_limit( cargv[i], lim );
+                                       rc = limits_parse_one( cargv[i], lim );
                                        if ( rc ) {
 #ifdef NEW_LOGGING
                                                LDAP_LOG( CONFIG, CRIT, 
@@ -920,7 +941,7 @@ read_config( const char *fname, int depth )
                                return( 1 );
                        }
 
-                       if ( parse_limits( be, fname, lineno, cargc, cargv ) ) {
+                       if ( limits_parse( be, fname, lineno, cargc, cargv ) ) {
                                return( 1 );
                        }
 
@@ -2423,7 +2444,7 @@ read_config( const char *fname, int depth )
                        }
 #endif /* notdef */
 
-                       if ( netscape_plugin( be, fname, lineno, cargc, cargv ) 
+                       if ( slapi_int_read_config( be, fname, lineno, cargc, cargv ) 
                                        != LDAP_SUCCESS ) {
                                return( 1 );
                        }
@@ -2774,7 +2795,7 @@ config_destroy( )
        if ( slapd_pid_file )
                free ( slapd_pid_file );
        if ( default_passwd_hash )
-               free( default_passwd_hash );
+               ldap_charray_free( default_passwd_hash );
        acl_destroy( global_acl, NULL );
 }
 
@@ -2834,10 +2855,10 @@ add_syncrepl(
                if ( si->si_rid == si_entry->si_rid ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG( CONFIG, ERR,
-                                       "add_syncrepl: duplicaetd replica id\n", 0, 0,0 );
+                               "add_syncrepl: duplicated replica id\n", 0, 0,0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
-                                       "add_syncrepl: duplicated replica id\n",0, 0, 0 );
+                               "add_syncrepl: duplicated replica id\n",0, 0, 0 );
 #endif
                        duplicated_replica_id = 1;
                        break;
@@ -3079,6 +3100,12 @@ parse_syncrepl_line(
                                si->si_scope = LDAP_SCOPE_BASE;
                        } else if ( !strncasecmp( val, "one", sizeof( "one" ) - 1 )) {
                                si->si_scope = LDAP_SCOPE_ONELEVEL;
+#ifdef LDAP_SCOPE_SUBORDINATE
+                       } else if ( !strcasecmp( val, "subordinate" ) ||
+                               !strcasecmp( val, "children" ))
+                       {
+                               si->si_scope = LDAP_SCOPE_SUBORDINATE;
+#endif
                        } else if ( !strncasecmp( val, "sub", sizeof( "sub" ) - 1 )) {
                                si->si_scope = LDAP_SCOPE_SUBTREE;
                        } else {