Problem with names that include ","

Michael Ströder michael at stroeder.com
Tue Jun 2 14:30:11 CEST 2009


Christoph Holtermann wrote:
> I just fed it with
> 
> dn: cn="Lehmann, Veronika",dc=Adressbuch,dc=christoph
> objectclass: top
> objectclass: person
> objectclass: inetOrgPerson
> objectclass: mozillaAbPersonAlpha
> sn: Lehmann
> cn: Lehmann, Veronika

And that's the correct LDIF for the entry you want to add.

> it works fine. But the Output of OpenLDAP, when I ldapsearch it is :
> 
>> ldapsearch -x "(cn=*lehmann*)"
> # extended LDIF                                                    
> #                                                                  
> # LDAPv3                                                           
> # base <dc=christoph> (default) with scope subtree                 
> # filter: (cn=*lehmann*)                                           
> # requesting: ALL                                                  
> #
> 
> # Lehmann\2C Veronika, Adressbuch.christoph
> dn: cn=Lehmann\2C Veronika,dc=Adressbuch,dc=christoph
> objectClass: top
> objectClass: person
> objectClass: inetOrgPerson
> objectClass: mozillaAbPersonAlpha
> sn: Lehmann
> cn: Lehmann, Veronika

And that's correct either.

> And what I saw was : escape-codes. And I just have been told, that
> it's not LDIF-conform ;-)

Yes, this was wrong information.

> So my goal now is to make my filter put entrys which contain commas
> in "". Does anyone know how to make Python-ldap do so ?

I'm not sure what you want to achieve. I'd use module 'ldif' to read the
Thunderbird export file and sanitize it. If Thunderbird put the \ in the
value for attribute 'cn' then you have to strip this wrong escaping, but
only for this particular attribute value. It seems you can use the DN as is.

Ciao, Michael.



More information about the python-ldap mailing list