mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
LSattr_ldap_password: fix verify method for Salted SHA2 passwords
This commit is contained in:
parent
f47e40a5ac
commit
82a236a67c
1 changed files with 6 additions and 2 deletions
|
@ -262,8 +262,12 @@ class LSattr_ldap_password extends LSattr_ldap {
|
|||
case 'ssha512':
|
||||
case 'smd5':
|
||||
$data = base64_decode($hashedPasswordData);
|
||||
# Salt = last 4 bytes
|
||||
$salt = substr($data, -4);
|
||||
# Salt = last 4 bytes for SSHA / SMD5 and last 8 bytes for SSH256 / SSHA512
|
||||
if ($cypher == 'ssha' || $cypher == 'smd5')
|
||||
$salt_size = 4;
|
||||
else
|
||||
$salt_size = 8;
|
||||
$salt = substr($data, -$salt_size);
|
||||
$new_hash = $this -> encodePassword($clearPassword, $cypher, null, $salt);
|
||||
return (strcmp($hashedPassword,$new_hash) == 0);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue