From caca6dfafe9aa928951f7a8bb732e7216fb3a2ae Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 28 Jun 2014 19:06:02 +0200 Subject: [PATCH] fix parsing of app-specific passwords in LDAP --- authserv/ldap_model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/authserv/ldap_model.py b/authserv/ldap_model.py index ae9aadb..ac1225a 100644 --- a/authserv/ldap_model.py +++ b/authserv/ldap_model.py @@ -116,7 +116,14 @@ class User(model.User): self._otp_enabled = True self._totp_secret = values[0] elif key == SCHEMA['app_specific_password']: - self._asps = [v.split(':', 1) for v in values] + # Format is service:password:comment. Ignore the + # comment, and avoid dying on malformed input. + self._asps = [] + for v in values: + try: + self._asps.append(v.split(':')[:2]) + except: + pass elif key == SCHEMA['shard']: self._shard = values[0] -- GitLab