summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2015-12-04 11:23:49 +0100
committerNicolas Martinelli <nim@odoo.com>2015-12-08 14:23:28 +0100
commit8a7394a5505145bb8a578bf033a2a55fca132b47 (patch)
treec533f2fd665f4dcb488ebaad23dc1998022dcd14
parent3a1c693259a26e42479c1d403446899c88c20d55 (diff)
[FIX] auth_ldap: filter format
The LDAP method filter_format(filter_template,assertion_values) requires that the length of assertion_values matches the count of %s in filter_template. If not, a TypeError exception is thrown. This fix catches the exception and displays an understandable error message instead. opw-608126 opw-657370
-rw-r--r--addons/auth_ldap/users_ldap.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/auth_ldap/users_ldap.py b/addons/auth_ldap/users_ldap.py
index 6a6414c0037..4ab6a918382 100644
--- a/addons/auth_ldap/users_ldap.py
+++ b/addons/auth_ldap/users_ldap.py
@@ -96,7 +96,11 @@ class CompanyLDAP(osv.osv):
return False
entry = False
- filter = filter_format(conf['ldap_filter'], (login,))
+ try:
+ filter = filter_format(conf['ldap_filter'], (login,))
+ except TypeError:
+ _logger.warning('Could not format LDAP filter. Your filter should contain one \'%s\'.')
+ return False
try:
results = self.query(conf, filter)