]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-115627: Fix PySSL_SetError handling SSL_ERROR_SYSCALL (GH-115628)
authoryevgeny hong <hongyevgeny@gmail.com>
Tue, 26 Mar 2024 07:45:43 +0000 (16:45 +0900)
committerGitHub <noreply@github.com>
Tue, 26 Mar 2024 07:45:43 +0000 (08:45 +0100)
commitea9a296fce2f786b4cf43c7924e5de01061f27ca
tree0bf5ebcaa4d4ebffc7b56d5c653b53900befc612
parentd52bdfb19fadd7614a0e5abaf68525fc7300e841
gh-115627: Fix PySSL_SetError handling SSL_ERROR_SYSCALL (GH-115628)

Python 3.10 changed from using SSL_write() and SSL_read() to SSL_write_ex() and
SSL_read_ex(), but did not update handling of the return value.

Change error handling so that the return value is not examined.
OSError (not EOF) is now returned when retval is 0.

According to *recent* man pages of all functions for which we call
PySSL_SetError, (in OpenSSL 3.0 and 1.1.1), their return value should
be used to determine whether an error happened (i.e. if PySSL_SetError
should be called), but not what kind of error happened (so,
PySSL_SetError shouldn't need retval). To get the error,
we need to use SSL_get_error.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Lib/test/test_ssl.py
Misc/NEWS.d/next/Library/2024-02-18-09-50-31.gh-issue-115627.HGchj0.rst [new file with mode: 0644]
Modules/_ssl.c