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

neil_a_wilson
07.39.2007 069dda19264fd479c0022e278c8095205443ca5e
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -1898,17 +1898,31 @@
    // See if this is an LDAPv2 bind request, and if so whether that should be
    // allowed.
    ldapVersion = protocolOp.getProtocolVersion();
    if ((ldapVersion == 2) && (! connectionHandler.allowLDAPv2()))
    String versionString;
    switch (ldapVersion = protocolOp.getProtocolVersion())
    {
      BindResponseProtocolOp responseOp =
           new BindResponseProtocolOp(
                    LDAPResultCode.INAPPROPRIATE_AUTHENTICATION,
                    getMessage(MSGID_LDAPV2_CLIENTS_NOT_ALLOWED));
      sendLDAPMessage(securityProvider,
                      new LDAPMessage(message.getMessageID(), responseOp));
      disconnect(DisconnectReason.PROTOCOL_ERROR, false, null, -1);
      return false;
      case 2:
        versionString = "2";
        if (! connectionHandler.allowLDAPv2())
        {
          BindResponseProtocolOp responseOp =
               new BindResponseProtocolOp(
                        LDAPResultCode.INAPPROPRIATE_AUTHENTICATION,
                        getMessage(MSGID_LDAPV2_CLIENTS_NOT_ALLOWED));
          sendLDAPMessage(securityProvider,
                          new LDAPMessage(message.getMessageID(), responseOp));
          disconnect(DisconnectReason.PROTOCOL_ERROR, false, null, -1);
          return false;
        }
        break;
      case 3:
        versionString = "3";
        break;
      default:
        versionString = String.valueOf(ldapVersion);
        break;
    }
@@ -1919,12 +1933,14 @@
    {
      case SIMPLE:
        bindOp = new BindOperation(this, nextOperationID.getAndIncrement(),
                                   message.getMessageID(), controls, bindDN,
                                   message.getMessageID(), controls,
                                   versionString, bindDN,
                                   protocolOp.getSimplePassword());
        break;
      case SASL:
        bindOp = new BindOperation(this, nextOperationID.getAndIncrement(),
                                   message.getMessageID(), controls, bindDN,
                                   message.getMessageID(), controls,
                                   versionString, bindDN,
                                   protocolOp.getSASLMechanism(),
                                   protocolOp.getSASLCredentials());
        break;