From 1ac474647b60bd88fbb9fd4080f3a2915dc76736 Mon Sep 17 00:00:00 2001 From: kakwa Date: Thu, 21 May 2015 08:52:06 +0200 Subject: [PATCH] fix backend name (collision with libraries name) --- ldapcherry/backend/{ldap.py => backendLdap.py} | 11 ++++++----- ldapcherry/backend/{samba4.py => backendSamba4.py} | 0 2 files changed, 6 insertions(+), 5 deletions(-) rename ldapcherry/backend/{ldap.py => backendLdap.py} (89%) rename ldapcherry/backend/{samba4.py => backendSamba4.py} (100%) diff --git a/ldapcherry/backend/ldap.py b/ldapcherry/backend/backendLdap.py similarity index 89% rename from ldapcherry/backend/ldap.py rename to ldapcherry/backend/backendLdap.py index b1d930f..54bf5be 100644 --- a/ldapcherry/backend/ldap.py +++ b/ldapcherry/backend/backendLdap.py @@ -14,6 +14,7 @@ class Backend(ldapcherry.backend.Backend): def __init__(self, config, logger): self.config = config + self._logger = logger def auth(self, username, password): @@ -52,13 +53,13 @@ class Backend(ldapcherry.backend.Backend): except ldap.INVALID_CREDENTIALS: self._logger( logging.ERROR, - "Configuration error, wrong credentials, unable to connect to ldap with '" + self.binddn + "'" + "Configuration error, wrong credentials, unable to connect to ldap with '" + self.config['binddn'] + "'" ) raise cherrypy.HTTPError("500", "Configuration Error, contact administrator") except ldap.SERVER_DOWN: self._logger( logging.ERROR, - "Unable to contact ldap server '" + self.uri + "', check 'auth.ldap.uri' and ssl/tls configuration" + "Unable to contact ldap server '" + self.config['uri'] + "', check 'auth.ldap.uri' and ssl/tls configuration" ) return False @@ -84,9 +85,9 @@ class Backend(ldapcherry.backend.Backend): ldap.set_option(ldap.OPT_X_TLS_DEMAND, True) if self.config['starttls'] == 'on': ldap.set_option(ldap.OPT_X_TLS_DEMAND, True) - if self.ca: + if self.config['ca']: ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.config['ca']) - if self.checkcert == 'off': + if self.config['checkcert'] == 'off': ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW) else: ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,ldap.OPT_X_TLS_DEMAND) @@ -97,7 +98,7 @@ class Backend(ldapcherry.backend.Backend): except ldap.OPERATIONS_ERROR: self._logger( logging.ERROR, - "cannot use starttls with ldaps:// uri (uri: " + self.uri + ")" + "cannot use starttls with ldaps:// uri (uri: " + self.config['uri'] + ")" ) raise cherrypy.HTTPError("500", "Configuration Error, contact administrator") return ldap_client diff --git a/ldapcherry/backend/samba4.py b/ldapcherry/backend/backendSamba4.py similarity index 100% rename from ldapcherry/backend/samba4.py rename to ldapcherry/backend/backendSamba4.py