From 55c2d17c2b9756f4d46a5ec7d1845e34c14f9bfe Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 8 Jul 2007 18:39:32 +0000 Subject: [PATCH] Fix crash when SSL-connecting to something which closes the connection immediately. Also clarify the error message when the SSL handshake fails. This bug was introduced after 0.8.11. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4576 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/network-openssl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index d9bd948e..9ca16e07 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -323,12 +323,14 @@ int irssi_ssl_handshake(GIOChannel *handle) GIOSSLChannel *chan = (GIOSSLChannel *)handle; int ret, err; X509 *cert; + const char *errstr; ret = SSL_connect(chan->ssl); if (ret <= 0) { err = SSL_get_error(chan->ssl, ret); if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) { - g_warning(ERR_reason_error_string(ERR_get_error())); + errstr = ERR_reason_error_string(ERR_get_error()); + g_warning("SSL handshake failed: %s", errstr != NULL ? errstr : "server closed connection"); return -1; } return err == SSL_ERROR_WANT_READ ? 1 : 3;