summaryrefslogtreecommitdiff
path: root/src/core/network-openssl.c
diff options
context:
space:
mode:
authorWill Storey <will@summercat.com>2016-03-13 13:28:04 -0700
committerWill Storey <will@summercat.com>2016-03-13 13:28:04 -0700
commitbe733d24824fe2a3502a1e4ab76d50699052dd65 (patch)
tree31db47be21462b631bfcdbf1d18e8e969c60b584 /src/core/network-openssl.c
parent66e9c4bb39ed5c0b2d9b81e8610e894af82abd8e (diff)
downloadirssi-be733d24824fe2a3502a1e4ab76d50699052dd65.zip
Clear error queue before SSL I/O operations
Otherwise we can see errors that are not related to the operation we check for. SSL_get_error() inspects the thread's error queue. See https://www.openssl.org/docs/manmaster/ssl/SSL_get_error.html for more information.
Diffstat (limited to 'src/core/network-openssl.c')
-rw-r--r--src/core/network-openssl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c
index 465c4154..d0f23253 100644
--- a/src/core/network-openssl.c
+++ b/src/core/network-openssl.c
@@ -289,6 +289,7 @@ static GIOStatus irssi_ssl_read(GIOChannel *handle, gchar *buf, gsize len, gsize
const char *errstr;
gchar *errmsg;
+ ERR_clear_error();
ret1 = SSL_read(chan->ssl, buf, len);
if(ret1 <= 0)
{
@@ -334,6 +335,7 @@ static GIOStatus irssi_ssl_write(GIOChannel *handle, const gchar *buf, gsize len
const char *errstr;
gchar *errmsg;
+ ERR_clear_error();
ret1 = SSL_write(chan->ssl, (const char *)buf, len);
if(ret1 <= 0)
{
@@ -581,6 +583,7 @@ int irssi_ssl_handshake(GIOChannel *handle)
X509 *cert;
const char *errstr;
+ ERR_clear_error();
ret = SSL_connect(chan->ssl);
if (ret <= 0) {
err = SSL_get_error(chan->ssl, ret);