aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Access.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-25 17:23:42 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-25 17:23:42 +0200
commit3628d4d65d67d12afc93d969de61cb06a33179fd (patch)
treeeb086eb66c4a14a16760c699422eafa67cf9b21f /apps/user_ldap/lib/Access.php
parentfb40afc4d4cb8e5cc28185c65b6fd9d87992101c (diff)
downloadnextcloud-server-3628d4d65d67d12afc93d969de61cb06a33179fd.tar.gz
nextcloud-server-3628d4d65d67d12afc93d969de61cb06a33179fd.zip
avoid unnecessary recursion
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Access.php')
-rw-r--r--apps/user_ldap/lib/Access.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index b6674cf0332..bbf07165090 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -1853,20 +1853,19 @@ class Access extends LDAPUtility implements IUserTools {
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
if(empty($cookie) && $cookie !== "0" && ($offset > 0)) {
- // no cookie known, although the offset is not 0. Maybe cache run out. We need
- // to start all over *sigh* (btw, Dear Reader, did you know LDAP paged
- // searching was designed by MSFT?)
- // Lukas: No, but thanks to reading that source I finally know!
- // '0' is valid, because 389ds
- $reOffset = ($offset - $limit) < 0 ? 0 : $offset - $limit;
- //a bit recursive, $offset of 0 is the exit
- \OCP\Util::writeLog('user_ldap', 'Looking for cookie L/O '.$limit.'/'.$reOffset, \OCP\Util::INFO);
- $this->search($filter, array($base), $attr, $limit, $reOffset, true);
+ // no cookie known from a potential previous search. We need
+ // to start from 0 to come to the desired page. cookie value
+ // of '0' is valid, because 389ds
+ $reOffset = 0;
+ while($reOffset < $offset) {
+ $this->search($filter, array($base), $attr, $limit, $reOffset, true);
+ $reOffset += $limit;
+ }
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
//still no cookie? obviously, the server does not like us. Let's skip paging efforts.
+ // '0' is valid, because 389ds
//TODO: remember this, probably does not change in the next request...
if(empty($cookie) && $cookie !== '0') {
- // '0' is valid, because 389ds
$cookie = null;
}
}