Commit b4112fced040d1b45fb60694513c29e220a7791f

Authored by Perry Werneck
1 parent e6c441c5

Improving SSL status information from library.

src/include/lib3270/popup.h
@@ -68,7 +68,8 @@ @@ -68,7 +68,8 @@
68 68
69 LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); 69 LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list);
70 70
71 - LIB3270_EXPORT LIB3270_NOTIFY lib3270_get_ssl_state_icon(H3270 *hSession); 71 + LIB3270_EXPORT LIB3270_NOTIFY lib3270_get_ssl_state_icon(H3270 *hSession);
  72 + LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(H3270 *hSession);
72 73
73 #ifdef __cplusplus 74 #ifdef __cplusplus
74 } 75 }
src/lib3270/private.h
@@ -610,7 +610,11 @@ struct _h3270 @@ -610,7 +610,11 @@ struct _h3270
610 LIB3270_SSL_STATE state; 610 LIB3270_SSL_STATE state;
611 unsigned long error; 611 unsigned long error;
612 #ifdef SSL_ENABLE_CRL_CHECK 612 #ifdef SSL_ENABLE_CRL_CHECK
613 - char * crl; 613 + struct
  614 + {
  615 + char * url;
  616 + X509_CRL * cert;
  617 + } crl;
614 #endif // SSL_ENABLE_CRL_CHECK 618 #endif // SSL_ENABLE_CRL_CHECK
615 SSL * con; 619 SSL * con;
616 } ssl; 620 } ssl;
@@ -704,7 +708,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); @@ -704,7 +708,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on);
704 LIB3270_INTERNAL int ssl_3270_ex_index; 708 LIB3270_INTERNAL int ssl_3270_ex_index;
705 709
706 #ifdef SSL_ENABLE_CRL_CHECK 710 #ifdef SSL_ENABLE_CRL_CHECK
707 - X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message); 711 + int lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message);
708 #endif // SSL_ENABLE_CRL_CHECK 712 #endif // SSL_ENABLE_CRL_CHECK
709 713
710 #endif 714 #endif
src/lib3270/properties.c
@@ -297,8 +297,8 @@ @@ -297,8 +297,8 @@
297 const char * lib3270_get_crl_url(H3270 *hSession) 297 const char * lib3270_get_crl_url(H3270 *hSession)
298 { 298 {
299 #ifdef SSL_ENABLE_CRL_CHECK 299 #ifdef SSL_ENABLE_CRL_CHECK
300 - if(hSession->ssl.crl)  
301 - return hSession->ssl.crl; 300 + if(hSession->ssl.url)
  301 + return hSession->ssl.url;
302 302
303 #ifdef SSL_DEFAULT_CRL_URL 303 #ifdef SSL_DEFAULT_CRL_URL
304 return SSL_DEFAULT_CRL_URL; 304 return SSL_DEFAULT_CRL_URL;
src/lib3270/session.c
@@ -75,12 +75,17 @@ void lib3270_session_free(H3270 *h) @@ -75,12 +75,17 @@ void lib3270_session_free(H3270 *h)
75 shutdown_toggles(h); 75 shutdown_toggles(h);
76 76
77 #ifdef SSL_ENABLE_CRL_CHECK 77 #ifdef SSL_ENABLE_CRL_CHECK
78 - if(h->ssl.crl) 78 + if(h->ssl.crl.url)
79 { 79 {
80 - free(h->ssl.crl);  
81 - h->ssl.crl = NULL; 80 + free(h->ssl.url);
  81 + h->ssl.url = NULL;
  82 + }
  83 +
  84 + if(h->ssl.crl.cert)
  85 + {
  86 + X509_CRL_free(h->ssl.crl.cert);
  87 + h->ssl.crl.cert = NULL;
82 } 88 }
83 -#endif // SSL_ENABLE_CRL_CHECK  
84 89
85 // Release state change callbacks 90 // Release state change callbacks
86 for(f=0;f<LIB3270_STATE_USER;f++) 91 for(f=0;f<LIB3270_STATE_USER;f++)
@@ -92,6 +97,7 @@ void lib3270_session_free(H3270 *h) @@ -92,6 +97,7 @@ void lib3270_session_free(H3270 *h)
92 h->st_callbacks[f] = next; 97 h->st_callbacks[f] = next;
93 } 98 }
94 } 99 }
  100 +#endif // SSL_ENABLE_CRL_CHECK
