]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#7981 Move default hash selection to slap_passwd_hash_type
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 15 Apr 2025 16:43:49 +0000 (17:43 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 23 Jun 2025 16:47:48 +0000 (16:47 +0000)
servers/slapd/passwd.c

index 942c2a2bc6b27ae8c380ee2bf300a32702e0f59b..b3c357aaade1480f5b94b56a2726283082b86bad 100644 (file)
@@ -572,25 +572,26 @@ slap_passwd_hash_type(
        new->bv_len = 0;
        new->bv_val = NULL;
 
+       if ( hash == NULL ) {
+               if ( default_passwd_hash ) {
+                       hash = default_passwd_hash[0];
+               }
+               if ( !hash ) {
+                       hash = (char *)defhash[0];
+               }
+       }
        assert( hash != NULL );
 
        lutil_passwd_hash( cred , hash, new, text );
 }
+
 void
 slap_passwd_hash(
        struct berval * cred,
        struct berval * new,
        const char **text )
 {
-       char *hash = NULL;
-       if ( default_passwd_hash ) {
-               hash = default_passwd_hash[0];
-       }
-       if ( !hash ) {
-               hash = (char *)defhash[0];
-       }
-
-       slap_passwd_hash_type( cred, new, hash, text );
+       slap_passwd_hash_type( cred, new, NULL, text );
 }
 
 #ifdef SLAPD_CRYPT