From 972f8c008dbf6176884f5a40f57031e39f6b4e18 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Wed, 07 Aug 2024 15:44:58 +0000
Subject: [PATCH] [#294] Dont send client notification on IOException (#374)
---
opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPClientConnection2.java | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPClientConnection2.java b/opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPClientConnection2.java
index defc825..ab47f5f 100644
--- a/opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPClientConnection2.java
+++ b/opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPClientConnection2.java
@@ -25,6 +25,7 @@
import static org.opends.server.util.ServerConstants.OID_START_TLS_REQUEST;
import static org.opends.server.util.StaticUtils.*;
+import java.io.IOException;
import java.net.InetAddress;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.Selector;
@@ -42,6 +43,7 @@
import java.util.concurrent.atomic.AtomicLong;
import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import javax.security.sasl.SaslServer;
@@ -235,8 +237,9 @@
if (error instanceof LocalizableException) {
disconnect(
DisconnectReason.PROTOCOL_ERROR, true, ((LocalizableException) error).getMessageObject());
+
} else {
- disconnect(DisconnectReason.PROTOCOL_ERROR, true, null);
+ disconnect(DisconnectReason.PROTOCOL_ERROR, (!(error instanceof IOException)), null);
}
}
@@ -651,7 +654,7 @@
// See if we should send a notification to the client. If so, then
// construct and send a notice of disconnection unsolicited
// response. Note that we cannot send this notification to an LDAPv2 client.
- if (sendNotification && ldapVersion != 2) {
+ if (sendNotification && ldapVersion != 2 && !clientContext.isClosed()) {
try {
LocalizableMessage errMsg = message != null ? message
: INFO_LDAP_CLIENT_GENERIC_NOTICE_OF_DISCONNECTION.get();
--
Gitblit v1.10.0