From a012c060bc1893e0583bdccb59b41df533c78082 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 3 Aug 2023 21:17:58 +0100 Subject: [PATCH] Revert "[3.10] gh-107077: Raise SSLCertVerificationError even if the error is set via SSL_ERROR_SYSCALL (GH-107586) (#107589)" This reverts commit 24d54feafc28a9fb421de852d830cc370fe51db3. --- .../Library/2023-08-03-12-52-19.gh-issue-107077.-pzHD6.rst | 6 ------ Modules/_ssl.c | 4 ---- 2 files changed, 10 deletions(-) delete mode 100644 Misc/NEWS.d/next/Library/2023-08-03-12-52-19.gh-issue-107077.-pzHD6.rst diff --git a/Misc/NEWS.d/next/Library/2023-08-03-12-52-19.gh-issue-107077.-pzHD6.rst b/Misc/NEWS.d/next/Library/2023-08-03-12-52-19.gh-issue-107077.-pzHD6.rst deleted file mode 100644 index ecaf437a48e0ae..00000000000000 --- a/Misc/NEWS.d/next/Library/2023-08-03-12-52-19.gh-issue-107077.-pzHD6.rst +++ /dev/null @@ -1,6 +0,0 @@ -Seems that in some conditions, OpenSSL will return ``SSL_ERROR_SYSCALL`` -instead of ``SSL_ERROR_SSL`` when a certification verification has failed, -but the error parameters will still contain ``ERR_LIB_SSL`` and -``SSL_R_CERTIFICATE_VERIFY_FAILED``. We are now detecting this situation and -raising the appropiate ``ssl.SSLCertVerificationError``. Patch by Pablo -Galindo diff --git a/Modules/_ssl.c b/Modules/_ssl.c index bb0508f9aceecc..7a28f2d37f6c55 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -656,10 +656,6 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno) errstr = "Some I/O error occurred"; } } else { - if (ERR_GET_LIB(e) == ERR_LIB_SSL && - ERR_GET_REASON(e) == SSL_R_CERTIFICATE_VERIFY_FAILED) { - type = state->PySSLCertVerificationErrorObject; - } p = PY_SSL_ERROR_SYSCALL; } break;