directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1726296 - in /directory/shared/trunk/ldap: client/api/src/main/java/org/apache/directory/ldap/client/api/ client/api/src/test/java/org/apache/directory/ldap/client/api/ model/src/main/java/org/apache/directory/api/ldap/model/ldif/ model/sr...
Date Fri, 22 Jan 2016 19:42:52 GMT
Author: elecharny
Date: Fri Jan 22 19:42:52 2016
New Revision: 1726296

URL: http://svn.apache.org/viewvc?rev=1726296&view=rev
Log:
o Fixed a pb in the anonymizer : we may have collisions if we try to annymize short values
(anniversary problem)
o Dealing with the anonymization of AttributeType having a NameAndOptionalUIDSyntaxChecker
syntax
o Fixed the anonymization of attributes with a ';binary' option
o Fixed the LdifReader to use the Attribute Name for modifications
o Fixed the dhcpOption Attribute to be an IA5String

Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
    directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/DefaultAnonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/NameAndOptionalUIDSyntaxChecker.java
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
    directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=dhcp/ou=attributetypes/m-oid=2.16.840.1.113719.1.203.4.7.ldif

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
Fri Jan 22 19:42:52 2016
@@ -64,6 +64,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.LdapSyntax;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.ldap.model.schema.syntaxCheckers.DnSyntaxChecker;
+import org.apache.directory.api.ldap.model.schema.syntaxCheckers.NameAndOptionalUIDSyntaxChecker;
 import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
 
 
@@ -115,6 +116,9 @@ public class LdifAnonymizer
     /** The map that stores the anonymized values associated to the original value */
     private Map<Value<?>, Value<?>> valueMap = new HashMap<Value<?>,
Value<?>>();
     
+    /** The set that contains all the values we already have anonymized */
+    private Set<Value<?>> valueSet = new HashSet<Value<?>>();
+    
     /** The map of AttributeType'sOID we want to anonymize. They are all associated with
anonymizers */
     private Map<String, Anonymizer> attributeAnonymizers = new HashMap<String, Anonymizer>();
     
@@ -381,8 +385,7 @@ public class LdifAnonymizer
                 }
                 else
                 {
-                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute
);
-
+                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, valueSet,
attribute );
                     anonymizedAva = new Ava( schemaManager, attributeType.getName(), anonymizedAttribute.getString()
);
                 }
             }
@@ -394,7 +397,7 @@ public class LdifAnonymizer
                 }
                 else
                 {
-                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute
);
+                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, valueSet,
attribute );
 
                     anonymizedAva = new Ava( schemaManager, attributeType.getName(), anonymizedAttribute.getBytes()
);
                 }
