[FIX] auth_ldap login when password is unicode
python ldap library api is str based, assume utf-8 encoding for non-ascii chars. Closes #5376 lp:1079476
This commit is contained in:
parent
e5a94f74aa
commit
ccf021938d
|
@ -105,7 +105,7 @@ class CompanyLDAP(osv.osv):
|
||||||
if results and len(results) == 1:
|
if results and len(results) == 1:
|
||||||
dn = results[0][0]
|
dn = results[0][0]
|
||||||
conn = self.connect(conf)
|
conn = self.connect(conf)
|
||||||
conn.simple_bind_s(dn, password)
|
conn.simple_bind_s(dn, password.encode('utf-8'))
|
||||||
conn.unbind()
|
conn.unbind()
|
||||||
entry = results[0]
|
entry = results[0]
|
||||||
except ldap.INVALID_CREDENTIALS:
|
except ldap.INVALID_CREDENTIALS:
|
||||||
|
@ -141,7 +141,7 @@ class CompanyLDAP(osv.osv):
|
||||||
try:
|
try:
|
||||||
conn = self.connect(conf)
|
conn = self.connect(conf)
|
||||||
conn.simple_bind_s(conf['ldap_binddn'] or '',
|
conn.simple_bind_s(conf['ldap_binddn'] or '',
|
||||||
conf['ldap_password'] or '')
|
conf['ldap_password'].encode('utf-8') or '')
|
||||||
results = conn.search_st(conf['ldap_base'], ldap.SCOPE_SUBTREE,
|
results = conn.search_st(conf['ldap_base'], ldap.SCOPE_SUBTREE,
|
||||||
filter, retrieve_attributes, timeout=60)
|
filter, retrieve_attributes, timeout=60)
|
||||||
conn.unbind()
|
conn.unbind()
|
||||||
|
|
Loading…
Reference in New Issue