From 61be60eef8694b2c28386faf6dd2d7c4e842addd Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 16 Jun 2011 18:00:52 +0000
Subject: [PATCH] Fix OPENDJ-198: RFC 4512 compliance for ldap-toolkit

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
index 1379e95..875da3b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
@@ -884,6 +884,8 @@
       final String attributeDescription, final Schema schema)
       throws LocalizedIllegalArgumentException
   {
+    final boolean allowMalformedNamesAndOptions = schema
+        .allowMalformedNamesAndOptions();
     int i = 0;
     final int length = attributeDescription.length();
     char c = 0;
@@ -933,7 +935,7 @@
         }
 
         cp = ASCIICharProp.valueOf(c);
-        if (!cp.isKeyChar())
+        if (!cp.isKeyChar(allowMalformedNamesAndOptions))
         {
           final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
               .get(attributeDescription, c, i);
@@ -1003,7 +1005,7 @@
     }
 
     // Get the attribute type from the schema.
-    AttributeType attributeType;
+    final AttributeType attributeType;
     try
     {
       attributeType = schema.getAttributeType(oid);
@@ -1046,7 +1048,7 @@
       }
 
       cp = ASCIICharProp.valueOf(c);
-      if (!cp.isKeyChar())
+      if (!cp.isKeyChar(allowMalformedNamesAndOptions))
       {
         final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
             .get(attributeDescription, c, i);
@@ -1125,7 +1127,7 @@
         }
 
         cp = ASCIICharProp.valueOf(c);
-        if (!cp.isKeyChar())
+        if (!cp.isKeyChar(allowMalformedNamesAndOptions))
         {
           final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_ILLEGAL_CHARACTER
               .get(attributeDescription, c, i);

--
Gitblit v1.10.0