1

I am using APACHE DS api to add an entry into LDAP server. However, displayName attribute is not being added as is, instead "displayname" (all small caps) is being added. Below is my entry set:

Entry entry = new DefaultEntry( 
            "cn=" + cn + "," + this.base_dn,
            "displayName",name.trim(),
            "objectclass:top",
            "objectclass:person",
            "objectclass:inetOrgPerson",
            "objectclass:organizationalPerson",
            "cn",cn,
            "sn",cn,
            "description:Gerrit User",
            "mail",cn +"@org.com",
            "userPassword",password

            );

Any idea why would this happen?

Ironically, when userPassword is mistakenly written as "userpassword", correct attribute name (which is "userPassword") gets into LDAP.

(Also, apache-ldap-api could not be found in tags below.)

Yo Yo Money Singh
  • 679
  • 3
  • 11
  • 22

2 Answers2

1

LDAP attribute names are case insensitive so 'displayname' == 'displayName' and 'userpassword' == 'userPassword'. They are functionally the same and the difference is only aesthetic. Apache DS maybe uses the name as it listed in the schema.

Dave Bennett
  • 10,996
  • 3
  • 30
  • 41
  • 'displayName' attribute is created properly when I add a user through ldif (using apache studio), but using API, this problem comes. any work around that you know of, perhaps? – Yo Yo Money Singh Dec 09 '14 at 06:26
  • 1
    You nor any other program should be checking an attribute name as being case sensitive. As mentioned displayname==displayName. For specific issues with Apache DS, you should contact the mail lists: https://directory.apache.org/mailing-lists-and-irc.html – jwilleke Dec 09 '14 at 12:14
  • 1
    there is nothing to work around, what you are encountering falls into the realm of expected behaviour; attributes names are case insensitive. Even if you managed to get them set the way you like there is no certainty that they will stay that way. – Dave Bennett Dec 09 '14 at 18:08
0

I was facing the issue because I was using gerrit in conjugation with LDAP. By default, gerrit takes ldap.accountFullName attribute as displayName for displaying the user name post login. Hence, when 'displayname' atribute was inserted into ldap, gerrit was not able to search for this attribute (gerrit case sensitivity). Changing this gerrit attribute to 'displayname' solved my purpose.

On LDAP side, attributes are CASE INSENSITIVE.

Yo Yo Money Singh
  • 679
  • 3
  • 11
  • 22