diff --git a/lam/lib/ldap.php b/lam/lib/ldap.php index 3fda9385..979cbb37 100644 --- a/lam/lib/ldap.php +++ b/lam/lib/ldap.php @@ -154,7 +154,21 @@ class Ldap{ function close() { ldap_close($this->server); } - + + // searches LDAP for a specific user name + // and returns its DN entry + function search_username($name) { + // 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; + } + // returns the LDAP connection handle function server() { return $this->server; diff --git a/lam/lib/listgroups.php b/lam/lib/listgroups.php index 15f43413..11727e1f 100644 --- a/lam/lib/listgroups.php +++ b/lam/lib/listgroups.php @@ -29,7 +29,7 @@ include_once("ldap.php"); session_save_path("../sess"); @session_start(); -echo "