From 77e5e195fc05593141f765e492e7a83616503408 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.

---
 opends/src/server/org/opends/server/core/BindOperation.java |   65 ++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/BindOperation.java b/opends/src/server/org/opends/server/core/BindOperation.java
index 2c75910..e269787 100644
--- a/opends/src/server/org/opends/server/core/BindOperation.java
+++ b/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);

--
Gitblit v1.10.0