]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/backend/accounts.py
accounts: Try to automatically re-connect to the LDAP server
[ipfire.org.git] / src / backend / accounts.py
index 2098a33c4eb95a4428f86a895c70b0043afe62eb..4e6d892ac2ee2bb81f77d74f8ef07a931c29a9cf 100644 (file)
@@ -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: