rwinch / spring-ldap-migrate-issues

0 stars 0 forks source link

LDAP-296: Quoted Names Not Parsed Correctly #207

Closed rwinch closed 9 years ago

rwinch commented 10 years ago

Migrated from LDAP-296

The DistinguishedName class incorrectly parses DNs that use the quotes around a value to handle special characters. According to the last paragraph in section 4 of RFC 2253:

Implementations MUST allow a value to be surrounded by quote ('"' ASCII 34) characters, which are not part of the value. Inside the quoted value, the following characters can occur without any escaping:

               ",", "=", "+", "<", ">", "#" and ";"

The following code:

String stringDn = "ou=\"Foo + Bar\",cn=some,cn=org";
DistinguishedName dn = new DistinguishedName(stringDn);
System.out.println(stringDn);
System.out.println(dn);

Prints out:

ou="Foo + Bar",cn=some,cn=org
ou=\"Foo \+ Bar\",cn=some,cn=org

The effect is the quotes have been converted from delimiters to part of the value.

I think it would be fine if it normalized the DN to the preferred method of handling special characters -- escaping them.

ou=Foo \+ Bar,cn=some,cn=org
rwinch commented 9 years ago

Rob Winch said:

The effect is the quotes have been converted from delimiters to part of the value.

I don't understand why you feel like this is a bug. If you do not want the quotes as part of the value, do not include the quotes.

If we change this behavior, how would someone express that they wanted quotes in the value?

rwinch commented 9 years ago

Rob Winch said:

Resolving as invalid. If you disagree and can provide explanation for my questions in the previous comment, please open a new ticket. Otherwise the solution is to not include the " in the first place.