pingidentity / ldapsdk

UnboundID LDAP SDK for Java
Other
334 stars 81 forks source link

DN.normalize throws away multi-value RDN #53

Closed pavelhoral closed 3 years ago

pavelhoral commented 5 years ago

The following test produces unexpected output:

import javax.naming.ldap.LdapName;

import com.unboundid.ldap.sdk.DN;

public class Test {

    private static final String TEST_DN = "cn=foo +cn = bar, DC=example,dc=com";

    public static void main(String[] args) throws Exception {
        System.out.println(new LdapName(TEST_DN));
        System.out.println(new LdapName(new LdapName(TEST_DN).getRdns()));
        System.out.println(DN.normalize(TEST_DN));
    }

}
cn=foo +cn = bar, DC=example,dc=com
cn=bar+cn=foo,DC=example,dc=com
cn=bar,dc=example,dc=com

Expected behaviour would be to not drop the cn=foo value.

dirmgr commented 5 years ago

Thanks for reporting this. I can confirm that it is a bug that appears if you have an RDN with multiple values for the same attribute type (it doesn't occur if you have different attribute types, like "givenName=foo+sn=bar,dc=example,dc=com"). Although I have a fix for it in my workspace now, it may be a couple of days before it's checked in while I write a more thorough set of tests.

dirmgr commented 5 years ago

I've just committed a fix for the problem.

pavelhoral commented 3 years ago

I think this can be closed as the current release has the issue fixed. Thank you.