Skip to content

Commit

Permalink
- Catch ldap.UNAVAILABLE exception while connecting to an LDAP se…
Browse files Browse the repository at this point in the history
…rver
  • Loading branch information
dataflake committed Oct 3, 2023
1 parent ca039bd commit ca43937
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/Products/LDAPUserFolder/LDAPDelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit ca43937

Please sign in to comment.