]> git.sur5r.net Git - openldap/commitdiff
detect unavailable hash algorithms at startup
authorPierangelo Masarati <ando@openldap.org>
Sat, 9 Mar 2002 11:02:32 +0000 (11:02 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 9 Mar 2002 11:02:32 +0000 (11:02 +0000)
servers/slapd/config.c
servers/slapd/passwd.c

index f9f25de652093d3e3e5298ea1a5c976387ca1885..e1fb33250580d7591508b9494314ef29ee6857e5 100644 (file)
@@ -44,7 +44,7 @@ int           global_idletimeout = 0;
 char   *global_host = NULL;
 char   *global_realm = NULL;
 char           *ldap_srvtab = "";
-char           *default_passwd_hash;
+char           *default_passwd_hash = NULL;
 struct berval default_search_base = { 0, NULL };
 struct berval default_search_nbase = { 0, NULL };
 unsigned               num_subordinates = 0;
@@ -520,10 +520,23 @@ read_config( const char *fname )
 
                                return 1;
 
-                       } else {
-                               default_passwd_hash = ch_strdup( cargv[1] );
                        }
 
+                       if ( lutil_passwd_scheme( cargv[1] ) == NULL ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                          "%s: line %d: password scheme \"%s\" not available\n",
+                                          fname, lineno, cargv[1] ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: password scheme \"%s\" not available\n",
+                                       fname, lineno, cargv[1] );
+#endif
+                               return 1;
+                       }
+
+                       default_passwd_hash = ch_strdup( cargv[1] );
+
                } else if ( strcasecmp( cargv[0], "password-crypt-salt-format" ) == 0 ) 
                {
                        if ( cargc < 2 ) {
index 90ac1d3bbf2ddf95503e32f34c0fdc6bfb70fa52..147c9b41f64303bc1f86b1c87e042f09e4952dfc 100644 (file)
@@ -314,6 +314,7 @@ slap_passwd_hash(
 #endif
 
        tmp = lutil_passwd_hash( cred , hash );
+       assert( tmp != NULL );
        
 #if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
        ldap_pvt_thread_mutex_unlock( &passwd_mutex );