Skip to content

Commit

Permalink
Add option 'modPassPlain' to send plaintext password updates to LDAP …
Browse files Browse the repository at this point in the history
…server
  • Loading branch information
spike77453 committed Jun 28, 2022
1 parent 40bf970 commit ceac443
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/plugins/authldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,12 @@ public function modifyUser($user, $changes)
}

// Generate the salted hashed password for LDAP
$phash = new \dokuwiki\PassHash();
$hash = $phash->hash_ssha($changes['pass']);
if ($this->getConf('modPassPlain')) {
$hash = $changes['pass'];
} else {
$phash = new \dokuwiki\PassHash();
$hash = $phash->hash_ssha($changes['pass']);
}

// change the password
if (!@ldap_mod_replace($this->con, $dn, array('userpassword' => $hash))) {
Expand Down
1 change: 1 addition & 0 deletions lib/plugins/authldap/conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
$conf['groupkey'] = 'cn';
$conf['debug'] = 0;
$conf['modPass'] = 1;
$conf['modPassPlain'] = 0;
$conf['attributes'] = array();
1 change: 1 addition & 0 deletions lib/plugins/authldap/conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
$meta['groupkey'] = array('string','_caution' => 'danger');
$meta['debug'] = array('onoff','_caution' => 'security');
$meta['modPass'] = array('onoff');
$meta['modPassPlain']= array('onoff','_caution' => 'security');
1 change: 1 addition & 0 deletions lib/plugins/authldap/lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$lang['userkey'] = 'Attribute denoting the username; must be consistent to userfilter.';
$lang['groupkey'] = 'Group membership from any user attribute (instead of standard AD groups) e.g. group from department or telephone number';
$lang['modPass'] = 'Can the LDAP password be changed via dokuwiki?';
$lang['modPassPlain']= 'Send password updates in plain text to the LDAP server (rather than salt and hash them with the configured algorithm before transmission)?';
$lang['debug'] = 'Display additional debug information on errors';


Expand Down

0 comments on commit ceac443

Please sign in to comment.