From e6101bb6d72b59fd88801f5cb82fe5c3433b8010 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 1 Jul 2012 11:31:29 +0200
Subject: [PATCH] make MD5 crypt without salts always use PHP implementation

crypt seems to behave different on different systems when the salt
is empty.
---
 inc/PassHash.class.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php
index f85766723..13be479cc 100644
--- a/inc/PassHash.class.php
+++ b/inc/PassHash.class.php
@@ -132,7 +132,7 @@ class PassHash {
     public function hash_smd5($clear, $salt = null) {
         $this->init_salt($salt, 8);
 
-        if(defined('CRYPT_MD5') && CRYPT_MD5) {
+        if(defined('CRYPT_MD5') && CRYPT_MD5 && $salt !== '') {
             return crypt($clear, '$1$'.$salt.'$');
         } else {
             // Fall back to PHP-only implementation
-- 
GitLab