Commit e3a2575776cebe16a8033dc0a1f84a37b7fd2b80

Authored by Perry Werneck
1 parent e5febe41
Exists in master and in 2 other branches develop, macos

Fixing SSL connect error messages.

src/network_modules/openssl/context.c
... ... @@ -112,6 +112,16 @@ static void info_callback(INFO_CONST SSL *s, int where, int ret)
112 112 err_buf[0] = '\0';
113 113 }
114 114  
  115 + debug("SSL Connect error %d\nMessage: %s\nState: %s\nAlert: %s\n",
  116 + ret,
  117 + err_buf,
  118 + SSL_state_string_long(s),
  119 + SSL_alert_type_string_long(ret)
  120 + );
  121 +
  122 + hSession->ssl.error = e;
  123 + debug("hSession->ssl.error=%d",hSession->ssl.error);
  124 +
115 125 trace_ssl(hSession,"SSL Connect error %d\nMessage: %s\nState: %s\nAlert: %s\n",
116 126 ret,
117 127 err_buf,
... ...
src/network_modules/openssl/start.c
... ... @@ -216,6 +216,7 @@
216 216 }
217 217  
218 218 trace_ssl(hSession, "%s","Running SSL_connect\n");
  219 + hSession->ssl.error = 0;
219 220 int rv = SSL_connect(context->con);
220 221 trace_ssl(hSession, "SSL_connect exits with rc=%d\n",rv);
221 222  
... ... @@ -223,13 +224,14 @@
223 224 {
224 225 LIB3270_SSL_MESSAGE message = {
225 226 .type = LIB3270_NOTIFY_ERROR,
226   - .title = N_( "SSL Connect failed" ),
227   - .summary = N_("The client was unable to negotiate a secure connection with the host"),
  227 + .title = N_( "Connection failed" ),
  228 + .summary = N_("Unable to negotiate a secure connection with the host"),
228 229 };
229 230  
230   - int code = SSL_get_error(context->con,rv);
  231 + if(!hSession->ssl.error)
  232 + hSession->ssl.error = SSL_get_error(context->con,rv);
231 233  
232   - if(code == SSL_ERROR_SYSCALL) {
  234 + if(hSession->ssl.error == SSL_ERROR_SYSCALL) {
233 235  
234 236 // Some I/O error occurred.
235 237 // The OpenSSL error queue may contain more information on the error.
... ... @@ -248,12 +250,12 @@
248 250  
249 251 } else {
250 252  
251   - message.body = ERR_reason_error_string(code);
  253 + message.body = ERR_reason_error_string(hSession->ssl.error);
252 254  
253 255 }
254 256  
255   - debug("SSL_connect failed: %s (rc=%d)\n",message.body ? message.body : message.summary, code);
256   - trace_ssl(hSession,"SSL_connect failed: %s (rc=%d)\n",message.body ? message.body : message.summary, code);
  257 + debug("SSL_connect failed: %s (rc=%d)\n",message.body ? message.body : message.summary, hSession->ssl.error);
  258 + trace_ssl(hSession,"SSL_connect failed: %s (rc=%d)\n",message.body ? message.body : message.summary, hSession->ssl.error);
257 259  
258 260 hSession->ssl.message = &message;
259 261 return -1;
... ...