mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
pbkdf2: fix password comparison
the key len for the derived function must be equal to the len of the expected key
This commit is contained in:
@@ -2514,12 +2514,12 @@ func TestPasswordsHashPbkdf2Sha256(t *testing.T) {
|
||||
user.Password = pbkdf2ClearPwd
|
||||
client, err := getSftpClient(user, usePubKey)
|
||||
if err != nil {
|
||||
t.Errorf("unable to login with pkkdf2 sha1 password: %v", err)
|
||||
t.Errorf("unable to login with pkkdf2 sha256 password: %v", err)
|
||||
} else {
|
||||
defer client.Close()
|
||||
_, err = client.Getwd()
|
||||
if err != nil {
|
||||
t.Errorf("unable to get working dir with pkkdf2 sha1 password: %v", err)
|
||||
t.Errorf("unable to get working dir with pkkdf2 sha256 password: %v", err)
|
||||
}
|
||||
}
|
||||
user.Password = pbkdf2Pwd
|
||||
@@ -2547,12 +2547,12 @@ func TestPasswordsHashPbkdf2Sha512(t *testing.T) {
|
||||
user.Password = pbkdf2ClearPwd
|
||||
client, err := getSftpClient(user, usePubKey)
|
||||
if err != nil {
|
||||
t.Errorf("unable to login with pkkdf2 sha1 password: %v", err)
|
||||
t.Errorf("unable to login with pkkdf2 sha512 password: %v", err)
|
||||
} else {
|
||||
defer client.Close()
|
||||
_, err = client.Getwd()
|
||||
if err != nil {
|
||||
t.Errorf("unable to get working dir with pkkdf2 sha1 password: %v", err)
|
||||
t.Errorf("unable to get working dir with pkkdf2 sha512 password: %v", err)
|
||||
}
|
||||
}
|
||||
user.Password = pbkdf2Pwd
|
||||
|
||||
Reference in New Issue
Block a user