From: Michael Tremer Date: Thu, 16 Mar 2017 10:40:04 +0000 (+0000) Subject: Try restarting the LDAP connection when an exception happened X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a395634c0deeec6b1acec2f69cb50d08e52c6fd7;p=ipfire.org.git Try restarting the LDAP connection when an exception happened Signed-off-by: Michael Tremer --- diff --git a/webapp/backend/accounts.py b/webapp/backend/accounts.py index 242cbf38..eb30e2b3 100644 --- a/webapp/backend/accounts.py +++ b/webapp/backend/accounts.py @@ -30,8 +30,15 @@ class Accounts(Object): logging.debug("Performing LDAP query: %s" % query) search_base = self.settings.get("ldap_search_base") - results = self.ldap.search_ext_s(search_base, ldap.SCOPE_SUBTREE, - query, attrlist=attrlist, sizelimit=limit) + + try: + results = self.ldap.search_ext_s(search_base, ldap.SCOPE_SUBTREE, + query, attrlist=attrlist, sizelimit=limit) + except: + # Close current connection + del self._ldap + + raise return results