mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
adding close connexion and exception handling
This commit is contained in:
parent
31afad5ee9
commit
5b03596ed7
@ -86,6 +86,7 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
ldap_client.unbind_s()
|
ldap_client.unbind_s()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
ldap_client.unbind_s()
|
||||||
dn_entry = r[0][0]
|
dn_entry = r[0][0]
|
||||||
return dn_entry
|
return dn_entry
|
||||||
|
|
||||||
@ -107,10 +108,11 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
if self.starttls == 'on':
|
if self.starttls == 'on':
|
||||||
try:
|
try:
|
||||||
ldap_client.start_tls_s()
|
ldap_client.start_tls_s()
|
||||||
except ldap.OPERATIONS_ERROR:
|
except ldap.OPERATIONS_ERROR as e:
|
||||||
self._logger(
|
self._logger(
|
||||||
logging.ERROR,
|
logging.ERROR,
|
||||||
"cannot use starttls with ldaps:// uri (uri: " + self.uri + ")",
|
"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
|
return ldap_client
|
||||||
|
Loading…
Reference in New Issue
Block a user