summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/access.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-07 14:55:48 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-07 14:55:48 +0200
commitc8021441d0cd3090b4406f445139f65d1045a460 (patch)
tree6f421616d41ebcea92a91279d7c705a80dbca691 /apps/user_ldap/lib/access.php
parent70ba594f45d624a2d95a0a3f5bb9b014fdbc3e21 (diff)
parent353a8e442f895500b8f324c2dc4afd389ac52425 (diff)
downloadnextcloud-server-c8021441d0cd3090b4406f445139f65d1045a460.tar.gz
nextcloud-server-c8021441d0cd3090b4406f445139f65d1045a460.zip
Merge pull request #19489 from owncloud/fix-18297
fix possible infinite loop when reading groups in the wizard
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r--apps/user_ldap/lib/access.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index a2fdd88a240..0707b95013c 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -1468,6 +1468,30 @@ class Access extends LDAPUtility implements user\IUserTools {
}
/**
+ * checks whether an LDAP paged search operation has more pages that can be
+ * retrieved, typically when offset and limit are provided.
+ *
+ * Be very careful to use it: the last cookie value, which is inspected, can
+ * be reset by other operations. Best, call it immediately after a search(),
+ * searchUsers() or searchGroups() call. count-methods are probably safe as
+ * well. Don't rely on it with any fetchList-method.
+ * @return bool
+ */
+ public function hasMoreResults() {
+ if(!$this->connection->hasPagedResultSupport) {
+ return false;
+ }
+
+ if(empty($this->lastCookie) && $this->lastCookie !== '0') {
+ // as in RFC 2696, when all results are returned, the cookie will
+ // be empty.
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* set a cookie for LDAP paged search run
* @param string $base a string with the base DN for the search
* @param string $filter the search filter to identify the correct search