diff --git a/CHANGES.rst b/CHANGES.rst index d690e47..ace2b6b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,8 @@ releases, see the file `HISTORY.txt` in this folder. 5.1 (unreleased) ---------------- +- Catch ``ldap.UNAVAILABLE`` exception while connecting to an LDAP server. + AD Azure may return such an exception. Contributed by Gauthier Bastien. 5.0 (2023-02-02) diff --git a/src/Products/LDAPUserFolder/LDAPDelegate.py b/src/Products/LDAPUserFolder/LDAPDelegate.py index 67f3c12..f359989 100644 --- a/src/Products/LDAPUserFolder/LDAPDelegate.py +++ b/src/Products/LDAPUserFolder/LDAPDelegate.py @@ -196,7 +196,7 @@ def connect(self, bind_dn='', bind_pwd=''): conn.search_s(self.u_base, self.BASE, '(objectClass=*)') return conn except (AttributeError, ldap.SERVER_DOWN, ldap.NO_SUCH_OBJECT, - ldap.TIMEOUT, ldap.INVALID_CREDENTIALS, + ldap.TIMEOUT, ldap.INVALID_CREDENTIALS, ldap.UNAVAILABLE, ldap.UNWILLING_TO_PERFORM): pass @@ -211,7 +211,8 @@ def connect(self, bind_dn='', bind_pwd=''): op_timeout=server['op_timeout']) return newconn except (ldap.SERVER_DOWN, ldap.TIMEOUT, # NOQA: F841 - ldap.INVALID_CREDENTIALS, ldap.UNWILLING_TO_PERFORM) as e: + ldap.INVALID_CREDENTIALS, ldap.UNWILLING_TO_PERFORM, + ldap.UNAVAILABLE) as e: exc = e # If we get here it means either there are no servers defined or we