Skip to content

Commit

Permalink
[FIX] auth_ldap login when password is unicode
Browse files Browse the repository at this point in the history
python ldap library api is str based, assume utf-8 encoding for non-ascii
chars.

Closes odoo#5376 lp:1079476
  • Loading branch information
dreispt authored and antonylesuisse committed Mar 1, 2015
1 parent e5a94f7 commit ccf0219
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/auth_ldap/users_ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def authenticate(self, conf, login, password):
if results and len(results) == 1:
dn = results[0][0]
conn = self.connect(conf)
conn.simple_bind_s(dn, password)
conn.simple_bind_s(dn, password.encode('utf-8'))
conn.unbind()
entry = results[0]
except ldap.INVALID_CREDENTIALS:
Expand Down Expand Up @@ -141,7 +141,7 @@ def query(self, conf, filter, retrieve_attributes=None):
try:
conn = self.connect(conf)
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,
filter, retrieve_attributes, timeout=60)
conn.unbind()
Expand Down

0 comments on commit ccf0219

Please sign in to comment.