mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
13.36.2009 8421131988d3659c9f30c8259c6a0c276c793975
Fix for 3525 : Attribute modifications are not replicated for modDN operations

Whenever a MODDN or MODRDN operation is replicated, the
core server does not take into account the modifications that are
provided by the replication. Therefore operational attribute
such as modifiersname and modifytimestamp are lost.

This fix change the behaviour of the server so that
- it does not calls pre-operation plugins for synchronization operation
(as it is done for the other operations)
- it takes into account the provided modifications when the operation
is a synchronization operation
1 files modified
122 ■■■■■ changed files
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java 122 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -469,59 +469,83 @@
        List<Modification> modifications = this.getModifications();
        // Apply any changes to the entry based on the change in its RDN.  Also,
        // perform schema checking on the updated entry.
        try
        {
          applyRDNChanges(modifications);
        }
        catch (DirectoryException de)
        {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, de);
          }
          setResponseData(de);
          break modifyDNProcessing;
        }
        // Check for a request to cancel this operation.
        checkIfCanceled(false);
        // Get a count of the current number of modifications.  The
        // pre-operation plugins may alter this list, and we need to be able to
        // identify which changes were made after they're done.
        int modCount = modifications.size();
        // If the operation is not a synchronization operation,
        // Invoke the pre-operation modify DN plugins.
        if (! isSynchronizationOperation())
        //  - Apply the RDN changes.
        //  - Invoke the pre-operation modify DN plugins.
        //  - apply additional modifications provided by the plugins.
        // If the operation is a synchronization operation
        //  - apply the operation as it was originally done on the master.
        if (! isSynchronizationOperation() || (modifications.size() == 0))
        {
          executePostOpPlugins = true;
          PluginResult.PreOperation preOpResult =
              pluginConfigManager.invokePreOperationModifyDNPlugins(this);
          if (!preOpResult.continueProcessing())
          {
            setResultCode(preOpResult.getResultCode());
            appendErrorMessage(preOpResult.getErrorMessage());
            setMatchedDN(preOpResult.getMatchedDN());
            setReferralURLs(preOpResult.getReferralURLs());
            break modifyDNProcessing;
          }
        }
        // Check to see if any of the pre-operation plugins made any changes to
        // the entry.  If so, then apply them.
        if (modifications.size() > modCount)
        {
          // Apply any changes to the entry based on the change in its RDN.
          // Also perform schema checking on the updated entry.
          try
          {
            applyPreOpModifications(modifications, modCount);
            applyRDNChanges(modifications);
          }
          catch (DirectoryException de)
          {
            if (debugEnabled())
            {
              TRACER.debugCaught(DebugLogLevel.ERROR, de);
            }
            setResponseData(de);
            break modifyDNProcessing;
          }
          // Check for a request to cancel this operation.
          checkIfCanceled(false);
          if (! isSynchronizationOperation())
          {
            // Get a count of the current number of modifications.  The
            // pre-operation plugins may alter this list, and we need to be able
            // to identify which changes were made after they're done.
            int modCount = modifications.size();
            executePostOpPlugins = true;
            PluginResult.PreOperation preOpResult =
              pluginConfigManager.invokePreOperationModifyDNPlugins(this);
            if (!preOpResult.continueProcessing())
            {
              setResultCode(preOpResult.getResultCode());
              appendErrorMessage(preOpResult.getErrorMessage());
              setMatchedDN(preOpResult.getMatchedDN());
              setReferralURLs(preOpResult.getReferralURLs());
              break modifyDNProcessing;
            }
            // Check to see if any of the pre-operation plugins made any changes
            // to the entry.  If so, then apply them.
            if (modifications.size() > modCount)
            {
              try
              {
                applyPreOpModifications(modifications, modCount);
              }
              catch (DirectoryException de)
              {
                if (debugEnabled())
                {
                  TRACER.debugCaught(DebugLogLevel.ERROR, de);
                }
                setResponseData(de);
                break modifyDNProcessing;
              }
            }
          }
        }
        else
        {
          // This is a synchronization operation
          // Apply the modifications as they were originally done.
          try
          {
            applyPreOpModifications(modifications, 0);
          }
          catch (DirectoryException de)
          {