Issue Details (XML | Word | Printable)

Key: DIRSERVER-631
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Emmanuel Lecharny
Reporter: Stefan Zoerner
Votes: 0
Watchers: 0
Operations

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

Creation of entry with special (and escaped) character in RDN leads to wrong attribute value

Created: 02/Jun/06 09:34 PM   Updated: 02/Oct/06 01:07 PM
Return to search
Component/s: None
Affects Version/s: 1.0-RC3
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works AddingEntriesWithSpecialCharactersInRDNTest.java 2006-06-02 09:56 PM Stefan Zoerner 9 kB
Environment:
ApacheDS 1.0 RC 3
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Microsoft Windows XP version 5.1 Service Pack 1

Resolution Date: 20/Aug/06 10:12 PM


 Description  « Hide
If one creates an entry with a special character in its RDN value (e.g. #, <, ...) which is escaped in the (R)DN, the resulting entries has the escape char (\) in its attribute value as well. Example:

Creating this entry:

dn: cn=Bush\, Kate,dc=example,dc=com
objectclass: person
objectclass: top
sn: Bush
cn: Bush, Kate

like this

$ ldapmodify -h localhost -p 10389 -D "uid=admin,ou=system" -w ****** -a -f KateBush.ldif
adding new entry cn=Bush\, Kate,dc=example,dc=com

leads to an entry like that

$ ldapsearch -h localhost -p 10389 -b "dc=example,dc=com" -s sub "(sn=Bush)"
version: 1
dn: cn=Bush\, Kate,dc=example,dc=com
objectclass: person
objectclass: top
sn: Bush
cn: Bush\, Kate

The expected for cn is "Bush, Kate", as provided by the LDIF above. The same error occurs with several characters (other than comma). I'll attach a JNDI JUnit test which demonstrates the issue with test methods using different characters (and the test passes on other directory servers).

Note: This problem may be related to DIRSERVER-628.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Stefan Zoerner added a comment - 02/Jun/06 09:56 PM
This is the JUnit test using JNDI ops to create entries with special characters in their RDNs.

Stefan Zoerner made changes - 02/Jun/06 09:56 PM
Field Original Value New Value
Attachment AddingEntriesWithSpecialCharactersInRDNTest.java [ 12334948 ]
Emmanuel Lecharny added a comment - 14/Jun/06 05:32 AM
This is a really bad problem we have ...

Some explainations on how DN should be treated can be found here : http://docs.safehaus.org/display/APACHEDS/DN+normalization+and+parsing

This is supposed to be done this way, but it's not. The normalizationService does not transform the DN accordingly to the AttributeType.

Changing that will cost time, and tests.

Unless I'm totally wrong, of course :)

Emmanuel Lecharny made changes - 16/Aug/06 06:34 PM
Assignee Emmanuel Lecharny [ elecharny ]
Emmanuel Lecharny added a comment - 17/Aug/06 11:19 PM
The code has been modified to handle the vast majority of the cases. However, I still have an issue remaining : escaped hexPairs.

For instance, the DN :
cn=L\C3\E9charny

should have this internal value :
cn=Lécharny

no?

But in this case, what about :
cn=L\C3charny

It should generate an exception, because \C3 is not a valid UTF-8 multi-byte char, no?

wdyt ?

PS: the code has not been committed

Alex Karasulu added a comment - 17/Aug/06 11:26 PM
Yes if it is not a UTF-8 multibyte char then it is invalid. I would through an exception on this one. If the attribute is binary does not matter.

Repository Revision Date User Message
ASF #433024 Sun Aug 20 20:20:39 UTC 2006 elecharny Rewroate a port of this class to allow futures evolutions and
to store the value either as a String or as a byte[] to fix
DIRSERVER-631
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java

Repository Revision Date User Message
ASF #433025 Sun Aug 20 20:21:34 UTC 2006 elecharny Huge modifications all over the code to fix DIRSERVER-631
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java

Repository Revision Date User Message
ASF #433026 Sun Aug 20 20:22:29 UTC 2006 elecharny Huge modifications all over the code to fix DIRSERVER-631
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java

Repository Revision Date User Message
ASF #433029 Sun Aug 20 20:25:11 UTC 2006 elecharny Reformating, adding some tests for DIRSERVER-631
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
MODIFY /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
MODIFY /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
MODIFY /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
MODIFY /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java

Repository Revision Date User Message
ASF #433030 Sun Aug 20 20:26:15 UTC 2006 elecharny Added Stefan tests for DIRSERVER-631. Two tests
have been commented because there is a pb with JNDI
Files Changed
ADD /directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java

Repository Revision Date User Message
ASF #433037 Sun Aug 20 20:44:20 UTC 2006 akarasulu merging changes in 1.0 branch for DIRSERVER-631 fix
Files Changed
MODIFY /directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
MODIFY /directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
MODIFY /directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
MODIFY /directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
MODIFY /directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
MODIFY /directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java

Emmanuel Lecharny added a comment - 20/Aug/06 10:12 PM
Ok, I think it has been solved, but it needs a full load of unit tests...

Emmanuel Lecharny made changes - 20/Aug/06 10:12 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #433071 Sun Aug 20 22:42:50 UTC 2006 akarasulu applying emmanuels changes for DIRSERVER-631 to trunks for range of commits starting from 433030 to 433034
Files Changed
MODIFY /directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/normalization/NormalizationServiceITest.java
MODIFY /directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
MODIFY /directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
MODIFY /directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java
ADD /directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java (from /directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java)

Repository Revision Date User Message
ASF #433074 Sun Aug 20 22:54:54 UTC 2006 akarasulu applying emmanuels fixes for DIRSERVER-631 from 1.0 to trunks in range 433024 to revision 433028
Files Changed
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java

Repository Revision Date User Message
ASF #433075 Sun Aug 20 23:00:12 UTC 2006 akarasulu applying patches for DIRSERVER-631
Files Changed
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java

Repository Revision Date User Message
ASF #433076 Sun Aug 20 23:01:50 UTC 2006 akarasulu applying patches for DIRSERVER-631
Files Changed
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/DNUtils.java

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

Stefan Zoerner added a comment - 02/Oct/06 01:07 PM
This has been fixed by Emmanuel and Alex more than a month ago.

Stefan Zoerner made changes - 02/Oct/06 01:07 PM
Status Resolved [ 5 ] Closed [ 6 ]