From 261f8bb5b097dfafb28d151867fff3ded1974bbe Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 18 Apr 2014 17:37:41 +0200 Subject: [PATCH] Some fixes for password scrambling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index f55c9a396a..a5a92f5ecf 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -832,14 +832,17 @@ function scrambleString ($str) { if (strlen($str) > 40) { // The string is to long return $str; - } elseif (strlen($str) == 40) { + } elseif ((strlen($str) == 40) && (getPassScramble() != '')) { // From database - $scrambleNums = explode(':', getPassScramble()); + $scramble = getPassScramble(); } else { // Generate new numbers - $scrambleNums = explode(':', genScrambleString(strlen($str))); + $scramble = genScrambleString(strlen($str)); } + // Convert it into an array + $scrambleNums = explode(':', $scramble); + // Assert on both lengths assert(strlen($str) == count($scrambleNums)); -- 2.39.2