summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-03-15 18:16:24 +0100
committerGitHub <noreply@github.com>2023-03-15 18:16:24 +0100
commit4c161a70a4f24c42b3bd37faa6e452b72fe1b100 (patch)
tree6425e02b04776713bd14e3fc6304bf992bdfb450 /apps
parentae34be566e9901a2f87c00ea789eeaf10acd697a (diff)
parentd62643b43ea7e8d106fc416c36988621694ce3cf (diff)
downloadnextcloud-server-4c161a70a4f24c42b3bd37faa6e452b72fe1b100.tar.gz
nextcloud-server-4c161a70a4f24c42b3bd37faa6e452b72fe1b100.zip
Merge pull request #37233 from nextcloud/backport/37197/stable26
[stable26] Do not send a pagination control with size = 0 if cookie is empty
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/LDAP.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php
index 5730907b653..41a6f651f3b 100644
--- a/apps/user_ldap/lib/LDAP.php
+++ b/apps/user_ldap/lib/LDAP.php
@@ -190,14 +190,18 @@ class LDAP implements ILDAPWrapper {
* {@inheritDoc}
*/
public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0, int $pageSize = 0, string $cookie = '') {
- $serverControls = [[
- 'oid' => LDAP_CONTROL_PAGEDRESULTS,
- 'value' => [
- 'size' => $pageSize,
- 'cookie' => $cookie,
- ],
- 'iscritical' => false,
- ]];
+ if ($pageSize > 0 || $cookie !== '') {
+ $serverControls = [[
+ 'oid' => LDAP_CONTROL_PAGEDRESULTS,
+ 'value' => [
+ 'size' => $pageSize,
+ 'cookie' => $cookie,
+ ],
+ 'iscritical' => false,
+ ]];
+ } else {
+ $serverControls = [];
+ }
$oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) {
if (strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) {
@@ -387,7 +391,7 @@ class LDAP implements ILDAPWrapper {
if ($this->isResource($this->curArgs[0])) {
$resource = $this->curArgs[0];
} elseif (
- $functionName === 'ldap_search'
+ $functionName === 'ldap_search'
&& is_array($this->curArgs[0])
&& $this->isResource($this->curArgs[0][0])
) {