Announcement Announcement Module
Collapse
No announcement yet.
Unsafe character in LDAP DN Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unsafe character in LDAP DN

    Hi

    I handle following unsafe character's in LDAP DN ..
    \\ =%20
    \\<=%3c
    \\>=%3e
    \\"=%22
    \\#=%23
    \\%=%25
    \\{=%7b
    \\}=%7d
    \\|=%7c
    \\\=%5c
    \\^=%5e
    \\~=%7e
    \\[=%5b
    \\]=%5d
    \\=%60


    But I am getting error 'Name Not Found Exception' for following DN.

    cn=Service & Advisor,ou=DEALER,ou=roles,dc=Capgemini,dc=com

    I can search same node using other LDAP Browser's not not able to get using Java JNDI API

    dirContext.getAttribute(strDNName);

    Please suggest me how to handle this special character? are there any more such characters ?

    waiting for reply.

    Thanks In Advance
    Jitendra.

  • #2
    This is typically not something you would do yourself; the DistinguishedName class properly escapes any unsafe characters for you, so using that would be a good way to solve your problem:
    Code:
    DistinguishedName dn = new DistinguishedName();
    dn.add("attribute1", "attribute1Value");
    dn.add("attribute2", "attribute2Value");
    ...

    Comment

    Working...
    X