diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-03-15 14:16:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 14:16:42 +0100 |
commit | 95eefd38eb69a41aaa9e8e5800e0f88756df37f4 (patch) | |
tree | 30f519ec425b7a3de25d0a4a7461142d2659e952 | |
parent | 8568c11d24736d4df1b9781c4121cf7165f40f65 (diff) | |
parent | d82d6df646e052a10540779923ca245d3dd105bd (diff) | |
download | nextcloud-server-95eefd38eb69a41aaa9e8e5800e0f88756df37f4.tar.gz nextcloud-server-95eefd38eb69a41aaa9e8e5800e0f88756df37f4.zip |
Merge pull request #37197 from nextcloud/fix/user_ldap-do-not-send-0-size-pagination-control
Do not send a pagination control with size = 0 if cookie is empty
-rw-r--r-- | apps/user_ldap/lib/LDAP.php | 22 |
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]) ) { |