From 902d677f1d79cfa169f0c021f294543eb26bb327 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 24 Mar 2011 17:14:25 +0000
Subject: [PATCH] Fix for OPENDJ-58 : cn=schema attribute store twice in 99-user.ldif schema file. Prevent replication from adding cn and other schema attributes to the extra-attribute that are added to the schema entry written to the LDIF file. Fix also some messages (and translations)
---
opends/src/server/org/opends/server/backends/SchemaBackend.java | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opends/src/server/org/opends/server/backends/SchemaBackend.java
index 7d813e1..f140ac6 100644
--- a/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011 ForgeRock AS
*/
package org.opends.server.backends;
@@ -1528,7 +1529,7 @@
break;
- default:
+ case REPLACE:
if ((!m.isInternal()) &&
(!modifyOperation.isSynchronizationOperation()))
{
@@ -1539,9 +1540,27 @@
}
else
{
- newSchema.addExtraAttribute(at.getNameOrOID(), a);
- modifiedSchemaFiles.add(FILE_USER_SCHEMA_ELEMENTS);
+ // If this is not a Schema attribute, we put it
+ // in the extraAttribute map. This in fact acts as a replace.
+ if (SchemaConfigManager.isSchemaAttribute(a))
+ {
+ Message message = ERR_SCHEMA_INVALID_REPLACE_MODIFICATION.get(
+ a.getNameWithOptions());
+ ErrorLogger.logError(message);
+ }
+ else
+ {
+ newSchema.addExtraAttribute(at.getNameOrOID(), a);
+ modifiedSchemaFiles.add(FILE_USER_SCHEMA_ELEMENTS);
+ }
}
+ break;
+
+ default:
+ Message message = ERR_SCHEMA_INVALID_MODIFICATION_TYPE.get(
+ String.valueOf(m.getModificationType()));
+ throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
+ message);
}
}
--
Gitblit v1.10.0