1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

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
This commit is contained in:
Jilles Tjoelker 2007-07-08 18:39:32 +00:00 committed by jilles
parent 3b72b51257
commit 55c2d17c2b

View File

@ -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;