From 42d3ed47e23724419aeed0df5ccedec6f92ac172 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@owncloud.com>
Date: Thu, 5 Mar 2015 13:15:21 +0100
Subject: [PATCH] set up paged search when limit is 0

---
 apps/user_ldap/lib/access.php | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index ebd34d5b94..c1b6ebaf1c 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -1443,6 +1443,17 @@ class Access extends LDAPUtility implements user\IUserTools {
 				}
 
 			}
+		} else if($this->connection->hasPagedResultSupport && $limit === 0) {
+			// a search without limit was requested. However, if we do use
+			// Paged Search once, we always must do it. This requires us to
+			// initialize it with the configured page size.
+			$this->abandonPagedSearch();
+			// in case someone set it to 0 … use 500, otherwise no results will
+			// be returned.
+			$pageSize = intval($this->connection->ldapPagingSize) > 0 ? intval($this->connection->ldapPagingSize) : 500;
+			$pagedSearchOK = $this->ldap->controlPagedResult(
+				$this->connection->getConnectionResource(), $pageSize, false, ''
+			);
 		}
 
 		return $pagedSearchOK;
-- 
GitLab