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/jmx/RmiAuthenticator.java | 7
opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationBindOperation.java | 11 +
opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseBindOperation.java | 11 +
opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationBindOperation.java | 11 +
opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java | 20 +++
opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java | 65 +++++++++-
opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java | 27 +++-
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java | 114 ++++++++++++------
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java | 6
opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseBindOperation.java | 23 +++
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 40 ++++--
11 files changed, 260 insertions(+), 75 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
index 2c75910..e269787 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
@@ -100,9 +100,6 @@
implements PreParseBindOperation, PreOperationBindOperation,
PostOperationBindOperation, PostResponseBindOperation
{
-
-
-
// The credentials used for SASL authentication.
private ASN1OctetString saslCredentials;
@@ -182,6 +179,9 @@
// A message explaining the reason for the authentication failure.
private String authFailureReason;
+ // A string representation of the protocol version for this bind operation.
+ private String protocolVersion;
+
// The SASL mechanism used for SASL authentication.
private String saslMechanism;
@@ -196,6 +196,8 @@
* @param messageID The message ID of the request with which this
* operation is associated.
* @param requestControls The set of controls included in the request.
+ * @param protocolVersion The string representation of the protocol version
+ * associated with this bind request.
* @param rawBindDN The raw, unprocessed bind DN as provided in the
* request from the client.
* @param simplePassword The password to use for the simple
@@ -203,11 +205,13 @@
*/
public BindOperation(ClientConnection clientConnection, long operationID,
int messageID, List<Control> requestControls,
- ByteString rawBindDN, ByteString simplePassword)
+ String protocolVersion, ByteString rawBindDN,
+ ByteString simplePassword)
{
super(clientConnection, operationID, messageID, requestControls);
+ this.protocolVersion = protocolVersion;
this.authType = AuthenticationType.SIMPLE;
this.saslMechanism = null;
this.saslCredentials = null;
@@ -257,6 +261,8 @@
* @param messageID The message ID of the request with which this
* operation is associated.
* @param requestControls The set of controls included in the request.
+ * @param protocolVersion The string representation of the protocol version
+ * associated with this bind request.
* @param rawBindDN The raw, unprocessed bind DN as provided in the
* request from the client.
* @param saslMechanism The SASL mechanism included in the request.
@@ -265,12 +271,13 @@
*/
public BindOperation(ClientConnection clientConnection, long operationID,
int messageID, List<Control> requestControls,
- ByteString rawBindDN, String saslMechanism,
- ASN1OctetString saslCredentials)
+ String protocolVersion, ByteString rawBindDN,
+ String saslMechanism, ASN1OctetString saslCredentials)
{
super(clientConnection, operationID, messageID, requestControls);
+ this.protocolVersion = protocolVersion;
this.authType = AuthenticationType.SASL;
this.saslMechanism = saslMechanism;
this.saslCredentials = saslCredentials;
@@ -305,17 +312,21 @@
* @param messageID The message ID of the request with which this
* operation is associated.
* @param requestControls The set of controls included in the request.
+ * @param protocolVersion The string representation of the protocol version
+ * associated with this bind request.
* @param bindDN The bind DN for this bind operation.
* @param simplePassword The password to use for the simple
* authentication.
*/
public BindOperation(ClientConnection clientConnection, long operationID,
- int messageID, List<Control> requestControls, DN bindDN,
+ int messageID, List<Control> requestControls,
+ String protocolVersion, DN bindDN,
ByteString simplePassword)
{
super(clientConnection, operationID, messageID, requestControls);
+ this.protocolVersion = protocolVersion;
this.authType = AuthenticationType.SIMPLE;
this.bindDN = bindDN;
this.saslMechanism = null;
@@ -365,18 +376,22 @@
* @param messageID The message ID of the request with which this
* operation is associated.
* @param requestControls The set of controls included in the request.
+ * @param protocolVersion The string representation of the protocol version
+ * associated with this bind request.
* @param bindDN The bind DN for this bind operation.
* @param saslMechanism The SASL mechanism included in the request.
* @param saslCredentials The optional SASL credentials included in the
* request.
*/
public BindOperation(ClientConnection clientConnection, long operationID,
- int messageID, List<Control> requestControls, DN bindDN,
+ int messageID, List<Control> requestControls,
+ String protocolVersion, DN bindDN,
String saslMechanism, ASN1OctetString saslCredentials)
{
super(clientConnection, operationID, messageID, requestControls);
+ this.protocolVersion = protocolVersion;
this.authType = AuthenticationType.SASL;
this.bindDN = bindDN;
this.saslMechanism = saslMechanism;
@@ -452,6 +467,34 @@
/**
+ * Retrieves a string representation of the protocol version associated with
+ * this bind request.
+ *
+ * @return A string representation of the protocol version associated with
+ * this bind request.
+ */
+ public String getProtocolVersion()
+ {
+ return protocolVersion;
+ }
+
+
+
+ /**
+ * Specifies the string representation of the protocol version associated with
+ * this bind request.
+ *
+ * @param protocolVersion The string representation of the protocol version
+ * associated with this bind request.
+ */
+ public void setProtocolVersion(String protocolVersion)
+ {
+ this.protocolVersion = protocolVersion;
+ }
+
+
+
+ /**
* Retrieves the bind DN for this bind operation. This method should not be
* called by pre-parse plugins, as the raw value will not have been processed
* by that time. Instead, pre-parse plugins should call the
@@ -2288,7 +2331,11 @@
buffer.append(clientConnection.getConnectionID());
buffer.append(", opID=");
buffer.append(operationID);
- buffer.append(", dn=");
+ buffer.append(", protocol=\"");
+ buffer.append(clientConnection.getProtocol());
+ buffer.append(" ");
+ buffer.append(protocolVersion);
+ buffer.append("\", dn=");
buffer.append(rawBindDN);
buffer.append(", authType=");
buffer.append(authType);
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
index 6c3467b..b3cdec4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -102,6 +102,15 @@
public class InternalClientConnection
extends ClientConnection
{
+ /**
+ * The protocol verison string that will be used for internal bind
+ * operations. Since this is modeled after LDAPv3 binds, it will
+ * use a version number string of "3".
+ */
+ public static final String PROTOCOL_VERSION = "3";
+
+
+
// The message ID counter to use for internal connections.
private static AtomicInteger nextMessageID;
@@ -725,8 +734,8 @@
{
BindOperation bindOperation =
new BindOperation(this, nextOperationID(), nextMessageID(),
- new ArrayList<Control>(0), rawBindDN,
- password);
+ new ArrayList<Control>(0),
+ PROTOCOL_VERSION, rawBindDN, password);
bindOperation.setInternalOperation(true);
bindOperation.run();
@@ -752,8 +761,8 @@
{
BindOperation bindOperation =
new BindOperation(this, nextOperationID(), nextMessageID(),
- new ArrayList<Control>(0), bindDN,
- password);
+ new ArrayList<Control>(0),
+ PROTOCOL_VERSION, bindDN, password);
bindOperation.setInternalOperation(true);
bindOperation.run();
@@ -781,8 +790,9 @@
{
BindOperation bindOperation =
new BindOperation(this, nextOperationID(), nextMessageID(),
- new ArrayList<Control>(0), rawBindDN,
- saslMechanism, saslCredentials);
+ new ArrayList<Control>(0),
+ PROTOCOL_VERSION, rawBindDN, saslMechanism,
+ saslCredentials);
bindOperation.setInternalOperation(true);
bindOperation.run();
@@ -810,8 +820,9 @@
{
BindOperation bindOperation =
new BindOperation(this, nextOperationID(), nextMessageID(),
- new ArrayList<Control>(0), bindDN,
- saslMechanism, saslCredentials);
+ new ArrayList<Control>(0),
+ PROTOCOL_VERSION, bindDN, saslMechanism,
+ saslCredentials);
bindOperation.setInternalOperation(true);
bindOperation.run();
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java
index e3f9316..521dbd8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiAuthenticator.java
@@ -258,9 +258,10 @@
jmxConnectionHandler, authInfo);
BindOperation bindOp = new BindOperation(jmxClientConnection,
- jmxClientConnection.nextOperationID(), jmxClientConnection
- .nextMessageID(), requestControls, new ASN1OctetString(authcID),
- bindPW);
+ jmxClientConnection.nextOperationID(),
+ jmxClientConnection.nextMessageID(), requestControls,
+ jmxConnectionHandler.getRMIConnector().getProtocolVersion(),
+ new ASN1OctetString(authcID), bindPW);
bindOp.run();
if (bindOp.getResultCode() == ResultCode.SUCCESS)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
index 59fdc4b..0c1a3d4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
@@ -128,7 +128,12 @@
/**
* The Underlying Socket factory.
*/
- OpendsRmiServerSocketFactory rmiSsf;
+ private OpendsRmiServerSocketFactory rmiSsf;
+
+ /**
+ * The RMI protocol verison used by this connector.
+ */
+ private String rmiVersion;
// ===================================================================
// CONSTRUCTOR
@@ -398,6 +403,7 @@
// TODO Should we do that?
ObjectName name = new ObjectName(jmxRmiConnectorNoClientCertificateName);
mbs.registerMBean(jmxRmiConnectorNoClientCertificate, name);
+ rmiVersion = opendsRmiConnectorServer.getVersion();
if (debugEnabled())
{
@@ -505,4 +511,16 @@
}
}
+
+
+
+ /**
+ * Retrieves the RMI protocol version string in use for this connector.
+ *
+ * @return The RMI protocol version string in use for this connector.
+ */
+ public String getProtocolVersion()
+ {
+ return rmiVersion;
+ }
}
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;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationBindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationBindOperation.java
index a5cc1cb..4478d61 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationBindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationBindOperation.java
@@ -55,6 +55,17 @@
/**
+ * Retrieves a string representation of the protocol version
+ * associated with this bind request.
+ *
+ * @return A string representation of the protocol version
+ * associated with this bind request.
+ */
+ public String getProtocolVersion();
+
+
+
+ /**
* Retrieves the raw, unprocessed bind DN for this bind operation as
* contained in the client request. The value may not actually
* contain a valid DN, as no validation will have been performed.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseBindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseBindOperation.java
index cd453a9..eb0789d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseBindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseBindOperation.java
@@ -55,6 +55,17 @@
/**
+ * Retrieves a string representation of the protocol version
+ * associated with this bind request.
+ *
+ * @return A string representation of the protocol version
+ * associated with this bind request.
+ */
+ public String getProtocolVersion();
+
+
+
+ /**
* Retrieves the raw, unprocessed bind DN for this bind operation as
* contained in the client request. The value may not actually
* contain a valid DN, as no validation will have been performed.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationBindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationBindOperation.java
index 03d4822..55abb8a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationBindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationBindOperation.java
@@ -54,6 +54,17 @@
/**
+ * Retrieves a string representation of the protocol version
+ * associated with this bind request.
+ *
+ * @return A string representation of the protocol version
+ * associated with this bind request.
+ */
+ public String getProtocolVersion();
+
+
+
+ /**
* Retrieves the raw, unprocessed bind DN for this bind operation as
* contained in the client request. The value may not actually
* contain a valid DN, as no validation will have been performed.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseBindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseBindOperation.java
index cb6c335..2389dfd 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseBindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseBindOperation.java
@@ -53,6 +53,29 @@
/**
+ * Retrieves a string representation of the protocol version
+ * associated with this bind request.
+ *
+ * @return A string representation of the protocol version
+ * associated with this bind request.
+ */
+ public String getProtocolVersion();
+
+
+
+ /**
+ * Specifies the string representation of the protocol version
+ * associated with this bind request.
+ *
+ * @param protocolVersion The string representation of the
+ * protocol version associated with this
+ * bind request.
+ */
+ public void setProtocolVersion(String protocolVersion);
+
+
+
+ /**
* Retrieves the raw, unprocessed bind DN for this bind operation as
* contained in the client request. The value may not actually
* contain a valid DN, as no validation will have been performed.
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
index c225fd2..58860e3 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
@@ -96,43 +96,45 @@
BindOperation[] simpleBinds = new BindOperation[]
{
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, new ASN1OctetString(), new ASN1OctetString()),
- new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, new ASN1OctetString(),
+ null, "3", new ASN1OctetString(),
new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullOS, new ASN1OctetString()),
+ noControls, "3", new ASN1OctetString(),
+ new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullOS, new ASN1OctetString()),
+ null, "3", nullOS, new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, new ASN1OctetString(), nullOS),
+ noControls, "3", nullOS, new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, new ASN1OctetString(), nullOS),
+ null, "3", new ASN1OctetString(), nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullOS, nullOS),
+ noControls, "3", new ASN1OctetString(), nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullOS, nullOS),
+ null, "3", nullOS, nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, new ASN1OctetString("cn=Directory Manager"),
+ noControls, "3", nullOS, nullOS),
+ new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
+ noControls, "3",
+ new ASN1OctetString("cn=Directory Manager"),
new ASN1OctetString("password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, DN.nullDN(), new ASN1OctetString()),
+ null, "3", DN.nullDN(), new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, DN.nullDN(), new ASN1OctetString()),
+ noControls, "3", DN.nullDN(), new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullDN, new ASN1OctetString()),
+ null, "3", nullDN, new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullDN, new ASN1OctetString()),
+ noControls, "3", nullDN, new ASN1OctetString()),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, DN.nullDN(), nullOS),
+ null, "3", DN.nullDN(), nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, DN.nullDN(), nullOS),
+ noControls, "3", DN.nullDN(), nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullDN, nullOS),
+ null, "3", nullDN, nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullDN, nullOS),
+ noControls, "3", nullDN, nullOS),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, DN.decode("cn=Directory Manager"),
+ noControls, "3", DN.decode("cn=Directory Manager"),
new ASN1OctetString("password"))
};
@@ -167,44 +169,45 @@
BindOperation[] saslBinds = new BindOperation[]
{
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, new ASN1OctetString(), "EXTERNAL", null),
+ null, "3", new ASN1OctetString(), "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, new ASN1OctetString(), "EXTERNAL", null),
+ noControls, "3", new ASN1OctetString(), "EXTERNAL",
+ null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullOS, "EXTERNAL", null),
+ null, "3", nullOS, "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullOS, "EXTERNAL", null),
+ noControls, "3", nullOS, "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, new ASN1OctetString(), "PLAIN",
+ null, "3", new ASN1OctetString(), "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, new ASN1OctetString(), "PLAIN",
+ noControls, "3", new ASN1OctetString(), "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullOS, "PLAIN",
+ null, "3", nullOS, "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullOS, "PLAIN",
+ noControls, "3", nullOS, "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, DN.nullDN(), "EXTERNAL", null),
+ null, "3", DN.nullDN(), "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, DN.nullDN(), "EXTERNAL", null),
+ noControls, "3", DN.nullDN(), "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullDN, "EXTERNAL", null),
+ null, "3", nullDN, "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullDN, "EXTERNAL", null),
+ noControls, "3", nullDN, "EXTERNAL", null),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, DN.nullDN(), "PLAIN",
+ null, "3", DN.nullDN(), "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, DN.nullDN(), "PLAIN",
+ noControls, "3", DN.nullDN(), "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- null, nullDN, "PLAIN",
+ null, "3", nullDN, "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password")),
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- noControls, nullDN, "PLAIN",
+ noControls, "3", nullDN, "PLAIN",
new ASN1OctetString("\u0000u:test.user\u0000password"))
};
@@ -276,6 +279,35 @@
/**
+ * Tests the <CODE>getGetProtocolVersion</CODE> method for simple bind
+ * operations.
+ *
+ * @param o The bind operation to be tested.
+ */
+ @Test(dataProvider = "simpleBinds")
+ public void testGetProtocolVersionSimple(BindOperation o)
+ {
+ assertNotNull(o.getProtocolVersion());
+ assertTrue(o.getProtocolVersion().length() > 0);
+ }
+
+
+
+ /**
+ * Tests the <CODE>getProtocolVersion</CODE> method for SASL bind operations.
+ *
+ * @param o The bind operation to be tested.
+ */
+ @Test(dataProvider = "saslBinds")
+ public void testGetProtocolVersionSASL(BindOperation o)
+ {
+ assertNotNull(o.getProtocolVersion());
+ assertTrue(o.getProtocolVersion().length() > 0);
+ }
+
+
+
+ /**
* Tests the <CODE>getRawBindDN</CODE> method for simple bind operations.
*
* @param o The bind operation to be tested.
@@ -1636,7 +1668,8 @@
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- requestControls, DN.nullDN(), new ASN1OctetString());
+ requestControls, "3", DN.nullDN(),
+ new ASN1OctetString());
bindOperation.run();
assertEquals(bindOperation.getResultCode(),
ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);
@@ -1662,7 +1695,8 @@
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- requestControls, DN.nullDN(), "PLAIN", saslCreds);
+ requestControls, "3", DN.nullDN(), "PLAIN",
+ saslCreds);
bindOperation.run();
assertEquals(bindOperation.getResultCode(),
ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);
@@ -1685,7 +1719,8 @@
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- requestControls, DN.nullDN(), new ASN1OctetString());
+ requestControls, "3", DN.nullDN(),
+ new ASN1OctetString());
bindOperation.run();
assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
}
@@ -1710,7 +1745,8 @@
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- requestControls, DN.nullDN(), "PLAIN", saslCreds);
+ requestControls, "3", DN.nullDN(), "PLAIN",
+ saslCreds);
bindOperation.run();
assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java
index d6543d2..683a7a8 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandlerTestCase.java
@@ -139,7 +139,7 @@
InternalClientConnection.getRootConnection();
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- new ArrayList<Control>(), DN.nullDN(),
+ new ArrayList<Control>(), "3", DN.nullDN(),
SASL_MECHANISM_ANONYMOUS, null);
handler.processSASLBind(bindOperation);
assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
@@ -166,7 +166,7 @@
InternalClientConnection.getRootConnection();
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- new ArrayList<Control>(), DN.nullDN(),
+ new ArrayList<Control>(), "3", DN.nullDN(),
SASL_MECHANISM_ANONYMOUS, new ASN1OctetString());
handler.processSASLBind(bindOperation);
assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
@@ -192,7 +192,7 @@
InternalClientConnection.getRootConnection();
BindOperation bindOperation =
new BindOperation(conn, conn.nextOperationID(), conn.nextMessageID(),
- new ArrayList<Control>(), DN.nullDN(),
+ new ArrayList<Control>(), "3", DN.nullDN(),
SASL_MECHANISM_ANONYMOUS,
new ASN1OctetString("Internal Trace String"));
handler.processSASLBind(bindOperation);
--
Gitblit v1.10.0