Double Quotes in DN and CFLDAP

by @jehiah on 2004-11-29 18:29UTC
Filed under: All , ColdFusion

There is an error when using CFLDAP (or it might be a problem with ldap in general) to update fields in active directory that have a double quote in the DN. You can’t just escape the quote either as you would normally do with a comma or other character " becuase the error will persist.

Example error from Active Directory

An error has occured while trying to execute modify :CN=Last\, First “NICKNAME” (EMAILID),DC=company,DC=com: [LDAP: error code 34 - 0000208F: NameErr: DSID-031001AA, problem 2006 (BAD_NAME), data 8349, best match of: ‘CN=Last\, First “NICKNAME” (EMAILID),DC=company,DC=com’

Interesting to note that in the error message it gives back the ‘best’ match which is exactly what I passed in.

Workaround

The workaround is to escape the double quotes around the nickname using the hex value so:

<cfldap action="MODIFY"
    DN="#replace(distinguishedName,'"','\22','ALL')#"
    attributes="field=#newvalue#"
    modifytype="REPLACE"
    .... >
Subscribe via RSS ı Email
© 2023 - Jehiah Czebotar