From 0e34df01c70f4f09604e403c99a0f0542ea563af Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 13 May 2003 15:54:37 +0000 Subject: [PATCH] fixed messages if user suffix is invalid --- lam/lib/ldap.inc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lam/lib/ldap.inc b/lam/lib/ldap.inc index 005f6f24..3d112bbc 100644 --- a/lam/lib/ldap.inc +++ b/lam/lib/ldap.inc @@ -113,12 +113,14 @@ class Ldap{ // users have the attribute "posixAccount" or "sambaAccount" and uid $name $filter = "(&(|(objectClass=posixAccount) (objectClass=sambaAccount)) (uid=$name))"; $attrs = array(); - $sr = ldap_search($this->server, $this->conf->get_UserSuffix(), $filter, $attrs); - $info = ldap_get_entries($this->server, $sr); - // return only first DN entry - $ret = $info[0]["dn"]; - ldap_free_result($sr); - return $ret; + $sr = @ldap_search($this->server, $this->conf->get_UserSuffix(), $filter, $attrs); + if ($sr) { + $info = ldap_get_entries($this->server, $sr); + // return only first DN entry + $ret = $info[0]["dn"]; + ldap_free_result($sr); + return $ret; + } } // returns the LDAP connection handle