Skip to content

Commit 9c952d3

Browse files
committed
run passcrypt when user does not exist dokuwiki#4491
This will automatically use the configured password hashing method, thus matching what existing users most likely have for their hash as well.
1 parent e37d2b4 commit 9c952d3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/plugins/authpdo/auth.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ public function checkPass($user, $pass)
123123
{
124124

125125
$userdata = $this->selectUser($user);
126-
if ($userdata == false) return false;
126+
if ($userdata === false) {
127+
auth_cryptPassword('dummy'); // run a crypt op to prevent timing attacks
128+
return false;
129+
}
127130

128131
// password checking done in SQL?
129132
if ($this->checkConfig(['check-pass'])) {

lib/plugins/authplain/auth.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ public function __construct()
6868
public function checkPass($user, $pass)
6969
{
7070
$userinfo = $this->getUserData($user);
71-
if ($userinfo === false) return false;
71+
if ($userinfo === false) {
72+
auth_cryptPassword('dummy'); // run a crypt op to prevent timing attacks
73+
return false;
74+
}
7275

7376
return auth_verifyPassword($pass, $this->users[$user]['pass']);
7477
}

0 commit comments

Comments
 (0)