Skip to content

Commit a7425ca

Browse files
committed
Don't call PasswordUtil when the algorithm is null
1 parent 9a3ee02 commit a7425ca

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void includeHashed( Attribute attribute ) throws LdapInvalidAttributeVal
127127
// check if the given field is already hashed
128128
LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( bytes );
129129

130-
if ( existingAlgo == null )
130+
if ( existingAlgo == null && algorithm != null )
131131
{
132132
// not already hashed, so hash it
133133
values.add( PasswordUtil.createStoragePassword( bytes, algorithm ) );

interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private Attribute includeHashedPassword( Attribute pwdAt ) throws LdapException
161161
LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( userPassword.getBytes() );
162162

163163
// if there exists NO algorithm, then hash the password
164-
if ( existingAlgo == null )
164+
if ( existingAlgo == null && algorithm != null )
165165
{
166166
byte[] hashedPassword = PasswordUtil.createStoragePassword( userPassword.getBytes(), algorithm );
167167

0 commit comments

Comments
 (0)