From 04418850f92d92178881d0a197772aeae82a8da6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 25 Jan 2011 11:54:28 +0100 Subject: [PATCH] hardcode the value of OpenSSL.SSL.OP_NO_TICKET for old version of openssl. Fixes #5689 --- src/common/xmpp/tls_nb.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/xmpp/tls_nb.py b/src/common/xmpp/tls_nb.py index 1cbb99c57..b0df948d6 100644 --- a/src/common/xmpp/tls_nb.py +++ b/src/common/xmpp/tls_nb.py @@ -384,8 +384,13 @@ class NonBlockingTLS(PlugIn): else: # See http://docs.python.org/dev/library/ssl.html tcpsock._sslContext = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv23_METHOD) - tcpsock._sslContext.set_options(OpenSSL.SSL.OP_NO_SSLv2 | \ - OpenSSL.SSL.OP_NO_TICKET) + flags = OpenSSL.SSL.OP_NO_SSLv2 + try: + flags |= OpenSSL.SSL.OP_NO_TICKET + except AttributeError, e: + # py-OpenSSL < 0.9 or old OpenSSL + flags |= 16384 + tcpsock._sslContext.set_options(flags) tcpsock.ssl_errnum = 0 tcpsock._sslContext.set_verify(OpenSSL.SSL.VERIFY_PEER,