Escape character in LDAP DN?

Hello,
The way our organization organizes the Users in AD causes there to be a , inbetween the last name and the first in the DN. Because of this, when I try to add a user to the role_mapping.yml file, I get an error that says :

Caused by: while scanning a double-quoted scalar
 in 'reader', line 20, column 6:
       - "CN=Last\, First 1231412,OU= ...
         ^
found unknown escape character ,(44)
 in 'reader', line 20, column 15:
       - "CN=Last\, First 1231412,OU=HQ,...

Is there a way to escape that comma? Otherwise, it looks for the next level in the AD structure and errors out

Hi @slee,

Can you try to escape the , with \\? So in your example it would be something like: "CN=Last\\, First 1231412,OU= ..."

Please let me know if that resolves the issue with parsing and mapping.

-Jay

Thanks that worked! Is that a standard?

The YAML parser interprets a character preceded by a \ as being an escape sequence. In this case, we want the literal, so the \ must be escaped by using \\.

Ah, so the YAML is escaping the LDAP escape. Gotcha. You and the others have been a great help and resource on this forum, thank you so much!

1 Like