X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_filterLDAP.inc;h=5a6701d65540462693a5b681e7b475167d8e2a60;hb=4b3498ae8e78a11c7c99663d45bab6a0a14df052;hp=3636af9f33a55dff40a2ad7cad6006d1794006f6;hpb=387ff6360fab03b13f5dc9a95ef6d99d11765edd;p=gosa.git diff --git a/gosa-core/include/class_filterLDAP.inc b/gosa-core/include/class_filterLDAP.inc index 3636af9f3..5a6701d65 100644 --- a/gosa-core/include/class_filterLDAP.inc +++ b/gosa-core/include/class_filterLDAP.inc @@ -29,24 +29,28 @@ class filterLDAP { $bases= array(); // Get list of sub bases to search on - foreach ($objectStorage as $oc) { - $oc= preg_replace('/,$/', '', $oc); - $tmp= split(',', $oc); - if (count($tmp) == 1) { - preg_match('/([^=]+)=(.*)$/', $oc, $m); - if ($flags & GL_SUBSEARCH) { - $bases[$base][]= $m[1].":dn:=".$m[2]; - } else { - $bases["$oc,$base"][]= $m[1].":dn:=".$m[2]; - } - } else { - // No, there's no \, in pre defined RDN values - preg_match('/^([^,]+),(.*)$/', $oc, $matches); - preg_match('/([^=]+)=(.*)$/', $matches[1], $m); - if ($flags & GL_SUBSEARCH) { - $bases[$base][]= $m[1].":dn:=".$m[2]; + if (count($objectStorage) == 0) { + $bases[$base]= ""; + } else { + foreach ($objectStorage as $oc) { + $oc= preg_replace('/,$/', '', $oc); + $tmp= split(',', $oc); + if (count($tmp) == 1) { + preg_match('/([^=]+)=(.*)$/', $oc, $m); + if ($flags & GL_SUBSEARCH) { + $bases[$base][]= $m[1].":dn:=".$m[2]; + } else { + $bases["$oc,$base"][]= $m[1].":dn:=".$m[2]; + } } else { - $bases[$matches[2].",$base"][]= $m[1].":dn:=".$m[2]; + // No, there's no \, in pre defined RDN values + preg_match('/^([^,]+),(.*)$/', $oc, $matches); + preg_match('/([^=]+)=(.*)$/', $matches[1], $m); + if ($flags & GL_SUBSEARCH) { + $bases[$base][]= $m[1].":dn:=".$m[2]; + } else { + $bases[$matches[2].",$base"][]= $m[1].":dn:=".$m[2]; + } } } } @@ -66,11 +70,15 @@ class filterLDAP { // Switch to new base and search $ldap->cd($base); - $dnFilter= "(|"; - foreach ($dnFilters as $df) { - $dnFilter.= "($df)"; + if (is_array($dnFilters)){ + $dnFilter= "(|"; + foreach ($dnFilters as $df) { + $dnFilter.= "($df)"; + } + $dnFilter.= ")"; + } else { + $dnFilter= ""; } - $dnFilter.= ")"; $ldap->search ("(&$filter$dnFilter)", $attributes); // Check for size limit exceeded messages for GUI feedback