diff --git a/ldap.py b/ldap.py index 5dafae0f68721789cb89936641b0ea331d4cdbcd..4ea1530ec74ca318c94d8f12625968553475558a 100644 --- a/ldap.py +++ b/ldap.py @@ -9,7 +9,7 @@ if 'LDAP_HOST' in config: user = LDAP_USERRE.sub(r'', user.lower()) try: conn = ldap3.Connection(ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True), 'fsmpi\\%s'%user, password, auto_bind=True, check_names=False) - except ldap3.core.exceptions.LDAPBindError, ldap3.core.exceptions.LDAPPasswordIsMandatoryError: + except (ldap3.core.exceptions.LDAPBindError, ldap3.core.exceptions.LDAPPasswordIsMandatoryError): return {}, [] conn.search("cn=users,dc=fsmpi,dc=rwth-aachen,dc=de", "(cn=%s)"%user, attributes=['memberOf', 'givenName', 'sn']) info = {'uid': user, 'givenName': conn.response[0]['attributes']['givenName'][0], 'sn': conn.response[0]['attributes']['sn'][0]}