aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2021-12-26 22:15:08 +0100
committerMatthias Andree <matthias.andree@gmx.de>2021-12-26 22:17:43 +0100
commit6a5484e03e903d3e74d7b6ca8927d616548a6d8c (patch)
tree1593eb8b86233342b6a04efaaccb9c6875a935b0
parent97e8bb794642b677aca867488950ef845bfbe02f (diff)
downloadfetchmail-6a5484e03e903d3e74d7b6ca8927d616548a6d8c.tar.gz
fetchmail-6a5484e03e903d3e74d7b6ca8927d616548a6d8c.tar.bz2
fetchmail-6a5484e03e903d3e74d7b6ca8927d616548a6d8c.zip
wolfSSL: work around SSL_peek() error on handshake
See https://github.com/wolfSSL/wolfssl/issues/4593 The earlier assumption that SSL_CTX_set_mode() worked was untrue (wolfSSL 5.0.0 does not implement it), and masked by the selection of servers used for testing. Also, wolfSSL 5.0.0 does not implement SSL_CTX_set_mode(), which went unnoticed because the interface does not support returning errors (it returns the updated mode bitfield value).
-rw-r--r--socket.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/socket.c b/socket.c
index 637c3df3..d898fb53 100644
--- a/socket.c
+++ b/socket.c
@@ -526,7 +526,15 @@ int SockRead(int sock, char *buf, int len)
or did the connection blow up? If we got an error
then bail! */
e = SSL_get_error(ssl, n);
- if (SSL_ERROR_NONE != e) {
+ if (SSL_ERROR_NONE != e
+#ifdef USING_WOLFSSL
+ /* wolfSSL 5.0.0 may return SSL_ERROR_WANT_READ when
+ * receiving HANDSHAKE instead of app data on SSL_peek
+ * https://github.com/wolfSSL/wolfssl/issues/4593 */
+ && SSL_ERROR_WANT_READ != e
+#endif
+ )
+ {
ERR_print_errors_fp(stderr);
return -1;
}