Commit 35db594a7a9b8bdbb0913826f275799e643d7fac

Authored by Perry Werneck
1 parent 76612edf

Disconnect from SSL error should be marked as "failed" using

host_disconnected.
Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
src/lib3270/ssl/negotiate.c
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 #include <lib3270.h> 52 #include <lib3270.h>
53 #include <lib3270/internals.h> 53 #include <lib3270/internals.h>
54 #include <lib3270/trace.h> 54 #include <lib3270/trace.h>
  55 +#include "hostc.h" // host_disconnect
55 #include "trace_dsc.h" 56 #include "trace_dsc.h"
56 57
57 /*--[ Implement ]------------------------------------------------------------------------------------*/ 58 /*--[ Implement ]------------------------------------------------------------------------------------*/
@@ -152,7 +153,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) @@ -152,7 +153,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
152 153
153 ((SSL_ERROR_MESSAGE *) message)->title = N_( "Security error" ); 154 ((SSL_ERROR_MESSAGE *) message)->title = N_( "Security error" );
154 ((SSL_ERROR_MESSAGE *) message)->text = N_( "SSL Connect failed" ); 155 ((SSL_ERROR_MESSAGE *) message)->text = N_( "SSL Connect failed" );
155 - lib3270_disconnect(hSession); 156 +
156 return -1; 157 return -1;
157 158
158 } 159 }
@@ -285,12 +286,13 @@ int ssl_negotiate(H3270 *hSession) @@ -285,12 +286,13 @@ int ssl_negotiate(H3270 *hSession)
285 if(rc) 286 if(rc)
286 { 287 {
287 // SSL Negotiation has failed. 288 // SSL Negotiation has failed.
  289 + host_disconnect(hSession,1); // Disconnect with "failed" status.
  290 +
288 if(msg.description) 291 if(msg.description)
289 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", msg.description); 292 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", msg.description);
290 else 293 else
291 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", ERR_reason_error_string(msg.error)); 294 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", ERR_reason_error_string(msg.error));
292 295
293 - lib3270_disconnect(hSession);  
294 296
295 } 297 }
296 298
@@ -312,12 +314,13 @@ int ssl_init(H3270 *hSession) { @@ -312,12 +314,13 @@ int ssl_init(H3270 *hSession) {
312 if(rc) 314 if(rc)
313 { 315 {
314 // SSL init has failed. 316 // SSL init has failed.
  317 + host_disconnect(hSession,1); // Disconnect with "failed" status.
  318 +
315 if(msg.description) 319 if(msg.description)
316 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", msg.description); 320 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", msg.description);
317 else 321 else
318 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", ERR_reason_error_string(msg.error)); 322 lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, msg.title, msg.text, "%s", ERR_reason_error_string(msg.error));
319 323
320 - lib3270_disconnect(hSession);  
321 } 324 }
322 325
323 non_blocking(hSession,True); 326 non_blocking(hSession,True);