mirror of
git://git.yoctoproject.org/poky
synced 2026-04-30 21:21:58 +00:00
https://github.com/python/cpython/pull/127331 https://github.com/python/cpython/pull/127361 (From OE-Core rev: e5f3a1793e34fb4cd1e53ca60b67f9a9f084b7a6) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
From 11e0523eb363b7def4bc64d24a04e88d8670a691 Mon Sep 17 00:00:00 2001
|
|
From: Petr Viktorin <encukou@gmail.com>
|
|
Date: Thu, 28 Nov 2024 13:32:30 +0100
|
|
Subject: [PATCH] ssl: Raise OSError for ERR_LIB_SYS
|
|
|
|
From the ERR_raise manpage:
|
|
|
|
ERR_LIB_SYS
|
|
|
|
This "library code" indicates that a system error is
|
|
being reported. In this case, the reason code given
|
|
to `ERR_raise()` and `ERR_raise_data()` *must* be
|
|
`errno(3)`.
|
|
|
|
Upstream-Status: Submitted [https://github.com/python/cpython/pull/127361]
|
|
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
|
---
|
|
Modules/_ssl.c | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
|
|
index e5b8bf21002..a243ba4b9bc 100644
|
|
--- a/Modules/_ssl.c
|
|
+++ b/Modules/_ssl.c
|
|
@@ -667,6 +667,11 @@ PySSL_SetError(PySSLSocket *sslsock, const char *filename, int lineno)
|
|
ERR_GET_REASON(e) == SSL_R_CERTIFICATE_VERIFY_FAILED) {
|
|
type = state->PySSLCertVerificationErrorObject;
|
|
}
|
|
+ if (ERR_GET_LIB(e) == ERR_LIB_SYS) {
|
|
+ // A system error is being reported; reason is set to errno
|
|
+ errno = ERR_GET_REASON(e);
|
|
+ return PyErr_SetFromErrno(PyExc_OSError);
|
|
+ }
|
|
p = PY_SSL_ERROR_SYSCALL;
|
|
}
|
|
break;
|
|
@@ -692,6 +697,11 @@ PySSL_SetError(PySSLSocket *sslsock, const char *filename, int lineno)
|
|
errstr = "EOF occurred in violation of protocol";
|
|
}
|
|
#endif
|
|
+ if (ERR_GET_LIB(e) == ERR_LIB_SYS) {
|
|
+ // A system error is being reported; reason is set to errno
|
|
+ errno = ERR_GET_REASON(e);
|
|
+ return PyErr_SetFromErrno(PyExc_OSError);
|
|
+ }
|
|
break;
|
|
}
|
|
default:
|
|
--
|
|
2.30.2
|
|
|