summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2018-09-22 05:10:06 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-22 05:10:06 (GMT)
commit7529754d26f5e744ae25bee56fdc1937bcf08c7e (patch)
tree745fdec004ca42e255b128513219d7ecf4115b2c
parentd1b336e530472f316b1d164d04626724c83b16d7 (diff)
downloadcpython-7529754d26f5e744ae25bee56fdc1937bcf08c7e.zip
cpython-7529754d26f5e744ae25bee56fdc1937bcf08c7e.tar.gz
cpython-7529754d26f5e744ae25bee56fdc1937bcf08c7e.tar.bz2
[3.6] bpo-34759: Fix error handling in ssl 'unwrap()' (GH-9468) (GH-9492)
OpenSSL follows the convention that whenever you call a function, it returns an error indicator value; and if this value is negative, then you need to go look at the actual error code to see what happened. Commit c6fd1c1c3a introduced a small mistake in _ssl__SSLSocket_shutdown_impl: instead of checking whether the error indicator was negative, it started checking whether the actual error code was negative, and it turns out that the error codes are never negative. So the effect was that 'unwrap()' lost the ability to raise SSL errors. https://bugs.python.org/issue34759. (cherry picked from commit c0da582b227f311126e278b5553a7fa89c79b054) Co-authored-by: Nathaniel J. Smith <njs@pobox.com> https://bugs.python.org/issue34759
-rw-r--r--Modules/_ssl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 327f6ae..2badf31 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2407,9 +2407,9 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self)
break;
}
- if (err.ssl < 0) {
+ if (ret < 0) {
Py_XDECREF(sock);
- return PySSL_SetError(self, err.ssl, __FILE__, __LINE__);
+ return PySSL_SetError(self, ret, __FILE__, __LINE__);
}
if (sock)
/* It's already INCREF'ed */