95 101
96 // Release memory 102 // Release memory
97 #define release_pointer(x) lib3270_free(x); x = NULL; 103 #define release_pointer(x) lib3270_free(x); x = NULL;
src/lib3270/ssl/ctx_init.c
@@ -63,14 +63,6 @@ @@ -63,14 +63,6 @@
63 63
64 /*--[ Implement ]------------------------------------------------------------------------------------*/ 64 /*--[ Implement ]------------------------------------------------------------------------------------*/
65 65
66 -#ifdef SSL_ENABLE_CRL_CHECK  
67 -static inline void lib3270_autoptr_cleanup_X509_CRL(X509_CRL **crl)  
68 -{  
69 - if(*crl)  
70 - X509_CRL_free(*crl);  
71 -}  
72 -#endif // SSL_ENABLE_CRL_CHECK  
73 -  
74 /** 66 /**
75 * @brief Initialize openssl library. 67 * @brief Initialize openssl library.
76 * 68 *
@@ -138,9 +130,7 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -138,9 +130,7 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
138 // 130 //
139 // https://stackoverflow.com/questions/10510850/how-to-verify-the-certificate-for-the-ongoing-ssl-session 131 // https://stackoverflow.com/questions/10510850/how-to-verify-the-certificate-for-the-ongoing-ssl-session
140 // 132 //
141 - lib3270_autoptr(X509_CRL) crl = lib3270_get_X509_CRL(hSession,message);  
142 -  
143 - if(!crl) 133 + if(lib3270_get_X509_CRL(hSession,message))
144 return -1; 134 return -1;
145 135
146 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE)) 136 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE))
@@ -170,6 +160,7 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -170,6 +160,7 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
170 X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); 160 X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
171 X509_STORE_set1_param(store, param); 161 X509_STORE_set1_param(store, param);
172 X509_VERIFY_PARAM_free(param); 162 X509_VERIFY_PARAM_free(param);
  163 +
173 #endif // SSL_ENABLE_CRL_CHECK 164 #endif // SSL_ENABLE_CRL_CHECK
174 165
175 return 0; 166 return 0;
src/lib3270/ssl/linux/getcrl.c
@@ -215,9 +215,8 @@ static int internal_curl_trace_callback(CURL *handle unused, curl_infotype type, @@ -215,9 +215,8 @@ static int internal_curl_trace_callback(CURL *handle unused, curl_infotype type,
215 #endif // HAVE_LIBCURL 215 #endif // HAVE_LIBCURL
216 216
217 217
218 -X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) 218 +int lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
219 { 219 {
220 - X509_CRL * crl = NULL;  
221 const char * consturl = lib3270_get_crl_url(hSession); 220 const char * consturl = lib3270_get_crl_url(hSession);
222 221
223 if(!(consturl && *consturl)) 222 if(!(consturl && *consturl))
@@ -226,7 +225,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -226,7 +225,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
226 message->title = N_( "Security error" ); 225 message->title = N_( "Security error" );
227 message->text = N_( "Can't open CRL File" ); 226 message->text = N_( "Can't open CRL File" );
228 message->description = N_("The URL for the CRL is undefined or empty"); 227 message->description = N_("The URL for the CRL is undefined or empty");
229 - return NULL; 228 + return errno = ENOENT;
230 } 229 }
231 230
232 trace_ssl(hSession, "crl=%s\n",consturl); 231 trace_ssl(hSession, "crl=%s\n",consturl);
@@ -238,17 +237,19 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -238,17 +237,19 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
238 if(!hCRL) 237 if(!hCRL)
239 { 238 {
240 // Can't open CRL File. 239 // Can't open CRL File.
  240 + int err = errno;
  241 +
241 message->error = hSession->ssl.error = 0; 242 message->error = hSession->ssl.error = 0;
242 message->title = N_( "Security error" ); 243 message->title = N_( "Security error" );
243 message->text = N_( "Can't open CRL File" ); 244 message->text = N_( "Can't open CRL File" );
244 message->description = strerror(errno); 245 message->description = strerror(errno);
245 lib3270_write_log(hSession,"ssl","Can't open %s: %s",consturl,message->description); 246 lib3270_write_log(hSession,"ssl","Can't open %s: %s",consturl,message->description);
246 - return NULL; 247 + return err;
247 248
248 } 249 }
249 250
250 lib3270_write_log(hSession,"ssl","Loading CRL from %s",consturl+7); 251 lib3270_write_log(hSession,"ssl","Loading CRL from %s",consturl+7);
251 - d2i_X509_CRL_fp(hCRL, &crl); 252 + d2i_X509_CRL_fp(hCRL, &hSession->ssl.crl.cert);
252 253
253 } 254 }
254 #ifdef HAVE_LDAP 255 #ifdef HAVE_LDAP
@@ -265,7 +266,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -265,7 +266,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
265 message->title = N_( "Security error" ); 266 message->title = N_( "Security error" );
266 message->text = N_( "No DN of the entry at which to start the search on the URL" ); 267 message->text = N_( "No DN of the entry at which to start the search on the URL" );
267 message->description = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" ); 268 message->description = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" );
268 - return NULL; 269 + return errno = EINVAL;
269 } 270 }
270 271
271 *(base++) = 0; 272 *(base++) = 0;
@@ -277,7 +278,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -277,7 +278,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
277 message->title = N_( "Security error" ); 278 message->title = N_( "Security error" );
278 message->text = N_( "No LDAP attribute on the URL" ); 279 message->text = N_( "No LDAP attribute on the URL" );
279 message->description = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" ); 280 message->description = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" );
280 - return NULL; 281 + return errno = EINVAL;
281 } 282 }
282 283
283 *(attrs[0]++) = 0; 284 *(attrs[0]++) = 0;
@@ -298,7 +299,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -298,7 +299,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
298 message->text = N_( "Can't initialize LDAP" ); 299 message->text = N_( "Can't initialize LDAP" );
299 message->description = ldap_err2string(rc); 300 message->description = ldap_err2string(rc);
300 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); 301 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
301 - return NULL; 302 + return -1;
302 } 303 }
303 304
304 unsigned long version = LDAP_VERSION3; 305 unsigned long version = LDAP_VERSION3;
@@ -309,7 +310,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -309,7 +310,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
309 message->text = N_( "Can't set LDAP version" ); 310 message->text = N_( "Can't set LDAP version" );
310 message->description = ldap_err2string(rc); 311 message->description = ldap_err2string(rc);
311 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); 312 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
312 - return NULL; 313 + return -1;
313 } 314 }
314 315
315 rc = ldap_simple_bind_s(ld, "", ""); 316 rc = ldap_simple_bind_s(ld, "", "");
@@ -320,7 +321,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -320,7 +321,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
320 message->text = N_( "Can't bind to LDAP server" ); 321 message->text = N_( "Can't bind to LDAP server" );
321 message->description = ldap_err2string(rc); 322 message->description = ldap_err2string(rc);
322 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); 323 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
323 - return NULL; 324 + return -1;
324 } 325 }
325 326
326 lib3270_autoptr(LDAPMessage) results = NULL; 327 lib3270_autoptr(LDAPMessage) results = NULL;
@@ -345,7 +346,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -345,7 +346,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
345 message->text = N_( "Can't search LDAP server" ); 346 message->text = N_( "Can't search LDAP server" );
346 message->description = ldap_err2string(rc); 347 message->description = ldap_err2string(rc);
347 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); 348 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
348 - return NULL; 349 + return -1;
349 } 350 }
350 351
351 char __attribute__ ((__cleanup__(lib3270_autoptr_cleanup_LDAPPTR))) *attr = ldap_first_attribute(ld, results, &ber); 352 char __attribute__ ((__cleanup__(lib3270_autoptr_cleanup_LDAPPTR))) *attr = ldap_first_attribute(ld, results, &ber);
@@ -356,7 +357,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -356,7 +357,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
356 message->text = N_( "Can't get LDAP attribute" ); 357 message->text = N_( "Can't get LDAP attribute" );
357 message->description = N_("Search did not produce any attributes."); 358 message->description = N_("Search did not produce any attributes.");
358 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); 359 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
359 - return NULL; 360 + return errno = ENOENT;
360 } 361 }
361 362
362 struct berval ** value = ldap_get_values_len(ld, results, attr); 363 struct berval ** value = ldap_get_values_len(ld, results, attr);
@@ -367,7 +368,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -367,7 +368,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
367 message->text = N_( "Can't get LDAP attribute" ); 368 message->text = N_( "Can't get LDAP attribute" );
368 message->description = N_("Search did not produce any values."); 369 message->description = N_("Search did not produce any values.");
369 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); 370 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
370 - return NULL; 371 + return errno = ENOENT;
371 } 372 }
372 373
373 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE)) 374 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE))
@@ -383,12 +384,14 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -383,12 +384,14 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
383 // Precisa salvar uma cópia porque d2i_X509_CRL modifica o ponteiro. 384 // Precisa salvar uma cópia porque d2i_X509_CRL modifica o ponteiro.
384 const unsigned char *crl_data = (const unsigned char *) value[0]->bv_val; 385 const unsigned char *crl_data = (const unsigned char *) value[0]->bv_val;
385 386
386 - if(!d2i_X509_CRL(&crl, &crl_data, value[0]->bv_len)) 387 + if(!d2i_X509_CRL(&hSession->ssl.crl.cert, &crl_data, value[0]->bv_len))
387 { 388 {
388 message->error = hSession->ssl.error = ERR_get_error(); 389 message->error = hSession->ssl.error = ERR_get_error();
389 message->title = N_( "Security error" ); 390 message->title = N_( "Security error" );
390 message->text = N_( "Can't get CRL from LDAP Search" ); 391 message->text = N_( "Can't get CRL from LDAP Search" );
391 lib3270_write_log(hSession,"ssl","%s: %s",url, message->text); 392 lib3270_write_log(hSession,"ssl","%s: %s",url, message->text);
  393 + ldap_value_free_len(value);
  394 + return -1;
392 } 395 }
393 396
394 ldap_value_free_len(value); 397 ldap_value_free_len(value);
@@ -448,7 +451,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -448,7 +451,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
448 } 451 }
449 452
450 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description); 453 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description);
451 - return NULL; 454 + return -1;
452 455
453 } 456 }
454 457
@@ -461,21 +464,8 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -461,21 +464,8 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
461 message->text = N_( "Error loading CRL" ); 464 message->text = N_( "Error loading CRL" );
462 message->description = curl_easy_strerror(res); 465 message->description = curl_easy_strerror(res);
463 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description); 466 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description);
464 - return NULL;  
465 - }  
466 -  
467 - /*  
468 - if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE))  
469 - {  
470 - lib3270_autoptr(char) msg = lib3270_strdup_printf("CRL Data received with content-type \"%s\"", (ct ? ct : "undefined"));  
471 - lib3270_trace_data(  
472 - hSession,  
473 - msg,  
474 - (const char *) crl_data->contents,  
475 - crl_data->length  
476 - ); 467 + return -1;
477 } 468 }
478 - */  
479 469
480 if(ct) 470 if(ct)
481 { 471 {
@@ -484,13 +474,13 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -484,13 +474,13 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
484 if(strcasecmp(ct,"application/pkix-crl") == 0) 474 if(strcasecmp(ct,"application/pkix-crl") == 0)
485 { 475 {
486 // CRL File, convert it 476 // CRL File, convert it
487 - if(!d2i_X509_CRL(&crl, &data, crl_data->length)) 477 + if(!d2i_X509_CRL(&hSession->ssl.crl.cert, &data, crl_data->length))
488 { 478 {
489 message->error = hSession->ssl.error = ERR_get_error(); 479 message->error = hSession->ssl.error = ERR_get_error();
490 message->title = N_( "Security error" ); 480 message->title = N_( "Security error" );
491 message->text = N_( "Got an invalid CRL from server" ); 481 message->text = N_( "Got an invalid CRL from server" );
492 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->text); 482 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->text);
493 - return NULL; 483 + return -1;
494 } 484 }
495 } 485 }
496 else 486 else
@@ -499,7 +489,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -499,7 +489,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
499 message->title = N_( "Security error" ); 489 message->title = N_( "Security error" );
500 message->text = N_( "Got an invalid CRL from server" ); 490 message->text = N_( "Got an invalid CRL from server" );
501 lib3270_write_log(hSession,"ssl","%s: content-type unexpected: \"%s\"",consturl, ct); 491 lib3270_write_log(hSession,"ssl","%s: content-type unexpected: \"%s\"",consturl, ct);
502 - return NULL; 492 + return -1;
503 } 493 }
504 } 494 }
505 else if(strncasecmp(consturl,"ldap://",7) == 0) 495 else if(strncasecmp(consturl,"ldap://",7) == 0)
@@ -512,7 +502,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -512,7 +502,7 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
512 message->title = N_( "Security error" ); 502 message->title = N_( "Security error" );
513 message->text = N_( "Got an invalid CRL from LDAP server" ); 503 message->text = N_( "Got an invalid CRL from LDAP server" );
514 lib3270_write_log(hSession,"ssl","%s: invalid format:\n%s\n",consturl, crl_data->contents); 504 lib3270_write_log(hSession,"ssl","%s: invalid format:\n%s\n",consturl, crl_data->contents);
515 - return NULL; 505 + return -1;
516 } 506 }
517 data += 3; 507 data += 3;
518 508
@@ -523,13 +513,13 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -523,13 +513,13 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
523 513
524 BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); 514 BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
525 515
526 - if(!d2i_X509_CRL_bio(bio, &crl)) 516 + if(!d2i_X509_CRL_bio(bio, &hSession->ssl.crl.cert))
527 { 517 {
528 message->error = hSession->ssl.error = ERR_get_error(); 518 message->error = hSession->ssl.error = ERR_get_error();
529 message->title = N_( "Security error" ); 519 message->title = N_( "Security error" );
530 message->text = N_( "Got an invalid CRL from server" ); 520 message->text = N_( "Got an invalid CRL from server" );
531 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->text); 521 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->text);
532 - return NULL; 522 + return -1;
533 } 523 }
534 524
535 } 525 }
@@ -544,11 +534,11 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -544,11 +534,11 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
544 message->text = N_( "Unexpected or invalid CRL URL" ); 534 message->text = N_( "Unexpected or invalid CRL URL" );
545 message->description = N_("The URL scheme is unknown"); 535 message->description = N_("The URL scheme is unknown");
546 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description); 536 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description);
547 - return NULL; 537 + return errno = EINVAL;
548 #endif // HAVE_LIBCURL 538 #endif // HAVE_LIBCURL
549 } 539 }
550 540
551 - return crl; 541 + return hSession->ssl.crl.cert == NULL ? -1 : 0;
552 542
553 } 543 }
554 544
src/lib3270/ssl/state.c
@@ -84,6 +84,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -84,6 +84,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
84 { 84 {
85 long id; 85 long id;
86 LIB3270_NOTIFY icon; 86 LIB3270_NOTIFY icon;
  87 + const char * iconName; // Icon name from https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
87 const char * message; 88 const char * message;
88 const char * description; 89 const char * description;
89 } 90 }
@@ -93,6 +94,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -93,6 +94,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
93 { 94 {
94 X509_V_OK, 95 X509_V_OK,
95 LIB3270_NOTIFY_SECURE, 96 LIB3270_NOTIFY_SECURE,
  97 + "security-high",
96 N_( "Secure connection was successful." ), 98 N_( "Secure connection was successful." ),
97 N_( "The connection is secure and the host identity was confirmed." ) 99 N_( "The connection is secure and the host identity was confirmed." )
98 }, 100 },
@@ -100,6 +102,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -100,6 +102,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
100 { 102 {
101 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT, 103 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT,
102 LIB3270_NOTIFY_ERROR, 104 LIB3270_NOTIFY_ERROR,
  105 + "dialog-error",
103 N_( "Unable to get issuer certificate" ), 106 N_( "Unable to get issuer certificate" ),
104 N_( "The issuer certificate of a looked up certificate could not be found. This normally means the list of trusted certificates is not complete." ) 107 N_( "The issuer certificate of a looked up certificate could not be found. This normally means the list of trusted certificates is not complete." )
105 }, 108 },
@@ -107,6 +110,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -107,6 +110,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
107 { 110 {
108 X509_V_ERR_UNABLE_TO_GET_CRL, 111 X509_V_ERR_UNABLE_TO_GET_CRL,
109 LIB3270_NOTIFY_ERROR, 112 LIB3270_NOTIFY_ERROR,
  113 + "dialog-error",
110 N_( "Unable to get certificate CRL." ), 114 N_( "Unable to get certificate CRL." ),
111 N_( "The Certificate revocation list (CRL) of a certificate could not be found." ) 115 N_( "The Certificate revocation list (CRL) of a certificate could not be found." )
112 }, 116 },
@@ -114,6 +118,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -114,6 +118,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
114 { 118 {
115 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE, 119 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE,
116 LIB3270_NOTIFY_ERROR, 120 LIB3270_NOTIFY_ERROR,
  121 + "dialog-error",
117 N_( "Unable to decrypt certificate's signature" ), 122 N_( "Unable to decrypt certificate's signature" ),
118 N_( "The certificate signature could not be decrypted. This means that the actual signature value could not be determined rather than it not matching the expected value, this is only meaningful for RSA keys." ) 123 N_( "The certificate signature could not be decrypted. This means that the actual signature value could not be determined rather than it not matching the expected value, this is only meaningful for RSA keys." )
119 }, 124 },
@@ -121,6 +126,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -121,6 +126,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
121 { 126 {
122 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE, 127 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE,
123 LIB3270_NOTIFY_ERROR, 128 LIB3270_NOTIFY_ERROR,
  129 + "dialog-error",
124 N_( "Unable to decrypt CRL's signature" ), 130 N_( "Unable to decrypt CRL's signature" ),
125 N_( "The CRL signature could not be decrypted: this means that the actual signature value could not be determined rather than it not matching the expected value. Unused." ) 131 N_( "The CRL signature could not be decrypted: this means that the actual signature value could not be determined rather than it not matching the expected value. Unused." )
126 }, 132 },
@@ -128,6 +134,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -128,6 +134,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
128 { 134 {
129 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY, 135 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY,
130 LIB3270_NOTIFY_ERROR, 136 LIB3270_NOTIFY_ERROR,
  137 + "dialog-error",
131 N_( "Unable to decode issuer public key" ), 138 N_( "Unable to decode issuer public key" ),
132 N_( "The public key in the certificate SubjectPublicKeyInfo could not be read." ) 139 N_( "The public key in the certificate SubjectPublicKeyInfo could not be read." )
133 }, 140 },
@@ -135,6 +142,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -135,6 +142,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
135 { 142 {
136 X509_V_ERR_CERT_SIGNATURE_FAILURE, 143 X509_V_ERR_CERT_SIGNATURE_FAILURE,
137 LIB3270_NOTIFY_ERROR, 144 LIB3270_NOTIFY_ERROR,
  145 + "dialog-error",
138 N_( "Certificate signature failure" ), 146 N_( "Certificate signature failure" ),
139 N_( "The signature of the certificate is invalid." ) 147 N_( "The signature of the certificate is invalid." )
140 }, 148 },
@@ -142,6 +150,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -142,6 +150,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
142 { 150 {
143 X509_V_ERR_CRL_SIGNATURE_FAILURE, 151 X509_V_ERR_CRL_SIGNATURE_FAILURE,
144 LIB3270_NOTIFY_ERROR, 152 LIB3270_NOTIFY_ERROR,
  153 + "dialog-error",
145 N_( "CRL signature failure" ), 154 N_( "CRL signature failure" ),
146 N_( "The signature of the certificate is invalid." ) 155 N_( "The signature of the certificate is invalid." )
147 }, 156 },
@@ -149,6 +158,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -149,6 +158,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
149 { 158 {
150 X509_V_ERR_CERT_NOT_YET_VALID, 159 X509_V_ERR_CERT_NOT_YET_VALID,
151 LIB3270_NOTIFY_WARNING, 160 LIB3270_NOTIFY_WARNING,
  161 + "dialog-warning",
152 N_( "Certificate is not yet valid" ), 162 N_( "Certificate is not yet valid" ),
153 N_( "The certificate is not yet valid: the notBefore date is after the current time." ) 163 N_( "The certificate is not yet valid: the notBefore date is after the current time." )
154 }, 164 },
@@ -156,6 +166,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -156,6 +166,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
156 { 166 {
157 X509_V_ERR_CERT_HAS_EXPIRED, 167 X509_V_ERR_CERT_HAS_EXPIRED,
158 LIB3270_NOTIFY_ERROR, 168 LIB3270_NOTIFY_ERROR,
  169 + "dialog-error",
159 N_( "Certificate has expired" ), 170 N_( "Certificate has expired" ),
160 N_( "The certificate has expired: that is the notAfter date is before the current time." ) 171 N_( "The certificate has expired: that is the notAfter date is before the current time." )
161 }, 172 },
@@ -163,6 +174,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -163,6 +174,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
163 { 174 {
164 X509_V_ERR_CRL_NOT_YET_VALID, 175 X509_V_ERR_CRL_NOT_YET_VALID,
165 LIB3270_NOTIFY_WARNING, 176 LIB3270_NOTIFY_WARNING,
  177 + "dialog-error",
166 N_( "The CRL is not yet valid." ), 178 N_( "The CRL is not yet valid." ),
167 N_( "The Certificate revocation list (CRL) is not yet valid." ) 179 N_( "The Certificate revocation list (CRL) is not yet valid." )
168 }, 180 },
@@ -174,6 +186,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -174,6 +186,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
174 #else 186 #else
175 LIB3270_NOTIFY_WARNING, 187 LIB3270_NOTIFY_WARNING,
176 #endif // SSL_ENABLE_CRL_EXPIRATION_CHECK 188 #endif // SSL_ENABLE_CRL_EXPIRATION_CHECK
  189 + "security-medium",
