From c4c23b471528c582b8c4133a834e46c539f234c6 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 06 Jul 2007 10:12:08 +0000
Subject: [PATCH] fix for isue 1632 : schema check should not be done for replicated operation.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java | 14 ++++++++++++++
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java | 31 ++++++++++++++++++++-----------
opends/src/server/org/opends/server/core/ModifyDNOperation.java | 8 +++++---
3 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/ModifyDNOperation.java b/opends/src/server/org/opends/server/core/ModifyDNOperation.java
index 979f3ac..80db37b 100644
--- a/opends/src/server/org/opends/server/core/ModifyDNOperation.java
+++ b/opends/src/server/org/opends/server/core/ModifyDNOperation.java
@@ -1501,9 +1501,11 @@
}
}
-
- // Make sure that the resulting entry is valid as per the server schema.
- if (DirectoryServer.checkSchema())
+ // If the server is configured to check the schema and the
+ // operation is not a synchronization operation,
+ // make sure that the resulting entry is valid as per the server schema.
+ if ((DirectoryServer.checkSchema()) &&
+ (!isSynchronizationOperation()) )
{
StringBuilder invalidReason = new StringBuilder();
if (! newEntry.conformsToSchema(null, false, true, true,
diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index 3fd4599..5208153 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -1250,10 +1250,12 @@
break modifyProcessing;
}
-
- // Make sure that all the new values are valid according to the
+ // If the server is configured to check schema and the
+ // operation is not a synchronization operation,
+ // make sure that all the new values are valid according to the
// associated syntax.
- if (DirectoryServer.checkSchema())
+ if ((DirectoryServer.checkSchema()) &&
+ (!localOp.isSynchronizationOperation()) )
{
AcceptRejectWarn syntaxPolicy =
DirectoryServer.getSyntaxEnforcementPolicy();
@@ -1467,11 +1469,13 @@
break;
}
-
- // Make sure that all the new values are valid according to the
+ // If the server is configured to check schema and the
+ // operation is not a synchronization operation,
+ // make sure that all the new values are valid according to the
// associated syntax.
newValues = a.getValues();
- if (DirectoryServer.checkSchema())
+ if ((DirectoryServer.checkSchema()) &&
+ (!localOp.isSynchronizationOperation()) )
{
AcceptRejectWarn syntaxPolicy =
DirectoryServer.getSyntaxEnforcementPolicy();
@@ -1937,8 +1941,11 @@
break modifyProcessing;
}
- // Make sure that the new entry is valid per the server schema.
- if (DirectoryServer.checkSchema())
+ // If the server is configured to check the schema and the
+ // operation is not a sycnhronization operation,
+ // make sure that the new entry is valid per the server schema.
+ if ((DirectoryServer.checkSchema()) &&
+ (!localOp.isSynchronizationOperation()) )
{
StringBuilder invalidReason = new StringBuilder();
if (! modifiedEntry.conformsToSchema(null, false, false, false,
@@ -4964,10 +4971,12 @@
}
}
-
- // Check to see if the entry is valid according to the server schema,
+ // If the server is configured to check schema and the
+ // operation is not a synchronization operation,
+ // check to see if the entry is valid according to the server schema,
// and also whether its attributes are valid according to their syntax.
- if (DirectoryServer.checkSchema())
+ if ((DirectoryServer.checkSchema()) &&
+ (!localOp.isSynchronizationOperation()) )
{
StringBuilder invalidReason = new StringBuilder();
if (! entry.conformsToSchema(parentEntry, true, true, true,
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
index bee8e73..a4201ca 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
@@ -1283,6 +1283,20 @@
if (found == false)
fail("The modification has not been correctly replayed.");
+
+ // Test that replication is able to add attribute that do
+ // not exist in the schema.
+ List<Modification> invalidMods = generatemods("badattribute", "value");
+ modMsg = new ModifyMsg(gen.newChangeNumber(), personWithUUIDEntry.getDN(),
+ invalidMods, user1entryUUID);
+ if (assured)
+ modMsg.setAssured();
+ broker.publish(modMsg);
+
+ found = checkEntryHasAttribute(
+ personWithUUIDEntry.getDN(), "badattribute", "value", 10000, true);
+ if (found == false)
+ fail("The modification has not been correctly replayed.");
/*
* Test the Reception of Modify Dn Msg
--
Gitblit v1.10.0