@@ -684,7 +687,7 @@ public class LdifAnonymizer
             
             if ( attributeType == null )
             {
-                System.out.println( "Unknown AttributeType : " + attribute.getId() + " for
entry " + entryDn );
+                System.out.println( "\nUnknown AttributeType : " + attribute.getId() + "
for entry " + entryDn );
                 
                 return null;
             }
@@ -692,7 +695,6 @@ public class LdifAnonymizer
             attribute.apply( attributeType );
             
             // Deal with the special case of a DN syntax
-            
             if ( attributeType.getSyntax().getSyntaxChecker() instanceof DnSyntaxChecker
)
             {
                 Value<?>[] anonymizedValues = new Value<?>[ attribute.size()];
@@ -718,7 +720,7 @@ public class LdifAnonymizer
                 }
                 else
                 {
-                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute
);
+                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, valueSet,
attribute );
                     
                     Modification anonymizedModification = new DefaultModification( modification.getOperation(),
anonymizedAttribute );
                     newLdifEntry.addModification( anonymizedModification );
@@ -773,7 +775,7 @@ public class LdifAnonymizer
                 }
                 else
                 {
-                    anonymizedAttribute = anonymizer.anonymize( valueMap, attribute );
+                    anonymizedAttribute = anonymizer.anonymize( valueMap, valueSet, attribute
);
                     
                     if ( anonymizedAttribute != null )
                     {
@@ -860,8 +862,7 @@ public class LdifAnonymizer
         {
             AttributeType attributeType = attribute.getAttributeType();
             
-            // Deal with the special case of 
-            
+            // Deal with the special case of DN
             if ( attributeType.getSyntax().getSyntaxChecker() instanceof DnSyntaxChecker
)
             {
                 for ( Value<?> dnValue : attribute )
@@ -871,6 +872,34 @@ public class LdifAnonymizer
                     newEntry.add( attributeType, newdDn.toString() );
                 }
             }
+            // Deal with the special case of a NameAndOptionalUID
+            else if ( attributeType.getSyntax().getSyntaxChecker() instanceof NameAndOptionalUIDSyntaxChecker
)
+            {
+                for ( Value<?> dnValue : attribute )
+                {
+                    // Get rid of the # part (UID)
+                    String valueStr = dnValue.getString();
+                    int uidPos = valueStr.indexOf( '#' );
+                    String uid = null;
+                    
+                    if ( uidPos != -1 )
+                    {
+                        uid = valueStr.substring( uidPos + 1 );
+                        valueStr = valueStr.substring( 0, uidPos ); 
+                    }
+                    
+                    Dn dn = new Dn( schemaManager, valueStr );
+                    Dn newDn = anonymizeDn( dn );
+                    String newDnStr = newDn.toString();
+                    
+                    if ( uid != null )
+                    {
+                        newDnStr = newDnStr + '#' + uid;
+                    }
+                    
+                    newEntry.add( attributeType, newDnStr );
+                }
+            }
             else
             {
                 Anonymizer anonymizer = attributeAnonymizers.get( attribute.getAttributeType().getOid()
);
@@ -881,7 +910,7 @@ public class LdifAnonymizer
                 }
                 else
                 {
-                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute
);
+                    Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, valueSet,
attribute );
                     
                     if ( anonymizedAttribute != null )
                     {

Modified: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
Fri Jan 22 19:42:52 2016
@@ -21,6 +21,7 @@
 package org.apache.directory.ldap.client.api;
 
 
+import java.io.IOException;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -29,6 +30,8 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.entry.Modification;
 import org.apache.directory.api.ldap.model.entry.ModificationOperation;
 import org.apache.directory.api.ldap.model.entry.Value;
+import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.ldif.LdifEntry;
 import org.apache.directory.api.ldap.model.ldif.LdifReader;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
@@ -262,4 +265,44 @@ public class LdifAnonymizerTest
         
         assertEquals( "", result );
     }
+    
+    
+    @Test
+    public void testAnonymizerModifyBinaryOptionAttribute() throws LdapException, IOException
+    {
+        String ldif = 
+            "dn: cn=Acme certificate,o=Acme,c=US,ou=IT Infrastructure,o=acme.com\n" +
+            "changetype: modify\n" +
+            "replace: certificateRevocationList;binary\n" +
+            "certificateRevocationList;binary::YmxhaCBibGFo\n" +
+            "-";
+
+        LdifAnonymizer anonymizer = new LdifAnonymizer( schemaManager );
+        anonymizer.addNamingContext( "o=acme.com" );
+        String result = anonymizer.anonymize( ldif );
+        
+        List<LdifEntry> entries = ldifReader.parseLdif( result );
+        
+        assertEquals( 1, entries.size() );
+        
+        LdifEntry entry = entries.get( 0 );
+        assertTrue( entry.isChangeModify() );
+        assertEquals( 1, entry.getModifications().size() );
+        
+        Modification modification = entry.getModifications().get( 0 );
+        assertEquals( ModificationOperation.REPLACE_ATTRIBUTE, modification.getOperation()
);
+
+        Attribute attribute = modification.getAttribute();
+        assertEquals( "certificateRevocationList;binary", attribute.getUpId() );
+        assertEquals( 1, attribute.size() );
+        
+        for ( Value<?> value : attribute )
+        {
+            String str = value.getString();
+            
+            // We can only test the length and the fact the values are not equal (as the
vale has been anonymized)
+            assertNotSame( 0, value.length() );
+            assertEquals( str.length(), value.length() );
+        }
+    }
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
Fri Jan 22 19:42:52 2016
@@ -1208,7 +1208,7 @@ public class LdifReader implements Itera
                 if ( schemaManager != null )
                 {
                     AttributeType attributeType = schemaManager.getAttributeType( modified
);
-                    attribute = new DefaultAttribute( attributeType );
+                    attribute = new DefaultAttribute( modified, attributeType );
                 }
                 else
                 {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java
Fri Jan 22 19:42:52 2016
@@ -22,6 +22,7 @@ package org.apache.directory.api.ldap.mo
 
 
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.Value;
@@ -38,11 +39,12 @@ public interface Anonymizer<K>
     /**
      * Take an attribute and its value, anonymizing all of them.
      * 
-     * @param valueMap The existing map for value to the associated anonymized counterpart
+     * @param valueMap The existing map of value to the associated anonymized counterpart
+     * @param valueSet The existing set of anonymized counterpart
      * @param attribute The attribute to anonymize
      * @return The anonymized attribute
      */
-    Attribute anonymize( Map<Value<K>, Value<K>> valueMap, Attribute attribute
);
+    Attribute anonymize( Map<Value<K>, Value<K>> valueMap, Set<Value<K>>
valueSet, Attribute attribute );
     
     
     /**

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java
Fri Jan 22 19:42:52 2016
@@ -23,6 +23,7 @@ package org.apache.directory.api.ldap.mo
 
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.BinaryValue;
@@ -45,7 +46,7 @@ public class BinaryAnonymizer extends Ab
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending
on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<byte[]>, Value<byte[]>> valueMap,
Attribute attribute )
+    public Attribute anonymize( Map<Value<byte[]>, Value<byte[]>> valueMap,
Set<Value<byte[]>> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
         random.setSeed( System.nanoTime() );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/DefaultAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/DefaultAnonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/DefaultAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/DefaultAnonymizer.java
Fri Jan 22 19:42:52 2016
@@ -23,6 +23,7 @@ package org.apache.directory.api.ldap.mo
 
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
@@ -45,7 +46,7 @@ public class DefaultAnonymizer<K> extend
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending
on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<K>, Value<K>> valueMap, Attribute
attribute )
+    public Attribute anonymize( Map<Value<K>, Value<K>> valueMap, Set<Value<K>>
valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
         random.setSeed( System.nanoTime() );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java
Fri Jan 22 19:42:52 2016
@@ -23,6 +23,7 @@ package org.apache.directory.api.ldap.mo
 
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
@@ -45,7 +46,7 @@ public class IntegerAnonymizer extends A
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending
on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap,
Attribute attribute )
+    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap,
Set<Value<String>> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
         random.setSeed( System.nanoTime() );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java
Fri Jan 22 19:42:52 2016
@@ -23,6 +23,7 @@ package org.apache.directory.api.ldap.mo
 
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
@@ -45,7 +46,7 @@ public class StringAnonymizer extends Ab
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending
on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap,
Attribute attribute )
+    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap,
Set<Value<String>> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
         random.setSeed( System.nanoTime() );
@@ -75,22 +76,41 @@ public class StringAnonymizer extends Ab
                     // Same size
                     char[] newValue = new char[length];
     
-                    for ( int i = 0; i < length; i++ )
+                    int count = 1000;
+                    
+                    while ( count > 0 )
                     {
-                        newValue[i] = ( char ) ( random.nextInt( 'Z' - 'A' ) + 'A' );
-                    }
+                        for ( int i = 0; i < length; i++ )
+                        {
+                            newValue[i] = ( char ) ( random.nextInt( 'Z' - 'A' ) + 'A' );
+                        }
     
-                    try
-                    {
-                        String newValueStr = new String( newValue );
-                        result.add( newValueStr );
-                        
-                        Value<String> anonValue = new StringValue( attribute.getAttributeType(),
newValueStr );
-                        valueMap.put( ( Value<String> ) value, anonValue );
+                        try
+                        {
+                            String newValueStr = new String( newValue );
+                            
+                            Value<String> anonValue = new StringValue( attribute.getAttributeType(),
newValueStr );
+                            
+                            if ( valueSet.contains( anonValue ) )
+                            {
+                                count--;
+                                continue;
+                            }
+                            
+                            result.add( newValueStr );
+                            valueMap.put( ( Value<String> ) value, anonValue );
+                            valueSet.add( anonValue );
+                            break;
+                        }
+                        catch ( LdapInvalidAttributeValueException e )
+                        {
+                            // TODO : handle that
+                        }
                     }
-                    catch ( LdapInvalidAttributeValueException e )
+                    
+                    if ( count == 0 )
                     {
-                        // TODO : handle that
+                        throw new RuntimeException( "Error : too many collisions" );
                     }
                 }
                 else

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java
Fri Jan 22 19:42:52 2016
@@ -23,6 +23,7 @@ package org.apache.directory.api.ldap.mo
 
 import java.util.Map;
 import java.util.Random;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
@@ -45,7 +46,7 @@ public class TelephoneNumberAnonymizer e
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending
on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap,
Attribute attribute )
+    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap,
Set<Value<String>> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
         random.setSeed( System.nanoTime() );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/NameAndOptionalUIDSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/NameAndOptionalUIDSyntaxChecker.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/NameAndOptionalUIDSyntaxChecker.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/NameAndOptionalUIDSyntaxChecker.java
Fri Jan 22 19:42:52 2016
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
  * NameAndOptionalUID = distinguishedName [ SHARP BitString ]
  * 
  * Both part already have their syntax checkers, so we will just call them
- * after having splitted the element in two ( if necessary)
+ * after having split the element in two ( if necessary)
  * 
  * We just check that the Dn is valid, we don't need to verify each of the Rdn
  * syntax.
@@ -104,10 +104,9 @@ public class NameAndOptionalUIDSyntaxChe
                 return false;
             }
 
-            // This is an UID if the '#' is immediatly
+            // This is an UID if the '#' is immediately
             // followed by a BitString, except if the '#' is
             // on the last position
-            // We shoould not find a
             if ( BitStringSyntaxChecker.isValid( strValue.substring( sharpPos + 1 ) )
                 && ( sharpPos < strValue.length() ) )
             {

Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
(original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
Fri Jan 22 19:42:52 2016
@@ -49,6 +49,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.ldap.model.schema.SchemaObject;
 import org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper;
+import org.apache.directory.api.ldap.model.schema.SchemaUtils;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.api.ldap.model.schema.normalizers.OidNormalizer;
 import org.apache.directory.api.ldap.model.schema.registries.AttributeTypeRegistry;
@@ -1612,7 +1613,9 @@ public class DefaultSchemaManager implem
     {
         try
         {
-            return registries.getAttributeTypeRegistry().lookup( Strings.toLowerCaseAscii(
oid ).trim() );
+            // Get rid of the options
+            String attributeTypeNoOptions = SchemaUtils.stripOptions( oid );
+            return registries.getAttributeTypeRegistry().lookup( Strings.toLowerCaseAscii(
attributeTypeNoOptions ).trim() );
         }
         catch ( LdapException lnsae )
         {

Modified: directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=dhcp/ou=attributetypes/m-oid=2.16.840.1.113719.1.203.4.7.ldif
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou%3Dschema/cn%3Ddhcp/ou%3Dattributetypes/m-oid%3D2.16.840.1.113719.1.203.4.7.ldif?rev=1726296&r1=1726295&r2=1726296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=dhcp/ou=attributetypes/m-oid=2.16.840.1.113719.1.203.4.7.ldif
(original)
+++ directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=dhcp/ou=attributetypes/m-oid=2.16.840.1.113719.1.203.4.7.ldif
Fri Jan 22 19:42:52 2016
@@ -10,7 +10,7 @@ m-nousermodification: FALSE
 objectclass: metaAttributeType
 objectclass: metaTop
 objectclass: top
-m-syntax: 1.3.6.1.4.1.1466.115.121.1.40
+m-syntax: 1.3.6.1.4.1.1466.115.121.1.26
 m-usage: USER_APPLICATIONS
 m-name: dhcpOption
 creatorsname: uid=admin,ou=system



Mime
View raw message