fixed messages if user suffix is invalid

This commit is contained in:
Roland Gruber 2003-05-13 15:54:37 +00:00
parent 2ef09760f4
commit 0e34df01c7
1 changed files with 8 additions and 6 deletions

View File

@ -113,12 +113,14 @@ class Ldap{
// users have the attribute "posixAccount" or "sambaAccount" and uid $name // users have the attribute "posixAccount" or "sambaAccount" and uid $name
$filter = "(&(|(objectClass=posixAccount) (objectClass=sambaAccount)) (uid=$name))"; $filter = "(&(|(objectClass=posixAccount) (objectClass=sambaAccount)) (uid=$name))";
$attrs = array(); $attrs = array();
$sr = ldap_search($this->server, $this->conf->get_UserSuffix(), $filter, $attrs); $sr = @ldap_search($this->server, $this->conf->get_UserSuffix(), $filter, $attrs);
$info = ldap_get_entries($this->server, $sr); if ($sr) {
// return only first DN entry $info = ldap_get_entries($this->server, $sr);
$ret = $info[0]["dn"]; // return only first DN entry
ldap_free_result($sr); $ret = $info[0]["dn"];
return $ret; ldap_free_result($sr);
return $ret;
}
} }
// returns the LDAP connection handle // returns the LDAP connection handle