From d408e72de6b31ec6e44a073beb47c067f09fea78 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 12 Jul 2006 09:23:19 +0000
Subject: [PATCH] - pre-operation plugins are not called anymore when processing synchronization operations   for ADD,DELELTE and MODIFYDN as it was already the case for MODIFY operation   This is necessary to make sure that entries use the same unique ID everywhere.

---
 opends/src/server/org/opends/server/core/AddOperation.java |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/AddOperation.java b/opends/src/server/org/opends/server/core/AddOperation.java
index 5b37ed0..c3ff384 100644
--- a/opends/src/server/org/opends/server/core/AddOperation.java
+++ b/opends/src/server/org/opends/server/core/AddOperation.java
@@ -1142,7 +1142,8 @@
             List<Attribute> attrList = operationalAttributes.get(t);
             if (attrList == null)
             {
-              if (DirectoryServer.addMissingRDNAttributes())
+              if (isSynchronizationOperation() ||
+                  DirectoryServer.addMissingRDNAttributes())
               {
                 LinkedHashSet<AttributeValue> valueList =
                      new LinkedHashSet<AttributeValue>(1);
@@ -1187,7 +1188,8 @@
 
               if (! found)
               {
-                if (DirectoryServer.addMissingRDNAttributes())
+                if (isSynchronizationOperation() ||
+                    DirectoryServer.addMissingRDNAttributes())
                 {
                   LinkedHashSet<AttributeValue> valueList =
                        new LinkedHashSet<AttributeValue>(1);
@@ -1212,7 +1214,8 @@
             List<Attribute> attrList = userAttributes.get(t);
             if (attrList == null)
             {
-              if (DirectoryServer.addMissingRDNAttributes())
+              if (isSynchronizationOperation() ||
+                  DirectoryServer.addMissingRDNAttributes())
               {
                 LinkedHashSet<AttributeValue> valueList =
                      new LinkedHashSet<AttributeValue>(1);
@@ -1257,7 +1260,8 @@
 
               if (! found)
               {
-                if (DirectoryServer.addMissingRDNAttributes())
+                if (isSynchronizationOperation() ||
+                    DirectoryServer.addMissingRDNAttributes())
                 {
                   LinkedHashSet<AttributeValue> valueList =
                        new LinkedHashSet<AttributeValue>(1);
@@ -1766,27 +1770,31 @@
         }
 
 
-        // Invoke the pre-operation add plugins.
-        PreOperationPluginResult preOpResult =
-             pluginConfigManager.invokePreOperationAddPlugins(this);
-        if (preOpResult.connectionTerminated())
+        // If the operation is not a synchronization operation,
+        // Invoke the pre-operation modify plugins.
+        if (!isSynchronizationOperation())
         {
-          // There's no point in continuing with anything.  Log the result
-          // and return.
-          setResultCode(ResultCode.CANCELED);
+          PreOperationPluginResult preOpResult =
+            pluginConfigManager.invokePreOperationAddPlugins(this);
+          if (preOpResult.connectionTerminated())
+          {
+            // There's no point in continuing with anything.  Log the result
+            // and return.
+            setResultCode(ResultCode.CANCELED);
 
-          int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
-          appendErrorMessage(getMessage(msgID));
+            int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
+            appendErrorMessage(getMessage(msgID));
 
-          processingStopTime = System.currentTimeMillis();
+            processingStopTime = System.currentTimeMillis();
 
-          logAddResponse(this);
-          return;
-        }
-        else if (preOpResult.sendResponseImmediately())
-        {
-          skipPostOperation = true;
-          break addProcessing;
+            logAddResponse(this);
+            return;
+          }
+          else if (preOpResult.sendResponseImmediately())
+          {
+            skipPostOperation = true;
+            break addProcessing;
+          }
         }
 
 
@@ -2425,5 +2433,6 @@
     buffer.append(rawEntryDN);
     buffer.append(")");
   }
+
 }
 

--
Gitblit v1.10.0