From: Michael Tremer Date: Tue, 7 May 2019 09:43:57 +0000 (+0100) Subject: accounts: Try to automatically re-connect to the LDAP server X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c9a866360da4e9cdbfeeead51cea55064a37d90;p=ipfire.org.git accounts: Try to automatically re-connect to the LDAP server When the connection is lost, we should try to re-connect. Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index 2098a33c..4e6d892a 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -33,10 +33,13 @@ class Accounts(Object): def ldap(self): # Connect to LDAP server ldap_uri = self.settings.get("ldap_uri") - conn = ldap.initialize(ldap_uri) logging.debug("Connecting to LDAP server: %s" % ldap_uri) + # Connect to the LDAP server + conn = ldap.ldapobject.ReconnectLDAPObject(ldap_uri, + retry_max=10, retry_delay=3) + # Bind with username and password bind_dn = self.settings.get("ldap_bind_dn") if bind_dn: