summaryrefslogtreecommitdiff
path: root/lib/plugins/authldap/auth.php
diff options
context:
space:
mode:
authorAxel Angel <axel+git@vneko.ch>2014-05-04 19:54:37 +0200
committerAxel Angel <axel+git@vneko.ch>2014-05-08 12:21:33 +0200
commit67723447f02824ff2df7daa0f1f97d8b289c5d7a (patch)
tree9f6683714cbc7656c1c033734f4fa471b0a1d508 /lib/plugins/authldap/auth.php
parent719c6730c7da93e830205e42dc230de831446e8f (diff)
downloadrpg-67723447f02824ff2df7daa0f1f97d8b289c5d7a.tar.gz
rpg-67723447f02824ff2df7daa0f1f97d8b289c5d7a.tar.bz2
Hash and salt password with PassHash::ssha
Moved the block closer to the variable use (indent clearer)
Diffstat (limited to 'lib/plugins/authldap/auth.php')
-rw-r--r--lib/plugins/authldap/auth.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php
index 5bdaf0446..ecbbc2a3a 100644
--- a/lib/plugins/authldap/auth.php
+++ b/lib/plugins/authldap/auth.php
@@ -288,10 +288,6 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
if(empty($changes['pass'])) {
msg('The new password is not allow because it\'s empty');
return false;
- } else {
- mt_srand((double)microtime()*1000000);
- $salt = pack("CCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand());
- $hash = "{SSHA}" . base64_encode(pack("H*", sha1($changes['pass'] . $salt)) . $salt);
}
// find the old password of the user
@@ -317,6 +313,10 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
return false; // no otherway
}
+ // Generate the salted hashed password for LDAP
+ $phash = new PassHash();
+ $hash = $phash->hash_ssha($changes['pass']);
+
// change the password
if(!@ldap_mod_replace($this->con, $dn,array('userpassword' => $hash))){
msg('LDAP mod replace failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)));