You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Steve hammond (JIRA)" <ji...@apache.org> on 2008/10/08 16:19:44 UTC

[jira] Created: (DIRSERVER-1276) unescaping binary string corrupts values

unescaping binary string corrupts values
----------------------------------------

                 Key: DIRSERVER-1276
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: core
    Affects Versions: 1.5.3
         Environment: Windows running under JBOSS
            Reporter: Steve hammond


When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
passed in 
(&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
after normalization interceptor visitor it is:
(&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))

looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.


The code I am using is:
         SearchOperationContext opContext = new SearchOperationContext(
               apacheds.getDirectoryService().getRegistries(),
               baseDN,
               AliasDerefMode.NEVER_DEREF_ALIASES, 
               FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
               new SearchControls (
                     SearchControls.SUBTREE_SCOPE, 
                     0, // countlim
                     0, // timelim
                     retAttrs,
                     false, true));
         NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRSERVER-1276.
----------------------------------------


> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>            Assignee: Emmanuel Lecharny
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny reassigned DIRSERVER-1276:
--------------------------------------------

    Assignee: Emmanuel Lecharny

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>            Assignee: Emmanuel Lecharny
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735440#action_12735440 ] 

Emmanuel Lecharny commented on DIRSERVER-1276:
----------------------------------------------

Should be fixed with 
http://svn.apache.org/viewvc?rev=798005&view=rev
and
http://svn.apache.org/viewvc?rev=798006&view=rev

I have to add a test.

NOTE : Substring filters with binary AttributeType is *not* implemented.

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>            Assignee: Emmanuel Lecharny
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRSERVER-1276:
-----------------------------------------

    Fix Version/s: 1.5.5

Let's try to fix this for 1.5.5

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735297#action_12735297 ] 

Emmanuel Lecharny commented on DIRSERVER-1276:
----------------------------------------------

After a further analysis, there is a major flaw in the way filters are handled.

Here is what should be done

On the client side : The filter values should be considered as ASCII Strings, with all the value above 0x7F, plus '(', ')', '*', '\ and '\0' are to be escaped using the syntax '\XY' where XY represent thehex value of the escaped char.

We don't do any difference between a binary or a string value, they will be both transformed to a byte[].

On the server side, we can determinate which is the value type, as we know which kind of AttributeType we have (either a H/R or not). We then transform the value to a StringValue or to a BinaryValue.

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735388#action_12735388 ] 

Emmanuel Lecharny commented on DIRSERVER-1276:
----------------------------------------------

Sadly, it's more complex than I thought : the way the SubString matchingRule works made it very complicated to move from String to Value<?> in the server. For instance, we use a regexp() in order to use this matching rule. 

We may want to ignore substring matching rules for binary attributeTypes atm...

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>            Assignee: Emmanuel Lecharny
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Steve hammond (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637955#action_12637955 ] 

Steve hammond commented on DIRSERVER-1276:
------------------------------------------

Copy paste error, the filter is created with:

FilterParser.parse("(&(objectClass=person)(objectguid=\\29\\4C\\04\\B5\\D4\\ED\\38\\46\\87\\EE\\77\58\\5C\\32\\AD\\91))"), 

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRSERVER-1276) unescaping binary string corrupts values

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRSERVER-1276.
------------------------------------------

    Resolution: Fixed

Fixed.

A test has been added in testSearchByBinaryAttribute() :
http://svn.apache.org/viewvc?rev=798604&view=rev

> unescaping binary string corrupts values
> ----------------------------------------
>
>                 Key: DIRSERVER-1276
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1276
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.3
>         Environment: Windows running under JBOSS
>            Reporter: Steve hammond
>            Assignee: Emmanuel Lecharny
>             Fix For: 1.5.5
>
>
> When I pass in an escaped string into search, inside ConcreteNameComponentNormalizer, it corrupts the binary values.
> passed in 
> (&(2.5.4.0=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))
> after normalization interceptor visitor it is:
> (&(2.5.4.0=person)(1.2.840.113556.1.4.2='0x29 0x4C 0x04 0xEF 0xBE 0xB5 0xEF 0xBF 0x94 0xEF 0xBF 0xAD 0x38 0x46 0xEF 0xBE ...'))
> looks like in ConcreteNameComponentNormalizer line129                byte[] valBytes = unescaped.getBytes( "UTF-8" );
> causes the corruption.  The Variable unescaped seems correct and is 16 bytes, valBytes gets created with 30 bytes with the extra data inserted.
> The code I am using is:
>          SearchOperationContext opContext = new SearchOperationContext(
>                apacheds.getDirectoryService().getRegistries(),
>                baseDN,
>                AliasDerefMode.NEVER_DEREF_ALIASES, 
>                FilterParser.parse("(&(objectClass=person)(objectguid=\29\4C\04\B5\D4\ED\38\46\87\EE\77\58\5C\32\AD\91))"),
>                new SearchControls (
>                      SearchControls.SUBTREE_SCOPE, 
>                      0, // countlim
>                      0, // timelim
>                      retAttrs,
>                      false, true));
>          NamingEnumeration<ServerSearchResult> res = nexus.search(opContext);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.