From b61979a9e590c2aa8eabf563c9e154c9be33069c Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Thu, 14 May 2020 23:12:04 -0400 Subject: [PATCH] Flush the OpenSSL error queue before each BIO op. --- postfix/src/tls/tls_bio_ops.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/postfix/src/tls/tls_bio_ops.c b/postfix/src/tls/tls_bio_ops.c index 93d3535d7..39818f815 100644 --- a/postfix/src/tls/tls_bio_ops.c +++ b/postfix/src/tls/tls_bio_ops.c @@ -196,6 +196,12 @@ int tls_bio(int fd, int timeout, TLS_SESS_STATE *TLScontext, * handling any pending network I/O. */ for (;;) { + /* + * Flush stale data from SSL error queue, stale errors can confuse + * SSL_get_error(). + */ + ERR_clear_error(); + if (hsfunc) status = hsfunc(TLScontext->con); else if (rfunc) -- 2.47.3