diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-11-21 14:51:20 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-11-21 14:51:20 +0100 |
commit | c07c338c908653d694df4457dc1739122a1f594c (patch) | |
tree | c5ed3b2582e6c5c5ad3d1c4f0a948b62d2e5a26d /apps/user_ldap/lib | |
parent | b5e707b1bfbe9cddafe2edb0232bc032cb892a2e (diff) | |
download | nextcloud-server-c07c338c908653d694df4457dc1739122a1f594c.tar.gz nextcloud-server-c07c338c908653d694df4457dc1739122a1f594c.zip |
fix counting when ldapPagingSize is 0
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/access.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index a0ec64b3f60..6f28a87d30c 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -813,7 +813,7 @@ class Access extends LDAPUtility implements user\IUserTools { } //check whether paged search should be attempted - $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, $limit, $offset); + $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, intval($limit), $offset); $linkResources = array_pad(array(), count($base), $cr); $sr = $this->ldap->search($linkResources, $base, $filter, $attr); @@ -887,10 +887,9 @@ class Access extends LDAPUtility implements user\IUserTools { private function count($filter, $base, $attr = null, $limit = null, $offset = null, $skipHandling = false) { \OCP\Util::writeLog('user_ldap', 'Count filter: '.print_r($filter, true), \OCP\Util::DEBUG); - $limitPerPage = (intval($limit) < intval($this->connection->ldapPagingSize)) ? - intval($limit) : intval($this->connection->ldapPagingSize); - if(is_null($limit) || $limit <= 0) { - $limitPerPage = intval($this->connection->ldapPagingSize); + $limitPerPage = intval($this->connection->ldapPagingSize); + if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) { + $limitPerPage = $limit; } $counter = 0; @@ -1472,7 +1471,7 @@ class Access extends LDAPUtility implements user\IUserTools { */ private function initPagedSearch($filter, $bases, $attr, $limit, $offset) { $pagedSearchOK = false; - if($this->connection->hasPagedResultSupport && !is_null($limit)) { + if($this->connection->hasPagedResultSupport && ($limit !== 0)) { $offset = intval($offset); //can be null \OCP\Util::writeLog('user_ldap', 'initializing paged search for Filter '.$filter.' base '.print_r($bases, true) |