Skip to Content
0
Former Member
Aug 31, 2012 at 01:14 PM

How to escape comma in LDAP DN string

1385 Views

Hi

I ran into situation that I should create AD cn as Lastname, Firstname.

I am concatenating it with JavaScript..

I have tested several amounts of \ characters in front of comma but not found working solution

var addn = "CN=" + LastName + "\\, " + FirstName + "," + buUserDN + "," + buBaseDN

Error with \\ in Javascript also tried \\\, \\\\, \\\\\\ and \\\\\\\\

putNextEntry failed storingCN=Test21\, Vellu,OU=Users,OU=business,OU=DEV,OU=IdentityManagement,dc=global,dc=company,dc=net

Exception from Add operation:javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C090C3E, comment: Error in attribute conversion operation, data 0, v1db1]; remaining name 'CN=Test21\, Vellu,OU=Users,OU=business,OU=DEV,OU=IdentityManagement,dc=global,dc=company,dc=net'

Exception from Modify operation:javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C090B8A, comment: Error in attribute conversion operation, data 0, v1db1]; remaining name 'CN=Test21\, Vellu,OU=Users,OU=business,OU=DEV,OU=IdentityManagement,dc=global,dc=company,dc=net'