changeset 7adb303d4839 in /home/hg/repos/python-nbxmpp
details:http://hg.gajim.org/python-nbxmpp?cmd=changeset;node=7adb303d4839 description: Ubuntu 12.04.4 package python-openssl (0.12-1ubuntu2.1) is based on an older version of pyOpenSSL. In this version of pyOpenSSL OpenSSL.SSL.OPENSSL_VERSION_NUMBER is not defined.
Fixes: #18
diffstat:
nbxmpp/tls_nb.py | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-)
diffs (36 lines):
diff -r d3089cb1164e -r 7adb303d4839 nbxmpp/tls_nb.py --- a/nbxmpp/tls_nb.py Mon Jan 27 20:18:13 2014 +0100 +++ b/nbxmpp/tls_nb.py Wed Jan 29 16:47:10 2014 +0100 @@ -374,17 +374,21 @@ # py-OpenSSL < 0.9 or old OpenSSL flags |= 16384
- # OpenSSL 1.0.1d supports TLS 1.1 and TLS 1.2 and - # fixes renegotiation in TLS 1.1, 1.2 by using the correct TLS version. - if OpenSSL.SSL.OPENSSL_VERSION_NUMBER >= 0x1000104f: - if self.tls_version != '1.0': - flags |= OpenSSL.SSL.OP_NO_TLSv1 - if self.tls_version not in ('1.0', '1.1'): - try: - flags |= OpenSSL.SSL.OP_NO_TLSv1_1 - except AttributeError, e: - # older py-OpenSSL - flags |= 0x10000000 + try: + # OpenSSL 1.0.1d supports TLS 1.1 and TLS 1.2 and + # fixes renegotiation in TLS 1.1, 1.2 by using the correct TLS version. + if OpenSSL.SSL.OPENSSL_VERSION_NUMBER >= 0x1000104f: + if self.tls_version != '1.0': + flags |= OpenSSL.SSL.OP_NO_TLSv1 + if self.tls_version not in ('1.0', '1.1'): + try: + flags |= OpenSSL.SSL.OP_NO_TLSv1_1 + except AttributeError, e: + # older py-OpenSSL + flags |= 0x10000000 + except AttributeError, e: + pass # much older py-OpenSSL +
tcpsock._sslContext.set_options(flags)