mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 08:31:43 +02:00
Fix error handling with OpenSSL 3.0 in SecureSocketImpl.cpp (#3971)
This commit is contained in:
@@ -537,11 +537,13 @@ int SecureSocketImpl::handleError(int rc)
|
|||||||
// SSL_ERROR_SYSCALL, nothing was added to the error stack, and
|
// SSL_ERROR_SYSCALL, nothing was added to the error stack, and
|
||||||
// errno was 0. Since OpenSSL 3.0 the returned error is
|
// errno was 0. Since OpenSSL 3.0 the returned error is
|
||||||
// SSL_ERROR_SSL with a meaningful error on the error stack.
|
// SSL_ERROR_SSL with a meaningful error on the error stack.
|
||||||
|
// However, we still need to check for socket errors in both
|
||||||
|
// cases with OpenSSL 3.0 or later.
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||||
case SSL_ERROR_SSL:
|
case SSL_ERROR_SSL:
|
||||||
#else
|
// fallthrough to handle socket errors first
|
||||||
case SSL_ERROR_SYSCALL:
|
|
||||||
#endif
|
#endif
|
||||||
|
case SSL_ERROR_SYSCALL:
|
||||||
if (socketError)
|
if (socketError)
|
||||||
{
|
{
|
||||||
SocketImpl::error(socketError);
|
SocketImpl::error(socketError);
|
||||||
@@ -557,6 +559,11 @@ int SecureSocketImpl::handleError(int rc)
|
|||||||
ERR_error_string_n(lastError, buffer, sizeof(buffer));
|
ERR_error_string_n(lastError, buffer, sizeof(buffer));
|
||||||
msg = buffer;
|
msg = buffer;
|
||||||
}
|
}
|
||||||
|
// SSL_GET_ERROR(3ossl):
|
||||||
|
// On an unexpected EOF, versions before OpenSSL 3.0 returned
|
||||||
|
// SSL_ERROR_SYSCALL, nothing was added to the error stack, and
|
||||||
|
// errno was 0. Since OpenSSL 3.0 the returned error is
|
||||||
|
// SSL_ERROR_SSL with a meaningful error on the error stack.
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||||
if (sslError == SSL_ERROR_SSL)
|
if (sslError == SSL_ERROR_SSL)
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user