From 6750617b8ea6e7b593e511f8c0a8a18934330acb Mon Sep 17 00:00:00 2001 From: U-CORPORATE\brwera00 Date: Wed, 2 Oct 2019 20:29:03 -0300 Subject: [PATCH] Partial fix of non-ssl windows build. --- src/core/connect.c | 2 +- src/core/host.c | 7 +++++-- src/core/session.c | 2 +- src/core/telnet.c | 7 +++++-- src/core/windows/connect.c | 3 ++- src/include/lib3270-internals.h | 3 ++- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/core/connect.c b/src/core/connect.c index fc3dec5..a7b04f8 100644 --- a/src/core/connect.c +++ b/src/core/connect.c @@ -233,6 +233,7 @@ static int notify_crl_error(H3270 *hSession, int rc, const SSL_ERROR_MESSAGE *me #if defined(HAVE_LIBSSL) set_ssl_state(hSession,LIB3270_SSL_UNDEFINED); + hSession->ssl.host = 0; #endif // HAVE_LIBSSL snprintf(hSession->full_model_name,LIB3270_FULL_MODEL_NAME_LENGTH,"IBM-327%c-%d",hSession->m3279 ? '9' : '8', hSession->model_num); @@ -240,7 +241,6 @@ static int notify_crl_error(H3270 *hSession, int rc, const SSL_ERROR_MESSAGE *me lib3270_trace_event(hSession,"Reconnecting to %s\n",lib3270_get_url(hSession)); hSession->ever_3270 = False; - hSession->ssl.host = 0; return net_reconnect(hSession,seconds); diff --git a/src/core/host.c b/src/core/host.c index d1efe7c..9c664b0 100644 --- a/src/core/host.c +++ b/src/core/host.c @@ -153,7 +153,10 @@ void lib3270_set_disconnected(H3270 *hSession) hSession->cstate = LIB3270_NOT_CONNECTED; hSession->starting = 0; + +#if defined(HAVE_LIBSSL) hSession->ssl.state = LIB3270_SSL_UNDEFINED; +#endif // HAVE_LIBSSL set_status(hSession,LIB3270_FLAG_UNDERA,False); @@ -164,7 +167,9 @@ void lib3270_set_disconnected(H3270 *hSession) if(hSession->cbk.update_connect) hSession->cbk.update_connect(hSession,0); +#if defined(HAVE_LIBSSL) hSession->cbk.update_ssl(hSession,hSession->ssl.state); +#endif // HAVE_LIBSSL } @@ -304,8 +309,6 @@ static void update_host(H3270 *h) h->host.srvc )); - trace("hosturl=[%s] ssl=%s",h->host.full,h->ssl.enabled ? "yes" : "no"); - } LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname) diff --git a/src/core/session.c b/src/core/session.c index be4cfe3..3075568 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -287,7 +287,7 @@ static void set_peer_certificate(const X509 GNUC_UNUSED(*cert)) } #else -static void set_peer_certificate)(const void GNUC_UNUSED(*cert)) +static void set_peer_certificate(const void GNUC_UNUSED(*cert)) { } diff --git a/src/core/telnet.c b/src/core/telnet.c index c20d7ca..d08d862 100644 --- a/src/core/telnet.c +++ b/src/core/telnet.c @@ -435,15 +435,18 @@ static int net_connected(H3270 *hSession) } */ - trace_dsn(hSession,"Connected to %s%s.\n", hSession->host.current,hSession->ssl.host? " using SSL": ""); - #if defined(HAVE_LIBSSL) /* Set up SSL. */ + trace_dsn(hSession,"Connected to %s%s.\n", hSession->host.current,hSession->ssl.host? " using SSL": ""); + if(hSession->ssl.con && hSession->ssl.state == LIB3270_SSL_UNDEFINED) { if(ssl_negotiate(hSession)) return -1; } +#else + trace_dsn(hSession,"Connected to %s.\n", hSession->host.current); + #endif lib3270_setup_session(hSession); diff --git a/src/core/windows/connect.c b/src/core/windows/connect.c index c4cdb59..a8db30f 100644 --- a/src/core/windows/connect.c +++ b/src/core/windows/connect.c @@ -308,9 +308,10 @@ int net_reconnect(H3270 *hSession, int seconds) } hSession->ever_3270 = False; - hSession->ssl.host = 0; #if defined(HAVE_LIBSSL) + hSession->ssl.host = 0; + if(hSession->ssl.enabled) { hSession->ssl.host = 1; diff --git a/src/include/lib3270-internals.h b/src/include/lib3270-internals.h index cd3951b..d8e30e6 100644 --- a/src/include/lib3270-internals.h +++ b/src/include/lib3270-internals.h @@ -837,6 +837,8 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); LIB3270_INTERNAL X509_CRL * lib3270_get_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, const char *url); #endif // SSL_ENABLE_CRL_CHECK +#endif + /// @brief Clear element at adress. LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr); @@ -847,5 +849,4 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); LIB3270_INTERNAL char * lib3270_get_user_name(); -#endif -- libgit2 0.21.2