aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2021-11-20 16:42:16 +0100
committerMatthias Andree <matthias.andree@gmx.de>2021-11-21 00:33:34 +0100
commit0d32056e7b14bd029aa375f59230a3ad3e2bae51 (patch)
treed1775297b4072a5035a463021a2d9f62492708f8
parentcc5c80eb4d6f98b94f20e5abd4cd50c5bf0e5a44 (diff)
downloadfetchmail-0d32056e7b14bd029aa375f59230a3ad3e2bae51.tar.gz
fetchmail-0d32056e7b14bd029aa375f59230a3ad3e2bae51.tar.bz2
fetchmail-0d32056e7b14bd029aa375f59230a3ad3e2bae51.zip
wolfSSL: workaround 5.0.0 SSL_peek() not truly blocking.
SSL_peek() may return 0 on blocking I/O with SSL_get_error() returning SSL_ERROR_WANT_READ. This should not occur on blocking I/O, and does not occur with OpenSSL 1.0.2, 1.1.1, 3.0. This caused a socket error right after SSL negotiation.
-rw-r--r--socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/socket.c b/socket.c
index 5cf0567c..6fee32ea 100644
--- a/socket.c
+++ b/socket.c
@@ -521,7 +521,8 @@ int SockRead(int sock, char *buf, int len)
/* SSL_peek says no data... Does he mean no data
or did the connection blow up? If we got an error
then bail! */
- if (0 != SSL_get_error(ssl, n)) {
+ int r = SSL_get_error(ssl, n);
+ if (r != 0 && r != SSL_ERROR_WANT_READ) {
return -1;
}
/* We didn't get an error so read at least one