[Web] Validate plain md5 hashes, closes #3017

master
andryyy 2019-10-08 17:36:28 +02:00
parent 1580e4b2a5
commit 80a9c39956
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 6 additions and 0 deletions

View File

@ -386,6 +386,12 @@ function verify_hash($hash, $password) {
return true; return true;
} }
} }
elseif (preg_match('/^{PLAIN-MD5}/i', $hash)) {
$hash = preg_replace('/^{PLAIN-MD5}/i', '', $hash);
if (md5($password) == $hash) {
return true;
}
}
elseif (preg_match('/^{SHA512-CRYPT}/i', $hash)) { elseif (preg_match('/^{SHA512-CRYPT}/i', $hash)) {
// Remove tag if any // Remove tag if any
$hash = preg_replace('/^{SHA512-CRYPT}/i', '', $hash); $hash = preg_replace('/^{SHA512-CRYPT}/i', '', $hash);