Commit 65ec8ae4 authored by Antoine Pitrou's avatar Antoine Pitrou

Fix (hopefully) the remaining test_ssl buildbot failures

parent 467f28de
...@@ -142,7 +142,7 @@ class BasicSocketTests(unittest.TestCase): ...@@ -142,7 +142,7 @@ class BasicSocketTests(unittest.TestCase):
# Error checking can happen at instantiation or when connecting # Error checking can happen at instantiation or when connecting
with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"): with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
s = ssl.wrap_socket(socket.socket(socket.AF_INET), s = ssl.wrap_socket(socket.socket(socket.AF_INET),
cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx") cert_reqs=ssl.CERT_NONE, ciphers="xyzzy")
s.connect(remote) s.connect(remote)
@support.cpython_only @support.cpython_only
...@@ -186,7 +186,7 @@ class ContextTests(unittest.TestCase): ...@@ -186,7 +186,7 @@ class ContextTests(unittest.TestCase):
ctx.set_ciphers("ALL") ctx.set_ciphers("ALL")
ctx.set_ciphers("DEFAULT") ctx.set_ciphers("DEFAULT")
with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"): with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
ctx.set_ciphers("^$:,;?*'dorothyx") ctx.set_ciphers("xyzzy")
def test_verify(self): def test_verify(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
......
...@@ -1462,6 +1462,10 @@ set_ciphers(PySSLContext *self, PyObject *args) ...@@ -1462,6 +1462,10 @@ set_ciphers(PySSLContext *self, PyObject *args)
return NULL; return NULL;
ret = SSL_CTX_set_cipher_list(self->ctx, cipherlist); ret = SSL_CTX_set_cipher_list(self->ctx, cipherlist);
if (ret == 0) { if (ret == 0) {
/* Clearing the error queue is necessary on some OpenSSL versions,
otherwise the error will be reported again when another SSL call
is done. */
ERR_clear_error();
PyErr_SetString(PySSLErrorObject, PyErr_SetString(PySSLErrorObject,
"No cipher can be selected."); "No cipher can be selected.");
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment