r5432 - trunk/cumin/python/cumin
tmckay at fedoraproject.org
tmckay at fedoraproject.org
Fri Jul 13 14:22:15 UTC 2012
Author: tmckay
Date: 2012-07-13 14:22:14 +0000 (Fri, 13 Jul 2012)
New Revision: 5432
Modified:
trunk/cumin/python/cumin/authenticator.py
Log:
Tweak ldap.timeout setting for compatibility with RHEL 5
BZ839576
Modified: trunk/cumin/python/cumin/authenticator.py
===================================================================
--- trunk/cumin/python/cumin/authenticator.py 2012-07-13 13:52:29 UTC (rev 5431)
+++ trunk/cumin/python/cumin/authenticator.py 2012-07-13 14:22:14 UTC (rev 5432)
@@ -96,9 +96,6 @@
# Always demand a certificate if the cacert is set
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND)
- if self.ldap_timeout is not None:
- ldap.set_option(ldap.OPT_TIMEOUT, self.ldap_timeout)
-
def _start_tls(self, conn):
if self.start_tls and not conn.start_tls_called:
conn.start_tls_called = True
@@ -114,6 +111,11 @@
try:
self._set_ldap_options()
conn = ldap.initialize(self.url.urlscheme + "://" +self.url.hostport)
+ if self.ldap_timeout is not None:
+ # ldap.set_option(OPT_TIMEOUT, val) doesn't seem to work on
+ # older versions of python_ldap. Instead, you have to set the
+ # value explicitly on the connection object after creation.
+ conn.timeout = self.ldap_timeout
conn.start_tls_called = False
except Exception,e:
log.error("Authenticator: cannot contact ldap server %s",e)
@@ -147,7 +149,7 @@
except Exception, e:
msg = str(e)
if not msg:
- msg = e.__repr__()
+ msg = repr(e)
log.error("Authenticator: find_user, "\
"query returned exception %s" % msg)
return conn, res
More information about the cumin-developers
mailing list