From 5af30c2b6e071cc0c857d122f9cdb6821bb365ff Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 16 Jun 2011 10:43:16 +0000
Subject: [PATCH] Partial fix for OPENDJ-198: RFC 4512 compliance for ldap-toolkit

---
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/SchemaCompatOptions.java |   62 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 4 deletions(-)

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 b70e2a5..43804d5 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,6 +67,8 @@
 
   private boolean allowZeroLengthDirectoryStrings = false;
 
+  private boolean allowMalformedNamesAndOptions = false;
+
 
 
   // Prevent direct instantiation.
@@ -78,6 +80,58 @@
 
 
   /**
+   * 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:
+   *
+   * <pre>
+   * USCORE  = %x5F ; underscore ("_")
+   * DOT     = %x2E ; period (".")
+   * </pre>
+   *
+   * By default this compatibility option is set to {@code false}.
+   *
+   * @return {@code true} if the schema should allow certain illegal characters
+   *         in OIDs and attribute options.
+   * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
+   *      Directory Access Protocol (LDAP): Directory Information Models </a>
+   */
+  public boolean allowMalformedNamesAndOptions()
+  {
+    return allowMalformedNamesAndOptions;
+  }
+
+
+
+  /**
+   * 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:
+   *
+   * <pre>
+   * USCORE  = %x5F ; underscore ("_")
+   * DOT     = %x2E ; period (".")
+   * </pre>
+   *
+   * By default this compatibility option is set to {@code false}.
+   *
+   * @param allowMalformedNamesAndOptions
+   *          {@code true} if the schema should allow certain illegal characters
+   *          in OIDs and attribute options.
+   * @return A reference to this {@code SchemaCompatOptions}.
+   * @see <a href="http://tools.ietf.org/html/rfc4512">RFC 4512 - Lightweight
+   *      Directory Access Protocol (LDAP): Directory Information Models </a>
+   */
+  public SchemaCompatOptions allowMalformedNamesAndOptions(
+      final boolean allowMalformedNamesAndOptions)
+  {
+    this.allowMalformedNamesAndOptions = allowMalformedNamesAndOptions;
+    return this;
+  }
+
+
+
+  /**
    * Returns {@code true} if the Telephone Number syntax should allow values
    * which do not conform to the E.123 international telephone number format.
    * <p>
@@ -160,10 +214,10 @@
   // Assigns the provided options to this set of options.
   SchemaCompatOptions assign(final SchemaCompatOptions options)
   {
-    return allowNonStandardTelephoneNumbers(
-        options.allowNonStandardTelephoneNumbers)
-        .allowZeroLengthDirectoryStrings(
-            options.allowNonStandardTelephoneNumbers);
+    this.allowMalformedNamesAndOptions = options.allowMalformedNamesAndOptions;
+    this.allowNonStandardTelephoneNumbers =options.allowNonStandardTelephoneNumbers;
+    this.allowZeroLengthDirectoryStrings = options.allowZeroLengthDirectoryStrings;
+    return this;
   }
 
 }

--
Gitblit v1.10.0