From 115c4c54b75791d80f7ab620003f89f4b12501fb Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 16 May 2014 10:34:32 +0200 Subject: [PATCH] Rename kolab_auth_ldap::search() method because its signature doesn't match rcube_ldap_generic::search() and fails recursive calls in VLV search mode + add return parameter for results count --- plugins/kolab_auth/kolab_auth_ldap.php | 6 ++++-- plugins/kolab_delegation/kolab_delegation_engine.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/kolab_auth/kolab_auth_ldap.php b/plugins/kolab_auth/kolab_auth_ldap.php index 7044ebf2..40237ac3 100644 --- a/plugins/kolab_auth/kolab_auth_ldap.php +++ b/plugins/kolab_auth/kolab_auth_ldap.php @@ -215,10 +215,11 @@ class kolab_auth_ldap extends rcube_ldap_generic * 2 - prefix (abc*) * @param array $required List of fields that cannot be empty * @param int $limit Number of records + * @param int $count Returns the number of records found * * @return array List or false on error */ - function search($fields, $value, $mode=1, $required = array(), $limit = 0) + function dosearch($fields, $value, $mode=1, $required = array(), $limit = 0, &$count = 0) { if (empty($fields)) { return array(); @@ -295,7 +296,8 @@ class kolab_auth_ldap extends rcube_ldap_generic $attrs = array_values($this->fieldmap); $list = array(); - if ($result = parent::search($base_dn, $filter, $scope, $attrs)) { + if ($result = $this->search($base_dn, $filter, $scope, $attrs)) { + $count = $result->count(); $i = 0; foreach ($result as $entry) { if ($limit && $limit <= $i) { diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php b/plugins/kolab_delegation/kolab_delegation_engine.php index ad96831b..3d3bd337 100644 --- a/plugins/kolab_delegation/kolab_delegation_engine.php +++ b/plugins/kolab_delegation/kolab_delegation_engine.php @@ -202,7 +202,7 @@ class kolab_delegation_engine return array(); } - $list = $ldap->search($this->ldap_login_field, $login, 1); + $list = $ldap->dosearch($this->ldap_login_field, $login, 1); if (count($list) == 1) { $dn = key($list); @@ -288,7 +288,7 @@ class kolab_delegation_engine return array(); } - $list = $ldap->search($this->ldap_delegate_field, $this->ldap_dn, 1); + $list = $ldap->dosearch($this->ldap_delegate_field, $this->ldap_dn, 1); foreach ($list as $dn => $delegator) { $delegator = $this->parse_ldap_record($delegator, $dn); @@ -424,7 +424,7 @@ class kolab_delegation_engine $fields = array_unique(array_filter(array_merge((array)$this->ldap_name_field, (array)$this->ldap_login_field))); $users = array(); - $result = $ldap->search($fields, $search, $mode, (array)$this->ldap_login_field, $max); + $result = $ldap->dosearch($fields, $search, $mode, (array)$this->ldap_login_field, $max); foreach ($result as $record) { // skip self