|
From: Christoph H. <c.h...@gm...> - 2009-06-01 12:51:58
|
Hello !
I am working on a filter that makes Thunderbirds LDIF-Output
importable to OpenLDAP. It works quite fine except for names
that include ",". OpenLDAP dislikes the output that is produced
like :
dn: cn=Lehmann\, Veronika,dc=Adressbuch,dc=christoph
cn: Lehmann\, Veronika
givenName: Lehmann,
mail: inf...@un...
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: mozillaAbPersonAlpha
sn: Veronika
I found out that an encoding like "\2C" is accepted, like :
dn: cn=Lehmann\2C Veronika,dc=Adressbuch,dc=christoph
cn: Lehmann, Veronika
givenName: Lehmann,
mail: inf...@un...
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: mozillaAbPersonAlpha
sn: Veronika
Thunderbird exported the entry like this :
dn: cn="Lehmann, Veronika",mai...@un...
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: mozillaAbPersonAlpha
givenName: Lehmann,
sn: Veronika
cn: "Lehmann, Veronika"
mail: inf...@un...
modifytimestamp: 0Z
This is about one of the last things that I have to change by
hand. Maybe someone can help me with this encoding problem.
The code that is about that problem looks like :
basedn='dc=Adressbuch,dc=christoph'
def fix_dn(self, dn):
try:
self.head=ldap.dn.explode_dn(dn)[0]
for i in range(len(dn_warning)):
if self.head.find(dn_warning[i])>-1:
print "dn :",self.head, "contains '",dn_warning[i],"' - change
manually !"
return self.head + ',' + basedn
except:
if dn==None:
print "No dn specified"
return None
regards,
C. Holtermann
|