From 5fcc9e4d84b73663d52b1d4fe1aee42d48222bc4 Mon Sep 17 00:00:00 2001 From: Redjard Date: Sat, 3 Jun 2023 06:21:58 +0200 Subject: [PATCH] Send 32 instead of 2 for empty SearchResultDone Send NO_SUCH_OBJECT (32) instead of SUCCESS (2) as code of SearchResultDone message when no entries where returned. This matches the ldap spec, and behavior of other ldap server implementations. --- .../Ldap/Protocol/ServerProtocolHandler/ServerSearchTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerSearchTrait.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerSearchTrait.php index e9eba934..1c968373 100644 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerSearchTrait.php +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerSearchTrait.php @@ -49,7 +49,7 @@ private function sendEntriesToClient( $messages[] = new LdapMessageResponse( $message->getMessageId(), - new SearchResultDone(ResultCode::SUCCESS), + new SearchResultDone( $entries->count() ? ResultCode::SUCCESS : ResultCode::NO_SUCH_OBJECT ), ...$controls );