diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-10-01 00:30:05 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-10-05 19:10:30 +0200 |
commit | 353a8e442f895500b8f324c2dc4afd389ac52425 (patch) | |
tree | 84e34d58ecd2844e3cdd1ae87784ad56bfade246 /apps/user_ldap/lib/access.php | |
parent | cf9fb034c436825cee2e90dc8ec3b30b3c93d222 (diff) | |
download | nextcloud-server-353a8e442f895500b8f324c2dc4afd389ac52425.tar.gz nextcloud-server-353a8e442f895500b8f324c2dc4afd389ac52425.zip |
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.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 2a605a2a0f0..e5bb4fc10f6 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -1467,6 +1467,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 |