From: cajus Date: Wed, 29 Oct 2008 08:15:40 +0000 (+0000) Subject: Improved filter check speed X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e6c41e7488376179bca0524c5eb293cc42e6df3d;p=gosa.git Improved filter check speed git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@12795 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index a28a15138..310781c19 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -293,6 +293,19 @@ class LDAP{ } } + function object_match_filter($dn,$filter) + { + if($this->hascon){ + if ($this->reconnect) $this->connect(); + $res = @ldap_read($this->cid, LDAP::fix($dn), $filter, array("objectClass")); + $rv = @ldap_count_entries($this->cid, $res); + return($rv); + }else{ + $this->error = "Could not connect to LDAP server"; + return(FALSE); + } + } + function set_size_limit($size) { /* Ignore zero settings */ diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index ce80f8bde..6d8955209 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -349,22 +349,8 @@ class userinfo /* With user filter */ if (isset($subacl['filter']) && !empty($subacl['filter'])){ - $sdn = preg_replace("/^[^,]*+,/","",$dn); - $ldap->cd($sdn); - $ldap->ls($subacl['filter'],$sdn); - if(!$ldap->count()){ + if(!$ldap->object_match_filter($dn,$subacl['filter'])){ continue; - }else{ - $found = FALSE; - while($attrs = $ldap->fetch()){ - if($attrs['dn'] == $dn){ - $found = TRUE; - break; - } - } - if(!$found){ - continue; - } } }