177 N_( "The CRL has expired." ), 190 N_( "The CRL has expired." ),
178 N_( "The Certificate revocation list (CRL) has expired.") 191 N_( "The Certificate revocation list (CRL) has expired.")
179 }, 192 },
@@ -181,6 +194,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -181,6 +194,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
181 { 194 {
182 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD, 195 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD,
183 LIB3270_NOTIFY_ERROR, 196 LIB3270_NOTIFY_ERROR,
  197 + "dialog-error",
184 N_( "Format error in certificate's notBefore field" ), 198 N_( "Format error in certificate's notBefore field" ),
185 N_( "The certificate notBefore field contains an invalid time." ) 199 N_( "The certificate notBefore field contains an invalid time." )
186 }, 200 },
@@ -188,6 +202,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -188,6 +202,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
188 { 202 {
189 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD, 203 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD,
190 LIB3270_NOTIFY_ERROR, 204 LIB3270_NOTIFY_ERROR,
  205 + "dialog-error",
191 N_( "Format error in certificate's notAfter field" ), 206 N_( "Format error in certificate's notAfter field" ),
192 N_( "The certificate notAfter field contains an invalid time." ) 207 N_( "The certificate notAfter field contains an invalid time." )
193 }, 208 },
@@ -195,6 +210,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -195,6 +210,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
195 { 210 {
196 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD, 211 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD,
197 LIB3270_NOTIFY_ERROR, 212 LIB3270_NOTIFY_ERROR,
  213 + "dialog-error",
198 N_( "Format error in CRL's lastUpdate field" ), 214 N_( "Format error in CRL's lastUpdate field" ),
199 N_( "The CRL lastUpdate field contains an invalid time." ) 215 N_( "The CRL lastUpdate field contains an invalid time." )
200 }, 216 },
@@ -202,6 +218,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -202,6 +218,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
202 { 218 {
203 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD, 219 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD,
204 LIB3270_NOTIFY_ERROR, 220 LIB3270_NOTIFY_ERROR,
  221 + "dialog-error",
205 N_( "Format error in CRL's nextUpdate field" ), 222 N_( "Format error in CRL's nextUpdate field" ),
206 N_( "The CRL nextUpdate field contains an invalid time." ) 223 N_( "The CRL nextUpdate field contains an invalid time." )
207 }, 224 },
@@ -209,6 +226,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -209,6 +226,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
209 { 226 {
210 X509_V_ERR_OUT_OF_MEM, 227 X509_V_ERR_OUT_OF_MEM,
211 LIB3270_NOTIFY_ERROR, 228 LIB3270_NOTIFY_ERROR,
  229 + "dialog-error",
212 N_( "Out of memory" ), 230 N_( "Out of memory" ),
213 N_( "An error occurred trying to allocate memory. This should never happen." ) 231 N_( "An error occurred trying to allocate memory. This should never happen." )
214 }, 232 },
@@ -216,6 +234,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -216,6 +234,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
216 { 234 {
217 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, 235 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT,
218 LIB3270_NOTIFY_WARNING, 236 LIB3270_NOTIFY_WARNING,
  237 + "security-medium",
219 N_( "Self signed certificate" ), 238 N_( "Self signed certificate" ),
220 N_( "The passed certificate is self signed and the same certificate cannot be found in the list of trusted certificates." ) 239 N_( "The passed certificate is self signed and the same certificate cannot be found in the list of trusted certificates." )
221 }, 240 },
@@ -224,10 +243,12 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -224,10 +243,12 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
224 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN, 243 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN,
225 #ifdef SSL_ENABLE_SELF_SIGNED_CERT_CHECK 244 #ifdef SSL_ENABLE_SELF_SIGNED_CERT_CHECK
226 LIB3270_NOTIFY_ERROR, 245 LIB3270_NOTIFY_ERROR,
  246 + "security-medium",
