From 1a990d339cac38fa16ab66db896ebdaede6dcdb8 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 17 Jun 2011 13:18:56 +0000
Subject: [PATCH] Allow "." and "_" in non-numeric OIDs by default as these are used by collation rules in OpenDJ.

---
 opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java |    2 +-
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaCompatOptions.java   |   14 +++++++++-----
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java                |    6 ++++--
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
index 9fc4a13..a344c19 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
@@ -1899,14 +1899,16 @@
   /**
    * Returns {@code true} if this schema allows certain illegal characters
    * in OIDs and attribute options. When this compatibility option is set to
-   * {@code true} the following illegal characters will be permitted:
+   * {@code true} the following illegal characters will be permitted in addition
+   * to those permitted in section 1.4 of RFC 4512:
    *
    * <pre>
    * USCORE  = %x5F ; underscore ("_")
    * DOT     = %x2E ; period (".")
    * </pre>
    *
-   * By default this compatibility option is set to {@code false}.
+   * By default this compatibility option is set to {@code true} because these
+   * characters are often used for naming purposes (such as collation rules).
    *
    * @return {@code true} if this schema allows certain illegal characters
    *         in OIDs and attribute options.
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaCompatOptions.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaCompatOptions.java
index 43804d5..1d30f9b 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaCompatOptions.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaCompatOptions.java
@@ -67,7 +67,7 @@
 
   private boolean allowZeroLengthDirectoryStrings = false;
 
-  private boolean allowMalformedNamesAndOptions = false;
+  private boolean allowMalformedNamesAndOptions = true;
 
 
 
@@ -82,14 +82,16 @@
   /**
    * Returns {@code true} if the schema should allow certain illegal characters
    * in OIDs and attribute options. When this compatibility option is set to
-   * {@code true} the following illegal characters will be permitted:
+   * {@code true} the following illegal characters will be permitted in addition
+   * to those permitted in section 1.4 of RFC 4512:
    *
    * <pre>
    * USCORE  = %x5F ; underscore ("_")
    * DOT     = %x2E ; period (".")
    * </pre>
    *
-   * By default this compatibility option is set to {@code false}.
+   * By default this compatibility option is set to {@code true} because these
+   * characters are often used for naming purposes (such as collation rules).
    *
    * @return {@code true} if the schema should allow certain illegal characters
    *         in OIDs and attribute options.
@@ -106,14 +108,16 @@
   /**
    * Specifies whether or not the schema should allow certain illegal characters
    * in OIDs and attribute options. When this compatibility option is set to
-   * {@code true} the following illegal characters will be permitted:
+   * {@code true} the following illegal characters will be permitted in addition
+   * to those permitted in section 1.4 of RFC 4512:
    *
    * <pre>
    * USCORE  = %x5F ; underscore ("_")
    * DOT     = %x2E ; period (".")
    * </pre>
    *
-   * By default this compatibility option is set to {@code false}.
+   * By default this compatibility option is set to {@code true} because these
+   * characters are often used for naming purposes (such as collation rules).
    *
    * @param allowMalformedNamesAndOptions
    *          {@code true} if the schema should allow certain illegal characters
diff --git a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java
index 9ca968c..adaa178 100644
--- a/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java
+++ b/opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java
@@ -114,7 +114,7 @@
   public Object[][] dataForValueOfInvalidAttributeDescriptions()
   {
     return new Object[][] { { "" }, { " " }, { ";" }, { " ; " }, { "0cn" },
-        { "cn." }, { "cn;foo+bar" }, { "cn;foo;foo+bar" }, { ";foo" },
+        { "cn+" }, { "cn;foo+bar" }, { "cn;foo;foo+bar" }, { ";foo" },
         { "cn;" }, { "cn;;foo" }, { "cn; ;foo" }, { "cn;foo;" },
         { "cn;foo; " }, { "cn;foo;;bar" }, { "cn;foo; ;bar" },
         { "cn;foo;bar;;" }, { "1a" }, { "1.a" }, { "1-" }, { "1.1a" },

--
Gitblit v1.10.0