fix crash in ssl connection error path

not a good idea to invoke the callback twice ...
This commit is contained in:
Oswald Buddenhagen 2013-03-17 14:32:06 +01:00
parent acb1c870b4
commit a66034b23a

View File

@ -275,13 +275,7 @@ socket_start_tls( conn_t *conn, void (*cb)( int ok, void *aux ) )
static void static void
start_tls_p2( conn_t *conn ) start_tls_p2( conn_t *conn )
{ {
switch (ssl_return( "connect to", conn, SSL_connect( conn->ssl ) )) { if (ssl_return( "connect to", conn, SSL_connect( conn->ssl ) ) > 0) {
case -1:
start_tls_p3( conn, 0 );
break;
case 0:
break;
default:
/* verify whether the server hostname matches the certificate */ /* verify whether the server hostname matches the certificate */
if (verify_cert_host( conn->conf, conn )) { if (verify_cert_host( conn->conf, conn )) {
start_tls_p3( conn, 0 ); start_tls_p3( conn, 0 );
@ -289,7 +283,6 @@ start_tls_p2( conn_t *conn )
info( "Connection is now encrypted\n" ); info( "Connection is now encrypted\n" );
start_tls_p3( conn, 1 ); start_tls_p3( conn, 1 );
} }
break;
} }
} }