227 N_( "The SSL certificate for this host is not trusted." ), 247 N_( "The SSL certificate for this host is not trusted." ),
228 N_( "The security certificate presented by this host was not issued by a trusted certificate authority." ) 248 N_( "The security certificate presented by this host was not issued by a trusted certificate authority." )
229 #else 249 #else
230 LIB3270_NOTIFY_WARNING, 250 LIB3270_NOTIFY_WARNING,
  251 + "security-medium",
231 N_( "Self signed certificate in certificate chain" ), 252 N_( "Self signed certificate in certificate chain" ),
232 N_( "The certificate chain could be built up using the untrusted certificates but the root could not be found locally." ) 253 N_( "The certificate chain could be built up using the untrusted certificates but the root could not be found locally." )
233 #endif // SSL_ENABLE_SELF_SIGNED_CERT_CHECK 254 #endif // SSL_ENABLE_SELF_SIGNED_CERT_CHECK
@@ -236,6 +257,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -236,6 +257,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
236 { 257 {
237 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, 258 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY,
238 LIB3270_NOTIFY_WARNING, 259 LIB3270_NOTIFY_WARNING,
  260 + "security-low",
239 N_( "Unable to get local issuer certificate" ), 261 N_( "Unable to get local issuer certificate" ),
240 N_( "The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found." ) 262 N_( "The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found." )
241 }, 263 },
@@ -243,6 +265,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -243,6 +265,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
243 { 265 {
244 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE, 266 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE,
245 LIB3270_NOTIFY_ERROR, 267 LIB3270_NOTIFY_ERROR,
  268 + "security-low",
246 N_( "Unable to verify the first certificate" ), 269 N_( "Unable to verify the first certificate" ),
247 N_( "No signatures could be verified because the chain contains only one certificate and it is not self signed." ) 270 N_( "No signatures could be verified because the chain contains only one certificate and it is not self signed." )
248 }, 271 },
@@ -250,6 +273,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -250,6 +273,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
250 { 273 {
251 X509_V_ERR_CERT_REVOKED, 274 X509_V_ERR_CERT_REVOKED,
252 LIB3270_NOTIFY_ERROR, 275 LIB3270_NOTIFY_ERROR,
  276 + "security-low",
253 N_( "Certificate revoked" ), 277 N_( "Certificate revoked" ),
254 N_( "The certificate has been revoked." ) 278 N_( "The certificate has been revoked." )
255 }, 279 },
@@ -257,6 +281,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -257,6 +281,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
257 { 281 {
258 X509_V_ERR_INVALID_CA, 282 X509_V_ERR_INVALID_CA,
259 LIB3270_NOTIFY_ERROR, 283 LIB3270_NOTIFY_ERROR,
  284 + "security-low",
260 N_( "Invalid CA certificate" ), 285 N_( "Invalid CA certificate" ),
261 N_( "A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose." ) 286 N_( "A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose." )
262 }, 287 },
@@ -264,6 +289,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -264,6 +289,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
264 { 289 {
265 X509_V_ERR_PATH_LENGTH_EXCEEDED, 290 X509_V_ERR_PATH_LENGTH_EXCEEDED,
266 LIB3270_NOTIFY_ERROR, 291 LIB3270_NOTIFY_ERROR,
  292 + "dialog-error",
267 N_( "Path length constraint exceeded" ), 293 N_( "Path length constraint exceeded" ),
268 N_( "The basicConstraints pathlength parameter has been exceeded." ), 294 N_( "The basicConstraints pathlength parameter has been exceeded." ),
269 }, 295 },
@@ -271,6 +297,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -271,6 +297,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
271 { 297 {
272 X509_V_ERR_INVALID_PURPOSE, 298 X509_V_ERR_INVALID_PURPOSE,
273 LIB3270_NOTIFY_ERROR, 299 LIB3270_NOTIFY_ERROR,
  300 + "dialog-error",
274 N_( "Unsupported certificate purpose" ), 301 N_( "Unsupported certificate purpose" ),
275 N_( "The supplied certificate cannot be used for the specified purpose." ) 302 N_( "The supplied certificate cannot be used for the specified purpose." )
276 }, 303 },
@@ -278,6 +305,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -278,6 +305,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
278 { 305 {
279 X509_V_ERR_CERT_UNTRUSTED, 306 X509_V_ERR_CERT_UNTRUSTED,
280 LIB3270_NOTIFY_WARNING, 307 LIB3270_NOTIFY_WARNING,
  308 + "security-low",
281 N_( "Certificate not trusted" ), 309 N_( "Certificate not trusted" ),
282 N_( "The root CA is not marked as trusted for the specified purpose." ) 310 N_( "The root CA is not marked as trusted for the specified purpose." )
283 }, 311 },
@@ -285,6 +313,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -285,6 +313,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
285 { 313 {
286 X509_V_ERR_CERT_REJECTED, 314 X509_V_ERR_CERT_REJECTED,
287 LIB3270_NOTIFY_ERROR, 315 LIB3270_NOTIFY_ERROR,
  316 + "security-low",
288 N_( "Certificate rejected" ), 317 N_( "Certificate rejected" ),
289 N_( "The root CA is marked to reject the specified purpose." ) 318 N_( "The root CA is marked to reject the specified purpose." )
290 }, 319 },
@@ -292,6 +321,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -292,6 +321,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
292 { 321 {
293 X509_V_ERR_SUBJECT_ISSUER_MISMATCH, 322 X509_V_ERR_SUBJECT_ISSUER_MISMATCH,
294 LIB3270_NOTIFY_ERROR, 323 LIB3270_NOTIFY_ERROR,
  324 + "security-low",
295 N_( "Subject issuer mismatch" ), 325 N_( "Subject issuer mismatch" ),
296 N_( "The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate. Only displayed when the -issuer_checks option is set." ) 326 N_( "The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate. Only displayed when the -issuer_checks option is set." )
297 }, 327 },
@@ -299,6 +329,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -299,6 +329,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
299 { 329 {
300 X509_V_ERR_AKID_SKID_MISMATCH, 330 X509_V_ERR_AKID_SKID_MISMATCH,
301 LIB3270_NOTIFY_ERROR, 331 LIB3270_NOTIFY_ERROR,
  332 + "dialog-error",
302 N_( "Authority and subject key identifier mismatch" ), 333 N_( "Authority and subject key identifier mismatch" ),
303 N_( "The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier current certificate. Only displayed when the -issuer_checks option is set." ) 334 N_( "The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier current certificate. Only displayed when the -issuer_checks option is set." )
304 }, 335 },
@@ -306,6 +337,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -306,6 +337,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
306 { 337 {
307 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH, 338 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH,
308 LIB3270_NOTIFY_ERROR, 339 LIB3270_NOTIFY_ERROR,
  340 + "dialog-error",
309 N_( "Authority and issuer serial number mismatch" ), 341 N_( "Authority and issuer serial number mismatch" ),
310 N_( "The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate. Only displayed when the -issuer_checks option is set." ) 342 N_( "The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate. Only displayed when the -issuer_checks option is set." )
311 }, 343 },
@@ -313,6 +345,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -313,6 +345,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
313 { 345 {
314 X509_V_ERR_KEYUSAGE_NO_CERTSIGN, 346 X509_V_ERR_KEYUSAGE_NO_CERTSIGN,
315 LIB3270_NOTIFY_ERROR, 347 LIB3270_NOTIFY_ERROR,
  348 + "dialog-error",
316 N_( "Key usage does not include certificate signing" ), 349 N_( "Key usage does not include certificate signing" ),
317 N_( "The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing." ) 350 N_( "The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing." )
318 } 351 }
@@ -341,9 +374,24 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) @@ -341,9 +374,24 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state)
341 return gettext(info->message); 374 return gettext(info->message);
342 } 375 }
343 376
344 - return lib3270_get_hostname(hSession); 377 + return _( "The connection is insecure" );
  378 +
  379 + }
  380 +
  381 + const char * lib3270_get_ssl_state_icon_name(H3270 *hSession)
  382 + {
  383 + if(lib3270_get_secure(hSession) != LIB3270_SSL_UNSECURE)
  384 + {
  385 + const struct ssl_status_msg *info = get_ssl_status_msg(hSession);
  386 + if(info)
  387 + return info->iconName;
  388 + }
  389 +
  390 + return "dialog-error";
  391 +
345 } 392 }
346 393
  394 +
347 const char * lib3270_get_ssl_state_description(H3270 *hSession) 395 const char * lib3270_get_ssl_state_description(H3270 *hSession)
348 { 396 {
349 if(lib3270_get_secure(hSession) != LIB3270_SSL_UNSECURE) 397 if(lib3270_get_secure(hSession) != LIB3270_SSL_UNSECURE)