From c11862e8ac5e68d71480bccbb0de346a01086930 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 28 Oct 2009 18:05:40 +0000 Subject: [PATCH] Update ldap filter to handle empty object storage git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14694 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_filterLDAP.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gosa-core/include/class_filterLDAP.inc b/gosa-core/include/class_filterLDAP.inc index 5a6701d65..e929bee90 100644 --- a/gosa-core/include/class_filterLDAP.inc +++ b/gosa-core/include/class_filterLDAP.inc @@ -24,6 +24,7 @@ class filterLDAP { if (!is_array($objectStorage)) { $objectStorage= array($objectStorage); } + $method= empty($objectStorage)?"ls":"search"; // Initialize search bases $bases= array(); @@ -69,7 +70,6 @@ class filterLDAP { } // Switch to new base and search - $ldap->cd($base); if (is_array($dnFilters)){ $dnFilter= "(|"; foreach ($dnFilters as $df) { @@ -79,7 +79,12 @@ class filterLDAP { } else { $dnFilter= ""; } - $ldap->search ("(&$filter$dnFilter)", $attributes); + $ldap->cd($base); + if ($method == "ls") { + $ldap->ls("(&$filter$dnFilter)", $base, $attributes); + } else { + $ldap->search("(&$filter$dnFilter)", $attributes); + } // Check for size limit exceeded messages for GUI feedback if (preg_match("/size limit/i", $ldap->get_error())){ -- 2.30.2