[dev] patch for ldap.php
Christophe Réquillart
Christophe.Requillart at bull.net
Mon Apr 14 20:28:09 PDT 2003
Hi,
I have two patches in the file horde/lib/Auth/ldap.php :
1/ minor bug : the ldap port is not use in the ldap_connect
2/ more serious : why are you doing a search before the bind ? It's more simple to do the bind with the dn construct with the uid from the configuration file ... If the dn does not exist, the connect will be refused. And there is a problem with the search, if the acl of the ldap server don't authorize the search as an anonymous user.
101c101
< $ldap = @ldap_connect($this->params['hostspec']);
---
> $ldap = @ldap_connect($this->params['hostspec'], $this->params['port']);
106,114c106
< /* Search for the user's full DN. */
< $search = @ldap_search($ldap, $this->params['basedn'],
< $this->params['uid'] . '=' . $userID, array($this->params['uid']));
< $result = @ldap_get_entries($ldap, $search);
< if (is_array($result) && (count($result) > 1)) {
< $dn = $result[0]['dn'];
< } else {
< return (new PEAR_Error(_("Empty result.")));
< }
---
> $dn = $this->params['uid'].'='.$userID.','.$this->params['basedn'];
More information about the dev
mailing list