directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <seelm...@apache.org>
Subject Problem with LdapDN class and escaped characters
Date Wed, 31 Oct 2007 22:24:18 GMT
Hi developers,

I am working on DIRSTUDIO-229, trying to use the LdapDN class from
shared-ldap in Studio. It works almost well. but now I have a problem
with a special DN.

The attribte type is just 'cn'
The attribute value contains two characters:
  a) the german umlaut 'Ä', escaped UTF-8 value is '\C3\84'
  b) the plus '+', escaped UTF-8 value is '\2B'

Now I created four LdapDN objects with each combination of escaped or
not escaped characters:
  System.out.println(new LdapDN("cn=Ä\\+"));
  System.out.println(new LdapDN("cn=\\C3\\84\\+"));
  System.out.println(new LdapDN("cn=Ä\\2B"));
  System.out.println(new LdapDN("cn=\\C3\\84\\2B"));

The output is the following:
  cn=\C3\84\+
  cn=\C3\84\+
  cn=\EF\BF\BD\+
  cn=\C3\84\+

As you could see the third variant is not correct. I also tried to
construct the Java String from a byte array:
  String dn = new String( new byte[] { 'c', 'n', '=', ( byte ) 0xC3, (
byte ) 0x84, ( byte ) 0x5C, (byte) 0x32, ( byte ) 0x42 }, "UTF-8" );
  System.out.println(new LdapDN(dn));

But the output is the same:
  cn=\EF\BF\BD\+

So my question is if this is a problem of the LdapDN class and parser or
is this an illegal DN?

Such an DN with the unescaped 'Ä' and the escaped '+' is returnd by
OpenLDAP. Or is that a problem with OpenLDAP?

Kind Regards,
Stefan Seelmann



Mime
View raw message