mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
20.46.2011 d2292042c563f8ac7a327a481c41e06f2aede616
Fix OPENDJ-289: Don't fail requests using the result code returned in a disconnect notification
1 files modified
22 ■■■■■ changed files
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java 22 ●●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
@@ -877,7 +877,24 @@
      }
      // Mark the connection as invalid.
      connectionInvalidReason = reason;
      if (!isDisconnectNotification)
      {
        // Connection termination was detected locally, so use the provided
        // reason for all subsequent requests.
        connectionInvalidReason = reason;
      }
      else
      {
        // Connection termination was triggered remotely. We don't want to
        // blindly pass on the result code to requests since it could be
        // confused for a genuine response. For example, if the disconnect
        // contained the invalidCredentials result code then this could be
        // misinterpreted as a genuine authentication failure for subsequent
        // bind requests.
        connectionInvalidReason = Responses.newResult(
            ResultCode.CLIENT_SIDE_SERVER_DOWN).setDiagnosticMessage(
            "Connection closed by server");
      }
    }
    // First abort all outstanding requests.
@@ -887,7 +904,7 @@
          .remove(requestID);
      if (future != null)
      {
        future.adaptErrorResult(reason);
        future.adaptErrorResult(connectionInvalidReason);
      }
    }
@@ -937,6 +954,7 @@
    {
      for (final ConnectionEventListener listener : listeners)
      {
        // Use the reason provided in the disconnect notification.
        listener.handleConnectionError(isDisconnectNotification,
            newErrorResult(reason));
      }