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

matthew_swift
14.56.2009 e6dc623878d8c85b595d963635e15288fa79c4bc
Fix issue 2896: The server should return "Protocol Error" after a bind with a unrecognised version number

2 files modified
16 ■■■■ changed files
opends/src/messages/messages/protocol.properties 4 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java 12 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/protocol.properties
@@ -20,7 +20,7 @@
#
# CDDL HEADER END
#
#      Copyright 2006-2008 Sun Microsystems, Inc.
#      Copyright 2006-2009 Sun Microsystems, Inc.
@@ -1402,3 +1402,5 @@
 SEVERE_ERR_CONNHANDLER_SSL_CANNOT_INITIALIZE_1504=An error occurred \
 while attempting to initialize the SSL context for use in the LDAP \
 Connection Handler:  %s
MILD_ERR_LDAP_UNSUPPORTED_PROTOCOL_VERSION_1505=The Directory Server does not \
 support LDAP protocol version %d.  This connection will be closed
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -1834,8 +1834,16 @@
      versionString = "3";
      break;
    default:
      versionString = String.valueOf(ldapVersion);
      break;
      // Unsupported protocol version. RFC4511 states that we MUST send
      // a protocol error back to the client.
      BindResponseProtocolOp responseOp =
          new BindResponseProtocolOp(LDAPResultCode.PROTOCOL_ERROR,
              ERR_LDAP_UNSUPPORTED_PROTOCOL_VERSION.get(ldapVersion));
      sendLDAPMessage(new LDAPMessage(message.getMessageID(),
          responseOp));
      disconnect(DisconnectReason.PROTOCOL_ERROR, false,
          ERR_LDAP_UNSUPPORTED_PROTOCOL_VERSION.get(ldapVersion));
      return false;
    }
    ByteString bindDN = protocolOp.getDN();