summaryrefslogtreecommitdiffstats
path: root/LDAPLoginAdapter.py
diff options
context:
space:
mode:
Diffstat (limited to 'LDAPLoginAdapter.py')
-rw-r--r--LDAPLoginAdapter.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/LDAPLoginAdapter.py b/LDAPLoginAdapter.py
index 24a6c17..18c477e 100644
--- a/LDAPLoginAdapter.py
+++ b/LDAPLoginAdapter.py
@@ -721,14 +721,30 @@ class LDAPLoginAdapter(BasicUserFolder, ObjectManager, Implicit, Base):
self.verbose > 8 and self._logit(9,
'Unknown user %s not validated' % name)
return None
- except ldap.INVALID_CREDENTIALS:
+ except ldap.LDAPError, e:
+ infotuple = getattr(e, 'args', ())
+ if infotuple:
+ errordict = infotuple[0]
+ msg = 'Error Type: %s, Server Message: %s' % (
+ errordict.get('desc', 'Not Available'),
+ errordict.get('info', 'Not Available'))
+ else:
+ msg = 'Unknown LDAP Error'
+
+ self.verbose > 0 and self._logit(1,
+ 'Exception in _lookupuser looking up %s: %s' % (name, msg))
+
return None
- except:
+
+ except Exception, e:
+ msg = getattr(e, 'args', ('Unknown Error',))[0]
+
self.verbose > 0 and self._logit(1,
- 'Exception in _lookupuser looking up %s' % (name))
+ 'Exception in _lookupuser looking up %s: %s' % (name, msg))
+
return None
- if uroles == None:
+ if uroles is None:
self.verbose > 8 and self._logit(9,
'%s returned no roles' % name)
return None