From 400f4bf5dad65072b332a74c4fc974cfae9f06da Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 26 Sep 2006 20:24:21 +0000
Subject: [PATCH] Update the LDAP connection handler to ensure that it invokes the post-connect plugins at the appropriate time.  Update the LDAP client connection to ensure that it invokes the post-disconnect plugins at the appropriate time.

---
 opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
index 870d79a..dd1d543 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -50,8 +50,10 @@
 import org.opends.server.api.ConfigurableComponent;
 import org.opends.server.api.ConnectionHandler;
 import org.opends.server.api.ConnectionSecurityProvider;
+import org.opends.server.api.plugin.PostConnectPluginResult;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.InitializationException;
+import org.opends.server.core.PluginConfigManager;
 import org.opends.server.config.BooleanConfigAttribute;
 import org.opends.server.config.ConfigAttribute;
 import org.opends.server.config.ConfigEntry;
@@ -1279,9 +1281,21 @@
                   }
 
                   // If we've gotten here, then we'll take the connection so
-                  // choose a request handler and register the client with it.
+                  // invoke the post-connect plugins and register the client
+                  // connection with a request handler.
                   try
                   {
+                    PluginConfigManager pluginManager =
+                         DirectoryServer.getPluginConfigManager();
+                    PostConnectPluginResult pluginResult =
+                         pluginManager.invokePostConnectPlugins(
+                              clientConnection);
+                    if (pluginResult.connectionTerminated())
+                    {
+                      iterator.remove();
+                      continue;
+                    }
+
                     LDAPRequestHandler requestHandler =
                          requestHandlers[requestHandlerIndex++];
                     if (requestHandlerIndex >= numRequestHandlers)

--
Gitblit v1.10.0