Merge lp:~stepankk/pyopenssl/bug-845445 into lp:~exarkun/pyopenssl/trunk

Proposed by stepankk
Status: Work in progress
Proposed branch: lp:~stepankk/pyopenssl/bug-845445
Merge into: lp:~exarkun/pyopenssl/trunk
Diff against target: 105 lines (+13/-3)
3 files modified
OpenSSL/ssl/connection.c (+6/-0)
OpenSSL/ssl/context.c (+4/-0)
setup.py (+3/-3)
To merge this branch: bzr merge lp:~stepankk/pyopenssl/bug-845445
Reviewer Review Type Date Requested Status
Jean-Paul Calderone Needs Fixing
Review via email: mp+89242@code.launchpad.net

Description of the change

Excluded some parts of C code according to OpenSSL version.

To post a comment you must log in.
Revision history for this message
Jean-Paul Calderone (exarkun) wrote :

Thanks. It looks like this branch does fix the build problems. A few tweaks are probably in order:

  1. The setup.py changes look superfluous. Can you drop them?
  2. 8 unit tests fail with the branch. Unsurprisingly, these are the tests for the APIs being disabled. Can you change the test suite to skip these tests if the version of OpenSSL in use is too old to have them?
  3. Is a version check in the implementation the ideal way to do this? Another approach would be to check if the API symbols themselves are defined. I don't feel too strongly about this either way, I mostly want to see if you considered it or if you have any thoughts on the alternate approach.

Thanks again.

review: Needs Fixing
Revision history for this message
Keshav Kini (keshav-kini) wrote :

See also a patch on the actual bug #845445 page, which checks whether the API symbols themselves are defined, but doesn't skip any unit tests.

Unmerged revisions

166. By stepankk

updated version in setup.py

165. By stepankk

updated version and url in setup.py

164. By stepankk

compatibility with openssl <= 0.9.8.e

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'OpenSSL/ssl/connection.c'
2--- OpenSSL/ssl/connection.c 2011-07-16 05:14:58 +0000
3+++ OpenSSL/ssl/connection.c 2012-01-19 14:05:27 +0000
4@@ -263,6 +263,7 @@
5 return (PyObject *)self->context;
6 }
7
8+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER > 0x0090802fL
9 static char ssl_Connection_set_context_doc[] = "\n\
10 Switch this connection to a new session context\n\
11 \n\
12@@ -308,6 +309,7 @@
13 :return: A byte string giving the server name or :py:data:`None`.\n\
14 \n\
15 ";
16+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER > 0x0090802fL
17 static PyObject *
18 ssl_Connection_get_servername(ssl_ConnectionObj *self, PyObject *args) {
19 int type = TLSEXT_NAMETYPE_host_name;
20@@ -326,6 +328,7 @@
21 return PyBytes_FromString(name);
22 }
23 }
24+#endif
25
26
27 static char ssl_Connection_set_tlsext_host_name_doc[] = "\n\
28@@ -348,6 +351,7 @@
29 Py_INCREF(Py_None);
30 return Py_None;
31 }
32+#endif
33
34
35
36@@ -1269,9 +1273,11 @@
37 static PyMethodDef ssl_Connection_methods[] =
38 {
39 ADD_METHOD(get_context),
40+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER > 0x0090802fL
41 ADD_METHOD(set_context),
42 ADD_METHOD(get_servername),
43 ADD_METHOD(set_tlsext_host_name),
44+#endif
45 ADD_METHOD(pending),
46 ADD_METHOD(send),
47 ADD_ALIAS (write, send),
48
49=== modified file 'OpenSSL/ssl/context.c'
50--- OpenSSL/ssl/context.c 2011-09-11 13:35:32 +0000
51+++ OpenSSL/ssl/context.c 2012-01-19 14:05:27 +0000
52@@ -1125,6 +1125,7 @@
53 return PyLong_FromLong(SSL_CTX_set_mode(self->ctx, mode));
54 }
55
56+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER > 0x0090802fL
57 static char ssl_Context_set_tlsext_servername_callback_doc[] = "\n\
58 Specify a callback function to be called when clients specify a server name.\n\
59 \n\
60@@ -1152,6 +1153,7 @@
61 Py_INCREF(Py_None);
62 return Py_None;
63 }
64+#endif
65
66
67 /*
68@@ -1192,7 +1194,9 @@
69 ADD_METHOD(get_cert_store),
70 ADD_METHOD(set_options),
71 ADD_METHOD(set_mode),
72+#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER > 0x0090802fL
73 ADD_METHOD(set_tlsext_servername_callback),
74+#endif
75 { NULL, NULL }
76 };
77 #undef ADD_METHOD
78
79=== modified file 'setup.py'
80--- setup.py 2011-12-19 18:32:29 +0000
81+++ setup.py 2012-01-19 14:05:27 +0000
82@@ -15,7 +15,7 @@
83 from distutils.command.build_ext import build_ext
84
85 # XXX Deduplicate this
86-__version__ = '0.13'
87+__version__ = '0.13.2'
88
89 crypto_src = ['OpenSSL/crypto/crypto.c', 'OpenSSL/crypto/x509.c',
90 'OpenSSL/crypto/x509name.c', 'OpenSSL/crypto/pkey.c',
91@@ -205,12 +205,12 @@
92 'OpenSSL.test.test_ssl'],
93 zip_safe = False,
94 cmdclass = {"build_ext": BuildExtension},
95- description = 'Python wrapper module around the OpenSSL library',
96+ description = 'Python wrapper module around the OpenSSL library.',
97 author = 'Martin Sjögren, AB Strakt',
98 author_email = 'msjogren@gmail.com',
99 maintainer = 'Jean-Paul Calderone',
100 maintainer_email = 'exarkun@twistedmatrix.com',
101- url = 'http://pyopenssl.sourceforge.net/',
102+ url = 'https://code.launchpad.net/~stepankk/pyopenssl/bug-845445',
103 license = 'APL2',
104 long_description = """\
105 High-level wrapper around a subset of the OpenSSL library, includes

Subscribers

People subscribed via source and target branches

to status/vote changes: