directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r489744 - in /directory/trunks/shared/ldap/src: main/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxChecker.java test/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxCheckerTest.java
Date Fri, 22 Dec 2006 20:08:11 GMT
Author: elecharny
Date: Fri Dec 22 12:08:10 2006
New Revision: 489744

URL: http://svn.apache.org/viewvc?view=rev&rev=489744
Log:
Fixed a check : the '#' char should always been escaped unless it is the separator

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxChecker.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxCheckerTest.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxChecker.java?view=diff&rev=489744&r1=489743&r2=489744
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxChecker.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxChecker.java
Fri Dec 22 12:08:10 2006
@@ -102,9 +102,18 @@
         
         if ( sharpPos != -1 )
         {
+            // Now, check that we don't have another '#'
+            if ( strValue.indexOf( '#' ) != sharpPos )
+            {
+                // Yes, we have one : this is not allowed, it should have been
+                // escaped.
+                return false;
+            }
+            
             // This is an UID if the '#' is immediatly
             // 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() ) )
             {
@@ -122,7 +131,8 @@
             }
             else
             {
-                return LdapDN.isValid( strValue );
+                // We have found a '#' but no UID part.
+                return false;
             }
         }
         else

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxCheckerTest.java?view=diff&rev=489744&r1=489743&r2=489744
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxCheckerTest.java
(original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/NameAndOptionalUIDSyntaxCheckerTest.java
Fri Dec 22 12:08:10 2006
@@ -65,6 +65,9 @@
     public void testWrongUID()
     {
         assertFalse( checker.isValidSyntax( "#'0101'B" ) );
+        assertFalse( checker.isValidSyntax( "a=\\#,e=f#'1010'B" ) );
+        assertFalse( checker.isValidSyntax( "a=b##'0101'B" ) );
+        assertFalse( checker.isValidSyntax( "a=b#'0101'C" ) );
     }
     
     
@@ -84,10 +87,5 @@
         assertTrue( checker.isValidSyntax( "a=b + c=d#'1010'B" ) );
         assertTrue( checker.isValidSyntax( "a=b,c=d#'1010'B" ) );
         assertTrue( checker.isValidSyntax( "a=b\\,c = d, e=f#'1010'B" ) );
-        assertTrue( checker.isValidSyntax( "a=b\\,c = \\#0A0A, e=f#'1010'B" ) );
-        
-        // With 'false' UID (they are part of DN)
-        assertTrue( checker.isValidSyntax( "a=b##'0101'B" ) );
-        assertTrue( checker.isValidSyntax( "a=b#'0101'C" ) );
     }
 }



Mime
View raw message