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

another test

This commit is contained in:
kakwa 2015-06-17 23:16:24 +02:00
parent b54b8b5af3
commit 19c87b6cc1

View File

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