ldap: differentiate errors during bind (#51353)

This commit is contained in:
Valentin Deniaud 2021-02-24 14:42:29 +01:00
parent 8df0d97988
commit 9a4ab69f22
1 changed files with 6 additions and 2 deletions

View File

@ -1471,8 +1471,12 @@ class LDAPBackend(object):
return False, u'invalid credentials'
except ldap.INVALID_DN_SYNTAX:
return False, u'invalid dn syntax %s' % who
except (ldap.TIMEOUT, ldap.CONNECT_ERROR, ldap.SERVER_DOWN):
return False, u'ldap is down'
except ldap.CONNECT_ERROR:
return False, 'connection error'
except ldap.TIMEOUT:
return False, 'timeout'
except ldap.SERVER_DOWN:
return False, 'ldap is down'
@classmethod
def get_connection(cls, block, credentials=()):