From 08d0552ef433023c691c6e098a958a2f7482a28f Mon Sep 17 00:00:00 2001 From: Sven Geuer <68420948@users.noreply.github.com> Date: Mon, 4 Sep 2023 12:43:45 +0200 Subject: [PATCH] Remediate faulty patch for #57 --- ptstream.c | 9 ++++----- ptstream.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ptstream.c b/ptstream.c index 7146862..0ba3bf4 100644 --- a/ptstream.c +++ b/ptstream.c @@ -341,11 +341,10 @@ int stream_enable_ssl(PTSTREAM *pts, const char *proxy_arg) { message( "Set SNI hostname to %s\n", peer_host); } res = SSL_set_tlsext_host_name(ssl, peer_host); - if (res != SSL_TLSEXT_ERR_OK) { - unsigned long ssl_err = (res == SSL_TLSEXT_ERR_ALERT_WARNING ? SSL_TLSEXT_ERR_ALERT_WARNING : ERR_get_error()); - message( "SSL_set_tlsext_host_name returned: %lu (0x%lx). " - "TLS SNI error, giving up\n", ssl_err, ssl_err ); - exit( 1 ); + if ( res != 1 ) { + message( "SSL_set_tlsext_host_name() failed for host name '%s'. " + "TLS SNI error, giving up\n", peer_host); + goto fail; } if ( SSL_connect (ssl) <= 0) { diff --git a/ptstream.h b/ptstream.h index 36610d9..ee36af2 100644 --- a/ptstream.h +++ b/ptstream.h @@ -21,7 +21,6 @@ #ifdef USE_SSL #include -#include #include #include #include