Issue Details (XML | Word | Printable)

Key: DIRSERVER-703
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 an entry with multivalued RDN leads to wrong DN in search results.

Created: 08/Aug/06 08:50 PM   Updated: 19/Aug/06 03:28 PM
Return to search
Component/s: None
Affects Version/s: 1.0-RC4
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works addedTestsToSVN.ldif 2006-08-11 02:57 PM Alex Karasulu 3 kB
Text File Licensed for inclusion in ASF works badUpnameWithRdn.patch 2006-08-11 02:52 PM Alex Karasulu 2 kB
Java Source File Licensed for inclusion in ASF works MultiValuedRdnTest.java 2006-08-08 09:00 PM Stefan Zoerner 4 kB
Environment:
* ApacheDS 1.0 RC4 SNAPSHOT
* Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
* Windows XP Professional SP2
Issue Links:
Reference
 

Resolution Date: 13/Aug/06 11:43 AM


 Description  « Hide
I use Apache Directoty Server 1.0 RC4 SNAPSHOT with server.xml unchanged. If I create an entry with multivalued RDN like this:

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

i.e.
$ ldapmodify -D "uid=admin,ou=system" -w ****** -a -f multiValued.ldif
adding new entry cn=Kate Bush+sn=Bush,dc=example,dc=com
$

the entry is returned in searches with a wrong dn:

$ ldapsearch -D "uid=admin,ou=system" -w ****** -b "dc=example,dc=com" -s one "(sn=Bush)"
version: 1
dn: cn=Kate Bush,dc=example,dc=com
objectclass: person
objectclass: top
sn: Bush
cn: Kate Bush
$ ldapsearch -D "uid=admin,ou=system" -w ****** -b "cn=Kate Bush+sn=Bush,dc=example,dc=com" -s base "(sn=Bush)"
version: 1
dn: cn=Kate Bush,dc=example,dc=com
objectclass: person
objectclass: top
sn: Bush
cn: Kate Bush
$

The expected dn is cn=Kate Bush+sn=Bush,dc=example,dc=com in both cases.
I'll attach a JUnit test which demonstrates this issue soon.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Stefan Zoerner added a comment - 08/Aug/06 08:52 PM
This issues dealed with the creation of entries with multivalued RDNs as well.

Stefan Zoerner added a comment - 08/Aug/06 09:00 PM
JUnit testcase to demonstrate this issue. It uses JNDI. Note that only the test case testMultiValuedRdnName fails with Apache DS. I have checked this test with the following servers:
    * OpenLDAP 2.3
    * Sun Java System Directory Server 5.2
    * IBM Tivoli Directory Server 6.0
For these three servers, it passes completely.

Alex Karasulu added a comment - 11/Aug/06 01:46 PM
This looks like an LDAP DN issue. It happens after an add all to the LDAP dn. Here's a test that shows how this is broken:

    /**
     * Test to see if a DN with multiRdn values is preserved after an addAll.
     */
    public void testAddAllWithMultivaluedAttribute() throws InvalidNameException
    {
        LdapDN dn = new LdapDN( "cn=Kate Bush+sn=Bush,ou=system" );
        LdapDN target = new LdapDN();
        target.addAll( target.size(), dn );
        assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.toString() );
        assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.getUpName() );
    }

Trying to fix this now.

Alex Karasulu added a comment - 11/Aug/06 02:52 PM
I've isolated the problem to the upName calculation in the RdnParser for an Rdn. Here are some unit tests that show the problem exactly.

Alex Karasulu added a comment - 11/Aug/06 02:53 PM
This is way over my head right now. Having a hard time understanding this code. I'll wait for Emmanuel to come back and fix this one.

Alex Karasulu added a comment - 11/Aug/06 02:57 PM
Emmanuel this is a patch which adds Stefan's tests to the SVN repository in 1.0 branch. Once you fix this issue please apply this patch here and to 1.1 trunks. If you want me to do it just assign me the issue after fixing the Rdn problem I can confirm the integration tests.

Emmanuel Lecharny added a comment - 13/Aug/06 11:43 AM
Fixed in revision 431163 & 431164 for 1.0 and 1.1 branches.

This was a stupid mistake... (does anybody have heard about intelligent mistakes ? ;), upName was computed before the loop which parse the others atavs.

Alex Karasulu added a comment - 13/Aug/06 04:17 PM
Emmanuel did you apply the patch that adds Stefan's tests? If not want me to apply them?

Stefan Zoerner added a comment - 19/Aug/06 03:28 PM
I can confirm that the test case attached to this issue works fine now with Apache DS 1.0 RC 4. Therefore I close the issue.