X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_filterLDAP.inc;h=34aff04a8e5652b6c00a9e61cb5bdb8df7dbb459;hb=c9bd6c4d92532063a9dd8df3cfd20740d43e5841;hp=e929bee90f1781a88cce2a3570b83fab8a901b1a;hpb=c11862e8ac5e68d71480bccbb0de346a01086930;p=gosa.git diff --git a/gosa-core/include/class_filterLDAP.inc b/gosa-core/include/class_filterLDAP.inc index e929bee90..34aff04a8 100644 --- a/gosa-core/include/class_filterLDAP.inc +++ b/gosa-core/include/class_filterLDAP.inc @@ -2,7 +2,7 @@ class filterLDAP { - static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "") + static function query($base, $scope, $filter, $attributes, $category, $objectStorage= array("")) { $config= session::global_get('config'); $ldap= $config->get_ldap_link(TRUE); @@ -21,21 +21,22 @@ class filterLDAP { if (!is_array($category)) { $category= array($category); } - if (!is_array($objectStorage)) { - $objectStorage= array($objectStorage); - } - $method= empty($objectStorage)?"ls":"search"; + + // Store in base - i.e. is a rdn value empty? + $storeOnBase= count($objectStorage) == 1 && empty($objectStorage[0]); + + $method= ($storeOnBase && !($flags & GL_SUBSEARCH))?"ls":"search"; // Initialize search bases $bases= array(); // Get list of sub bases to search on - if (count($objectStorage) == 0) { + if ($storeOnBase) { $bases[$base]= ""; } else { foreach ($objectStorage as $oc) { $oc= preg_replace('/,$/', '', $oc); - $tmp= split(',', $oc); + $tmp= explode(',', $oc); if (count($tmp) == 1) { preg_match('/([^=]+)=(.*)$/', $oc, $m); if ($flags & GL_SUBSEARCH) {