commit a66034b23ae861b410a5dcc1208262e9931e9f87
parent acb1c870b4045a614beea6b555d94f6bf9cfc1b8
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Sun, 17 Mar 2013 14:32:06 +0100
fix crash in ssl connection error path
not a good idea to invoke the callback twice ...
Diffstat:
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/socket.c b/src/socket.c
@@ -275,13 +275,7 @@ socket_start_tls( conn_t *conn, void (*cb)( int ok, void *aux ) )
static void
start_tls_p2( conn_t *conn )
{
- switch (ssl_return( "connect to", conn, SSL_connect( conn->ssl ) )) {
- case -1:
- start_tls_p3( conn, 0 );
- break;
- case 0:
- break;
- default:
+ if (ssl_return( "connect to", conn, SSL_connect( conn->ssl ) ) > 0) {
/* verify whether the server hostname matches the certificate */
if (verify_cert_host( conn->conf, conn )) {
start_tls_p3( conn, 0 );
@@ -289,7 +283,6 @@ start_tls_p2( conn_t *conn )
info( "Connection is now encrypted\n" );
start_tls_p3( conn, 1 );
}
- break;
}
}