From e5783d9d5e678cb4b8d69d98162c26d2858bbe33 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 25 Jan 2007 01:59:52 +0000
Subject: [PATCH] Make a number of updates to schema processing, all of which fall under the umbrella of issue #1163.  The individual issues addressed include:

---
 opends/src/server/org/opends/server/core/ModifyOperation.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/ModifyOperation.java b/opends/src/server/org/opends/server/core/ModifyOperation.java
index 1983be7..854de22 100644
--- a/opends/src/server/org/opends/server/core/ModifyOperation.java
+++ b/opends/src/server/org/opends/server/core/ModifyOperation.java
@@ -1350,6 +1350,26 @@
             }
           }
 
+          // If the attribute type is marked "OBSOLETE" and the modification
+          // is setting new values, then fail unless this is an internal
+          // operation or is related to synchronization in some way.
+          if (t.isObsolete())
+          {
+            if (a.hasValue() &&
+                (m.getModificationType() != ModificationType.DELETE))
+            {
+              if (! (isInternalOperation() || isSynchronizationOperation() ||
+                     m.isInternal()))
+              {
+                setResultCode(ResultCode.CONSTRAINT_VIOLATION);
+                appendErrorMessage(getMessage(MSGID_MODIFY_ATTR_IS_OBSOLETE,
+                                              String.valueOf(entryDN),
+                                              a.getName()));
+                break modifyProcessing;
+              }
+            }
+          }
+
 
           // If the modification is updating the password attribute, then
           // perform any necessary password policy processing.  This processing
@@ -2312,7 +2332,8 @@
         if (DirectoryServer.checkSchema())
         {
           StringBuilder invalidReason = new StringBuilder();
-          if (! modifiedEntry.conformsToSchema(null, false, invalidReason))
+          if (! modifiedEntry.conformsToSchema(null, false, false, false,
+                                               invalidReason))
           {
             setResultCode(ResultCode.OBJECTCLASS_VIOLATION);
             appendErrorMessage(getMessage(MSGID_MODIFY_VIOLATES_SCHEMA,

--
Gitblit v1.10.0