diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2018-09-22 04:44:12 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-09-22 04:44:12 (GMT) |
commit | c0da582b227f311126e278b5553a7fa89c79b054 (patch) | |
tree | 9b858acb418f0a5225146bfc2c78638ccb84b3ac /Modules/_ssl.c | |
parent | 026337a7101369297c8083047d2f3c6fc9dd1e2b (diff) | |
download | cpython-c0da582b227f311126e278b5553a7fa89c79b054.zip cpython-c0da582b227f311126e278b5553a7fa89c79b054.tar.gz cpython-c0da582b227f311126e278b5553a7fa89c79b054.tar.bz2 |
bpo-34759: Fix error handling in ssl 'unwrap()' (GH-9468)
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
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 4750b93..5b5d7dd 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2583,9 +2583,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 */ |