From f84ec9256367758b65f37db5f0bc81a9ed2b8d13 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@arthur-schiwon.de>
Date: Thu, 11 Jan 2018 15:17:18 +0100
Subject: [PATCH] revert resolving of recursion
 (3628d4d65d67d12afc93d969de61cb06a33179fd)

without recursion we have issues with internal states. paged search status
are set to false, cookies are not being set. In the end we have  endless
requests which pile up enormously with a high initial offset.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
---
 apps/user_ldap/lib/Access.php | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index d07a8a030a3..b84f5a38b31 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -1914,11 +1914,8 @@ class Access extends LDAPUtility implements IUserTools {
 					// 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;
-					}
+					$reOffset = ($offset - $limit) < 0 ? 0 : $offset - $limit;
+					$this->search($filter, array($base), $attr, $limit, $reOffset, true);
 					$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
-- 
GitLab