From 5b03596ed7a0f391e32e54671844ab4b1139c494 Mon Sep 17 00:00:00 2001 From: kakwa Date: Fri, 22 May 2015 01:48:27 +0200 Subject: [PATCH] adding close connexion and exception handling --- ldapcherry/backend/backendLdap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ldapcherry/backend/backendLdap.py b/ldapcherry/backend/backendLdap.py index c6c9586..f503232 100644 --- a/ldapcherry/backend/backendLdap.py +++ b/ldapcherry/backend/backendLdap.py @@ -86,6 +86,7 @@ class Backend(ldapcherry.backend.Backend): ldap_client.unbind_s() return False + ldap_client.unbind_s() dn_entry = r[0][0] return dn_entry @@ -107,10 +108,11 @@ class Backend(ldapcherry.backend.Backend): if self.starttls == 'on': try: ldap_client.start_tls_s() - except ldap.OPERATIONS_ERROR: + except ldap.OPERATIONS_ERROR as e: self._logger( logging.ERROR, "cannot use starttls with ldaps:// uri (uri: " + self.uri + ")", ) - raise cherrypy.HTTPError("500", "Configuration Error, contact administrator") + raise e + #raise cherrypy.HTTPError("500", "Configuration Error, contact administrator") return ldap_client