Skip to content

Commit

Permalink
adding close connexion and exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kakwa committed May 21, 2015
1 parent 31afad5 commit 5b03596
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ldapcherry/backend/backendLdap.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def get_user(self, username):
ldap_client.unbind_s()
return False

ldap_client.unbind_s()
dn_entry = r[0][0]
return dn_entry

Expand All @@ -107,10 +108,11 @@ def _connect(self):
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

0 comments on commit 5b03596

Please sign in to comment.