diff options
author | Guy Brand <gb@unistra.fr> | 2015-08-10 10:03:27 +0200 |
---|---|---|
committer | Guy Brand <gb@unistra.fr> | 2015-08-10 10:03:27 +0200 |
commit | 53a57d16b9c741bb44099fd93bf79efa06796341 (patch) | |
tree | 24a90a50afe9325926c8ebaa2ed90f9fa093e5b9 /lib/plugins/authldap/auth.php | |
parent | cf6e6645c31a9f185cef3fb9452fb188882ede47 (diff) | |
parent | a060d9973e7c1d5051f2cc426937881826e4972e (diff) | |
download | rpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.gz rpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.bz2 |
Merge branch master into stable
Diffstat (limited to 'lib/plugins/authldap/auth.php')
-rw-r--r-- | lib/plugins/authldap/auth.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index b22b82ecc..247a0fec2 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -37,7 +37,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { } // Add the capabilities to change the password - $this->cando['modPass'] = true; + $this->cando['modPass'] = $this->getConf('modPass'); } /** @@ -181,6 +181,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { } } + $info = array(); $info['user'] = $user; $info['server'] = $this->getConf('server'); @@ -280,14 +281,14 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { // open the connection to the ldap if(!$this->_openLDAP()){ - msg('LDAP cannot connect: '. htmlspecialchars(ldap_error($this->con))); + $this->_debug('LDAP cannot connect: '. htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__); return false; } // find the information about the user, in particular the "dn" $info = $this->getUserData($user,true); if(empty($info['dn'])) { - msg('LDAP cannot find your user dn'); + $this->_debug('LDAP cannot find your user dn', 0, __LINE__, __FILE__); return false; } $dn = $info['dn']; @@ -300,7 +301,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { // bind with the ldap if(!@ldap_bind($this->con, $dn, $pass)){ - msg('LDAP user bind failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__); + $this->_debug('LDAP user bind failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__); return false; } } elseif ($this->getConf('binddn') && $this->getConf('bindpw')) { @@ -321,7 +322,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { // 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))); + $this->_debug('LDAP mod replace failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__); return false; } @@ -359,8 +360,9 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { $sr = ldap_search($this->con, $this->getConf('usertree'), $all_filter); $entries = ldap_get_entries($this->con, $sr); $users_array = array(); + $userkey = $this->getConf('userkey'); for($i = 0; $i < $entries["count"]; $i++) { - array_push($users_array, $entries[$i]["uid"][0]); + array_push($users_array, $entries[$i][$userkey][0]); } asort($users_array); $result = $users_array; @@ -515,13 +517,13 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { } } // needs version 3 - if($this->getConf('referrals')) { + if($this->getConf('referrals') > -1) { if(!@ldap_set_option( $this->con, LDAP_OPT_REFERRALS, $this->getConf('referrals') ) ) { - msg('Setting LDAP referrals to off failed', -1); + msg('Setting LDAP referrals failed', -1); $this->_debug('LDAP referal set: '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__); } } @@ -564,15 +566,13 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { * Wraps around ldap_search, ldap_list or ldap_read depending on $scope * * @author Andreas Gohr <andi@splitbrain.org> - * @param resource $link_identifier - * @param string $base_dn - * @param string $filter - * @param string $scope can be 'base', 'one' or 'sub' - * @param null $attributes - * @param int $attrsonly - * @param int $sizelimit - * @param int $timelimit - * @param int $deref + * @param resource $link_identifier + * @param string $base_dn + * @param string $filter + * @param string $scope can be 'base', 'one' or 'sub' + * @param null|array $attributes + * @param int $attrsonly + * @param int $sizelimit * @return resource */ protected function _ldapsearch($link_identifier, $base_dn, $filter, $scope = 'sub', $attributes = null, |