From 82a195add674938ce8ce50f5367d3fb6063f830a Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Fri, 03 Apr 2009 00:45:35 +0000
Subject: [PATCH] LDAPS connections logged as LDAP connection in access log. Issue 3856.

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java |    9 ++++++---
 opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java  |    5 +++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index bf9cd1d..1f8c977 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -236,9 +236,10 @@
    * @param clientChannel
    *          The socket channel that may be used to communicate with
    *          the client.
+   * @param  protocol String representing the protocol (LDAP or LDAP+SSL).
    */
   public LDAPClientConnection(LDAPConnectionHandler connectionHandler,
-      SocketChannel clientChannel)
+      SocketChannel clientChannel, String protocol)
   {
     super();
 
@@ -261,7 +262,7 @@
     operationsPerformed = 0;
     operationsPerformedLock = new Object();
     keepStats = connectionHandler.keepStats();
-    protocol = "LDAP";
+    this.protocol = protocol;
     writeSelector = new AtomicReference<Selector>();
     clientAddress =
         clientChannel.socket().getInetAddress().getHostAddress();
diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
index e8d951b..18889b9 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -1183,8 +1183,8 @@
           configSSL(currentConfig);
           sslConfig=false;
       }
-      LDAPClientConnection c =
-                                 new LDAPClientConnection(this, socketChannel);
+      LDAPClientConnection c = new LDAPClientConnection(this, socketChannel,
+                                                        getProtocol());
       if(currentConfig.isUseSSL()) {
           TLSByteChannel tlsByteChannel =  getTLSByteChannel(c, socketChannel);
           c.enableSSL(tlsByteChannel);
@@ -1214,7 +1214,10 @@
       ResultCode resCode = DirectoryServer.getServerErrorResultCode();
       try {
           String alias = config.getSSLCertNickname();
-          protocol += "+SSL";
+          if(config.isUseSSL())
+              protocol += "+SSL";
+          else if(config.isAllowStartTLS())
+              protocol += "+TLS";
           DN keyMgrDN = config.getKeyManagerProviderDN();
           DN trustMgrDN = config.getTrustManagerProviderDN();
           KeyManagerProvider<?> keyManagerProvider =

--
Gitblit v1.10.0