From 069dda19264fd479c0022e278c8095205443ca5e Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 06 Apr 2007 23:39:26 +0000
Subject: [PATCH] Update the bind operation so that it provides access to the protocol version. Note that the protocol version is formatted as a string, because it may not necessarily always be purely numeric.
---
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 267c162..5149cc9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/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;
--
Gitblit v1.10.0