diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-11 15:30:44 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-09-14 13:20:51 +0200 |
commit | 5e74affea499607f5ff4724a0748579d15db7a39 (patch) | |
tree | e4d33fa88f7f32ae064c6f4285ce3a7dd0beee37 /apps/user_ldap | |
parent | fc097a80f50d9959c5bccaf9e8ed55adce4be8bd (diff) | |
download | nextcloud-server-5e74affea499607f5ff4724a0748579d15db7a39.tar.gz nextcloud-server-5e74affea499607f5ff4724a0748579d15db7a39.zip |
fix counting found results in search op
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Access.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index e036f6ccb8b..b6674cf0332 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -1030,7 +1030,7 @@ class Access extends LDAPUtility implements IUserTools { * @param array $sr the array containing the LDAP search resources * @param string $filter the LDAP filter for the search * @param array $base an array containing the LDAP subtree(s) that shall be searched - * @param int $iFoundItems number of results in the search operation + * @param int $iFoundItems number of results in the single search operation * @param int $limit maximum results to be counted * @param int $offset a starting point * @param bool $pagedSearchOK whether a paged search has been executed @@ -1180,15 +1180,18 @@ class Access extends LDAPUtility implements IUserTools { return array(); } + $iFoundItems = 0; foreach($sr as $res) { $findings = array_merge($findings, $this->invokeLDAPMethod('getEntries', $cr, $res)); + $iFoundItems = max($iFoundItems, $findings['count']); + unset($findings['count']); } - $continue = $this->processPagedSearchStatus($sr, $filter, $base, $findings['count'], + $continue = $this->processPagedSearchStatus($sr, $filter, $base, $iFoundItems, $limitPerPage, $offset, $pagedSearchOK, $skipHandling); $offset += $limitPerPage; - } while ($continue && $pagedSearchOK && ($limit === null || $findings['count'] < $limit)); + } while ($continue && $pagedSearchOK && ($limit === null || count($findings) < $limit)); // reseting offset $offset = $savedoffset; |