diff --git a/lam/lib/listgroups.php b/lam/lib/listgroups.php index 9197678c..cb82add6 100644 --- a/lam/lib/listgroups.php +++ b/lam/lib/listgroups.php @@ -24,6 +24,9 @@ $Id$ */ include_once ('../config/config.php'); include_once("ldap.php"); + +// start session +session_save_path("../sess"); @session_start(); echo ""; @@ -31,11 +34,14 @@ echo " // Samba hosts have the attribute "sambaAccount" and end with "$" $filter = "(objectClass=posixGroup)"; $attrs = array("cn", "gidNumber", "memberUID", "description"); -$sr = ldap_search($_SESSION["ldap"]->server(), +$sr = @ldap_search($_SESSION["ldap"]->server(), $_SESSION["config"]->get_GroupSuffix(), $filter, $attrs); -$info = ldap_get_entries($_SESSION["ldap"]->server, $sr); -ldap_free_result($sr); +if ($sr) { + $info = ldap_get_entries($_SESSION["ldap"]->server, $sr); + ldap_free_result($sr); +} +else echo ("

" . _("No Groups found!") . "

"); // print host table header echo "\n"; diff --git a/lam/lib/listhosts.php b/lam/lib/listhosts.php index 7dbcefcc..863d168d 100644 --- a/lam/lib/listhosts.php +++ b/lam/lib/listhosts.php @@ -24,6 +24,9 @@ $Id$ */ include_once ('../config/config.php'); include_once("ldap.php"); + +// start session +session_save_path("../sess"); @session_start(); echo ""; @@ -31,11 +34,14 @@ echo " // Samba hosts have the attribute "sambaAccount" and end with "$" $filter = "(&(objectClass=sambaAccount) (uid=*$))"; $attrs = array("cn", "rid"); -$sr = ldap_search($_SESSION["ldap"]->server(), +$sr = @ldap_search($_SESSION["ldap"]->server(), $_SESSION["config"]->get_HostSuffix(), $filter, $attrs); -$info = ldap_get_entries($_SESSION["ldap"]->server, $sr); -ldap_free_result($sr); +if ($sr) { + $info = ldap_get_entries($_SESSION["ldap"]->server, $sr); + ldap_free_result($sr); +} +else echo ("

" . _("No Samba Hosts found!") . "

"); // print host table echo "
\n";