Issue Details (XML | Word | Printable)

Key: DIR-184
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Emmanuel Lecharny
Reporter: Jacob S. Barrett
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Directory

DnParser does not correctly parse leading and trailing spaces and pound signs in values.

Created: 20/Apr/06 03:02 AM   Updated: 06/May/09 03:57 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works DIR-184.patch 2006-04-20 06:45 AM Jacob S. Barrett 3 kB

Resolution Date: 21/Aug/06 09:52 PM


 Description  « Hide
As defined in RFC 2253 section 2.4:
(http://www.ietf.org/rfc/rfc2253.txt)
..
If the UTF-8 string does not have any of the following characters
   which need escaping, then that string can be used as the string
   representation of the value.

    - a space or "#" character occurring at the beginning of the
        string

    - a space character occurring at the end of the string

    - one of the characters ",", "+", """, "\", "<", ">" or ";"
...

A string can lead with '\ ' and trail with '\ '. Both cases are not supported by the DnParser and cause a parsing error. Furthermore, if a string starts with '\ ' only the spaces leading up to the escape should be trimmed. In addition only the spaces after '\ ' when at the end of a value should be stripped.

looking at the valuelexer.g file '\#' will work anywhere in the string, but should really only be supported at the head of the string.

If I understand the RFC correctly then these string should be supported:
"\ four spaces leading and 3 trailing \ " -> "\ four spaces leading and 3 trailing \ "
" \ two leading three trailing \ " -> "\ two leading three trailing \ "
"\# a leading pound" -> "\# a pound"
"a middle # pound" -> "a middle # pound"
"a trailing pound #" -> "a trailing pound #"

These are not valid:
"middle\ spaces"
"# a leading pound"
"a middle \# pound"
"a trailing pound \#"
Unless the next line in the RFC is really true, "Implementations MAY escape other characters." This makes things a bit more hairy I think.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #433388 Mon Aug 21 22:01:42 UTC 2006 elecharny Modified the STRING_CHAR table to allow a '#' in the middle of a dn
It will fix one error in DIRSERVER-631, and fix DIR-184
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/DNUtils.java

Repository Revision Date User Message
ASF #433389 Mon Aug 21 22:02:35 UTC 2006 elecharny - Renamed DIRSERVER-184 to DIR-184
- fixed the tests where a # in the middle or at the end
of a DN was escaped. This was wrong.
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java