diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2015-12-04 11:23:49 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2015-12-08 14:23:28 +0100 |
| commit | 8a7394a5505145bb8a578bf033a2a55fca132b47 (patch) | |
| tree | c533f2fd665f4dcb488ebaad23dc1998022dcd14 /addons/auth_ldap/users_ldap.py | |
| parent | 3a1c693259a26e42479c1d403446899c88c20d55 (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
Diffstat (limited to 'addons/auth_ldap/users_ldap.py')
| -rw-r--r-- | addons/auth_ldap/users_ldap.py | 6 |
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) |
