encodings while modify AD with linux-client

Ingo Steuwer steuwer at univention.de
Mon May 2 18:03:20 CEST 2005


Hello

I've got some encoding-trouble accessing Active Directory with python-ldap 
(slightly modified 2.0.6) on linux (openldap-client 2.1.30).

I can modify a container-description using umlauts without an Error/Exception:

[..]
lo.simple_bind_s(login_dn, login_pw)

modlist=[(ldap.MOD_REPLACE,"description",[u"hallöle".encode('ISO-8859-1')])]
lo.modify_s("CN=moreusers,CN=Users,%s"%ldap_base,modlist)
[..]

Search for this container or view it in windows will result the description 
"hallle" (umlauts are "cutted"). Using an different encoding (different from 
ISo-8859-1/Latin) will result in an exception, like this one with unicode:

  File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 298, in 
modify_s
    msgid = self.modify(dn,modlist)
  File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 295, in 
modify
    return self.modify_ext(dn,modlist,None,None)
  File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 268, in 
modify_ext
    return 
self._ldap_call(self._l.modify_ext,dn,modlist,serverctrls,clientctrls)
  File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 94, in 
_ldap_call
    result = func(*args,**kwargs)
TypeError: ('expected a string in the list', u'hal\xf6le')

It is documented that Active Directory uses ISO-8859-1 and not utf8 (like 
Openldap an others). 

So, is this a python-ldap or openldap-problem (I know, great chanceto start an 
AD-Flamewar)? Any experiences/solutions?

Thanks!

Ingo Steuwer

-- 
Ingo Steuwer       steuwer at univention.de         fon: +49 421 22 232- 0
Entwicklung        Linux for Your Business
Univention GmbH    http://www.univention.de/     fax: +49 421 22 232-99





More information about the python-ldap mailing list