Problem with names that include ","

Michael Ströder michael at stroeder.com
Tue Jun 2 15:02:52 CEST 2009


Christoph Holtermann wrote:
> 
> Still working on commas in dn. When I now look
> at the functions supplied in python ldap there is
> for example :
> 
>>>> a='cn="lehmann, Andreas",dc=Adressbuch'
>>>> b=ldap.dn.str2dn(a)
>>>> b
> [[('cn', 'lehmann, Andreas', 1)], [('dc', 'Adressbuch', 1)]]
>>>> ldap.dn.dn2str(b)
> 'cn=lehmann\\, Andreas,dc=Adressbuch'
>>>> ldap.dn.explode_dn(a)
> ['cn=lehmann\\, Andreas', 'dc=Adressbuch']
> 
> So Python-LDAP itself goes this nonconform way of
> using escape sequences if I get it right.

Why do you think that this is wrong? I'd recommend to read RFC 4514 to
learn in detail instead of relying on false information given by others.

> I guess it's quite easy using dn2str and then converting it to a new
> string using "" instead of using str2dn or explode_dn that lead to
> ESC-Codes.

There's nothing wrong with correct escaping. Quoted RDN attribute values
should be avoided.

> But wouldn't it make sense to change the functions ?

No.

Ciao, Michael.



More information about the python-ldap mailing list