diff --git a/inc/auth.php b/inc/auth.php index 9be5c19b4c84aec15a2c171a10035fdcf2f587ae..684885890d50d7891150ade0b8e3f13b8a68f1a7 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -872,6 +872,7 @@ function act_resendpwd(){ * crypt - Unix crypt * mysql - MySQL password (old method) * my411 - MySQL 4.1.1 password + * kmd5 - Salted MD5 hashing as used by UNB * * @author Andreas Gohr <andi@splitbrain.org> * @return string The crypted password @@ -942,6 +943,11 @@ function auth_cryptPassword($clear,$method='',$salt=null){ return sprintf("%08x%08x", ($nr & 0x7fffffff), ($nr2 & 0x7fffffff)); case 'my411': return '*'.sha1(pack("H*", sha1($clear))); + case 'kmd5': + $key = substr($salt, 16, 2); + $hash1 = strtolower(md5($key . md5($clear))); + $hash2 = substr($hash1, 0, 16) . $key . substr($hash1, 16); + return $hash2; default: msg("Unsupported crypt method $method",-1); } @@ -980,6 +986,9 @@ function auth_verifyPassword($clear,$crypt){ $method = 'mysql'; }elseif($len == 41 && $crypt[0] == '*'){ $method = 'my411'; + }elseif($len == 34){ + $method = 'kmd5'; + $salt = $crypt; }else{ $method = 'crypt'; $salt = substr($crypt,0,2); diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index f78715de56b4f9eef6abe6884c181f911685c2f9..41f8497bfb1829c5e125c856cd3521e211495f30 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -119,7 +119,7 @@ $meta['_authentication'] = array('fieldset'); $meta['useacl'] = array('onoff'); $meta['autopasswd'] = array('onoff'); $meta['authtype'] = array('authtype'); -$meta['passcrypt'] = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','crypt','mysql','my411')); +$meta['passcrypt'] = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','crypt','mysql','my411','kmd5')); $meta['defaultgroup']= array('string'); $meta['superuser'] = array('string'); $meta['manager'] = array('string');