1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

test... again

This commit is contained in:
kakwa 2015-06-17 23:57:43 +02:00
parent 19c87b6cc1
commit 5508e4023a

View File

@ -58,20 +58,20 @@ class Backend(ldapcherry.backend.Backend):
def _connect(self): def _connect(self):
ldap_client = ldap.initialize(self.uri) ldap_client = ldap.initialize(self.uri)
ldap_client.set_option(ldap.OPT_REFERRALS, 0) ldap.set_option(ldap.OPT_REFERRALS, 0)
ldap_client.set_option(ldap.OPT_TIMEOUT, self.timeout) ldap.set_option(ldap.OPT_TIMEOUT, self.timeout)
if self.starttls == 'on': if self.starttls == 'on':
ldap_client.set_option(ldap.OPT_X_TLS_DEMAND, True) ldap.set_option(ldap.OPT_X_TLS_DEMAND, True)
else: else:
ldap_client.set_option(ldap.OPT_X_TLS_DEMAND, False) ldap.set_option(ldap.OPT_X_TLS_DEMAND, False)
if self.ca and self.checkcert == 'on': if self.ca and self.checkcert == 'on':
ldap_client.set_option(ldap.OPT_X_TLS_CACERTFILE, self.ca) ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.ca)
#else: #else:
# ldap_client.set_option(ldap.OPT_X_TLS_CACERTFILE, '') # ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, '')
if self.checkcert == 'off': if self.checkcert == 'off':
ldap_client.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW) ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
else: else:
ldap_client.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND) ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND)
if self.starttls == 'on': if self.starttls == 'on':
try: try:
ldap_client.start_tls_s() ldap_client.start_tls_s()