]> git.decadent.org.uk Git - dak.git/commitdiff
daklib/dbconn.py: use global LDAP options for TLS
authorAnsgar Burchardt <ansgar@debian.org>
Mon, 22 Jul 2013 21:01:23 +0000 (23:01 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Mon, 22 Jul 2013 21:01:23 +0000 (23:01 +0200)
Using connection-specific options made the code fail when calling
simple_bind_s() for some reason.

daklib/dbconn.py

index c6c8e5a12e78d39e6b632ae1c0c347fc7c3386ad..31caa902dcd8f50ca06cde5f31c9ab16252e768f 100644 (file)
@@ -1255,12 +1255,15 @@ class Keyring(object):
         l = ldap.open(LDAPServer)
 
         if ca_cert_file:
+            # TODO: This should request a new context and use
+            # connection-specific options (i.e. "l.set_option(...)")
+
             # Request a new TLS context. If there was already one, libldap
             # would not change the TLS options (like which CAs to trust).
-            l.set_option(ldap.OPT_X_TLS_NEWCTX, True)
-            l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_HARD)
-            l.set_option(ldap.OPT_X_TLS_CACERTDIR, None)
-            l.set_option(ldap.OPT_X_TLS_CACERTFILE, ca_cert_file)
+            #l.set_option(ldap.OPT_X_TLS_NEWCTX, True)
+            ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_HARD)
+            #ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, None)
+            ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, ca_cert_file)
             l.start_tls_s()
 
         l.simple_bind_s("","")