From 3cb0779e62e7bb661b308ef21e4a5575cd1a6f54 Mon Sep 17 00:00:00 2001 From: ralf Date: Fri, 3 May 2024 15:17:35 +0200 Subject: [PATCH] some Windows AD seem to get confused by using ldap_get_entries together with ldap_(first|next)_entry check if we got the requested number of entries ($start[1]) back and only continue in that case --- api/src/Contacts/Ldap.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/Contacts/Ldap.php b/api/src/Contacts/Ldap.php index b3a892ac6d..3a86b4df2e 100644 --- a/api/src/Contacts/Ldap.php +++ b/api/src/Contacts/Ldap.php @@ -1388,9 +1388,12 @@ class Ldap } // if we have a non-empty cookie from paged results, continue reading from the server - while (is_array($start) && count($start) === 3 && $start[0] === false && $start[2] !== '') + while (is_array($start) && count($start) === 3 && $start[0] === false && $start[2] !== '' && + // some Windows AD seem to get confused by using ldap_get_entries together with ldap_(first|next)_entry + // check if we got the requested number of entries ($start[1]) back and only continue in that case + count($entries)-1 === $start[1]) { - foreach($this->_searchLDAP($_ldapContext, $_filter, $_attributes, $_addressbooktype, $_skipPlugins, $order_by, $start) as $contact) + foreach($this->_searchLDAP($_ldapContext, $_filter, $_attributes, $_addressbooktype, $_skipPlugins, $order_by, $start, $read_photo) as $contact) { $contacts[] = $contact; }