openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #18021
[Bug 1079476] Re: users_ldap: Unable to connect to Active Directory containing non-ASCII characters
The same fix is also working for 7.0 now ... not sure why it didn't work
initially.
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1079476
Title:
users_ldap: Unable to connect to Active Directory containing non-ASCII
characters
Status in OpenERP Addons (modules):
New
Bug description:
When connecting to Active Directory containing non-ASCII characters,
the following errors occurs ...
Server Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/common/http.py", line 592, in send
result = openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/opt/openerp/server/openerp/netsvc.py", line 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 384, in dispatch
return fn(*params)
File "/opt/openerp/server/openerp/service/web_services.py", line 396, in exp_authenticate
return res_users.authenticate(db, login, password, user_agent_env)
File "/opt/openerp/server/openerp/addons/base/res/res_users.py", line 456, in authenticate
uid = self.login(db, login, password)
File "/opt/openerp/server/openerp/addons/users_ldap/users_ldap.py", line 254, in login
entry = ldap_obj.authenticate(conf, login, password)
File "/opt/openerp/server/openerp/addons/users_ldap/users_ldap.py", line 100, in authenticate
results = self.query(conf, filter)
File "/opt/openerp/server/openerp/addons/users_ldap/users_ldap.py", line 144, in query
filter, retrieve_attributes, timeout=60)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 505, in search_st
return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 495, in search_ext_s
msgid = self.search_ext(base,scope,filterstr,attrlist,attrsonly,serverctrls,clientctrls,timeout,sizelimit)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 491, in search_ext
timeout,sizelimit,
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 96, in _ldap_call
result = func(*args,**kwargs)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-4: ordinal not in range(128)
This behaviour happens in both 6.1 and 7.0.
In my case, the ldap_base string contains non-ascii characters and I used "encode('utf-8')" as a quick fix.
Original code in users_ldap.py
results = conn.search_st(conf['ldap_base'], ldap.SCOPE_SUBTREE,
filter, retrieve_attributes, timeout=60)
Modified code in users_ldap.py
results = conn.search_st(conf['ldap_base'].encode('utf-8'),
ldap.SCOPE_SUBTREE, filter, retrieve_attributes, timeout=60)
This fix only works for 6.1.
Using this fix for 7.0, a different error relating to database insertion (creating new user) occurs.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1079476/+subscriptions
References