Skip to content

Commit 592f47e

Browse files
authored
Merge pull request dokuwiki#3634 from spike77453/feature_add-plaintext-password-update-option
Add option 'modPassPlain' to send plaintext password updates to LDAP server
2 parents ababf15 + 6405e5f commit 592f47e

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

lib/plugins/authldap/auth.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,12 @@ public function modifyUser($user, $changes)
365365
}
366366

367367
// Generate the salted hashed password for LDAP
368-
$phash = new PassHash();
369-
$hash = $phash->hash_ssha($changes['pass']);
368+
if ($this->getConf('modPassPlain')) {
369+
$hash = $changes['pass'];
370+
} else {
371+
$phash = new PassHash();
372+
$hash = $phash->hash_ssha($changes['pass']);
373+
}
370374

371375
// change the password
372376
if (!@ldap_mod_replace($this->con, $dn, ['userpassword' => $hash])) {

lib/plugins/authldap/conf/default.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
$conf['groupkey'] = 'cn';
2121
$conf['debug'] = 0;
2222
$conf['modPass'] = 1;
23+
$conf['modPassPlain'] = 0;
2324
$conf['attributes'] = array();

lib/plugins/authldap/conf/metadata.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
$meta['groupkey'] = array('string','_caution' => 'danger');
2222
$meta['debug'] = array('onoff','_caution' => 'security');
2323
$meta['modPass'] = array('onoff');
24+
$meta['modPassPlain']= array('onoff','_caution' => 'security');

lib/plugins/authldap/lang/en/settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
$lang['userkey'] = 'Attribute denoting the username; must be consistent to userfilter.';
1818
$lang['groupkey'] = 'Group membership from any user attribute (instead of standard AD groups) e.g. group from department or telephone number';
1919
$lang['modPass'] = 'Can the LDAP password be changed via dokuwiki?';
20+
$lang['modPassPlain']= 'Send password updates in plain text to the LDAP server (rather than salt and hash them with the configured algorithm before transmission)?';
2021
$lang['debug'] = 'Display additional debug information on errors';
2122

2223

0 commit comments

Comments
 (0)