From de00654a0aa4a3ceac8f27c70a211c0f377edddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Wed, 11 Jul 2018 22:12:22 +0200 Subject: [PATCH] [Web] Use preg_replace to detect passwd schema case-insensitive, sorry for wasting some ms cpu time --- data/web/inc/functions.inc.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 6876c0d2..542e59ff 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -130,9 +130,7 @@ function generate_tlsa_digest($hostname, $port, $starttls = null) { } function verify_ssha256($hash, $password) { // Remove tag if any - if (substr($hash, 0, strlen('{SSHA256}')) == '{SSHA256}') { - $hash = substr($hash, strlen('{SSHA256}')); - } + $hash = preg_replace('/^{SSHA256}/i', '', $hash); // Decode hash $dhash = base64_decode($hash); // Get first 32 bytes of binary which equals a SHA256 hash