Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ function password_types() {
* crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear.
* @return string The hashed password.
*/
function password_hash($password_clear,$enc_type) {
function pla_password_hash($password_clear,$enc_type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);

Expand Down Expand Up @@ -2318,7 +2318,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword

# SHA crypted passwords
case 'sha':
if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
if (strcasecmp(pla_password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
return true;
else
return false;
Expand All @@ -2327,7 +2327,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword

# MD5 crypted passwords
case 'md5':
if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
if( strcasecmp(pla_password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
return true;
else
return false;
Expand Down Expand Up @@ -2392,7 +2392,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword

# SHA512 crypted passwords
case 'sha512':
if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
if (strcasecmp(pla_password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
return true;
else
return false;
Expand Down Expand Up @@ -2565,12 +2565,22 @@ function dn_unescape($dn) {
$a = array();

foreach ($dn as $key => $rdn)
$a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
function ($r) {
return "''.chr(hexdec('$r[1]')).''";
},
$rdn
);

return $a;

} else {
return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
function ($r) {
return "''.chr(hexdec('$r[1]')).''";
},
$dn
);
}
}

Expand Down