You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by co...@apache.org on 2026/05/14 10:04:26 UTC

(directory-server) branch master updated: Don't call PasswordUtil when the algorithm is null

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git


The following commit(s) were added to refs/heads/master by this push:
     new a7425ca3f6 Don't call PasswordUtil when the algorithm is null
a7425ca3f6 is described below

commit a7425ca3f6db914d019908730e1adcde340b3181
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu May 14 11:04:00 2026 +0100

    Don't call PasswordUtil when the algorithm is null
---
 .../directory/server/core/hash/ConfigurableHashingInterceptor.java      | 2 +-
 .../apache/directory/server/core/hash/PasswordHashingInterceptor.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java b/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java
index 8bccf5ec38..387f787951 100755
--- a/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java
+++ b/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java
@@ -127,7 +127,7 @@ public class ConfigurableHashingInterceptor extends BaseInterceptor
             // check if the given field is already hashed
             LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( bytes );
             
-            if ( existingAlgo == null ) 
+            if ( existingAlgo == null && algorithm != null ) 
             {
                 // not already hashed, so hash it
                 values.add( PasswordUtil.createStoragePassword( bytes, algorithm ) );
diff --git a/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java b/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
index 2e09c16f88..ab82d31de1 100644
--- a/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
+++ b/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
@@ -161,7 +161,7 @@ public abstract class PasswordHashingInterceptor extends BaseInterceptor
             LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( userPassword.getBytes() );
 
             // if there exists NO algorithm, then hash the password
-            if ( existingAlgo == null )
+            if ( existingAlgo == null && algorithm != null )
             {
                 byte[] hashedPassword = PasswordUtil.createStoragePassword( userPassword.getBytes(), algorithm );