Commit 63cb8e62f509ee752fab886a995b41c0c3a581da

Authored by Perry Werneck
1 parent ca2f1d62

Refactoring popup engine.

src/core/session.c
@@ -233,6 +233,18 @@ static void def_popup(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(type), const ch @@ -233,6 +233,18 @@ static void def_popup(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(type), const ch
233 #endif // ANDROID 233 #endif // ANDROID
234 } 234 }
235 235
  236 +static int def_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait)
  237 +{
  238 + lib3270_popup_dialog(
  239 + hSession,
  240 + popup->type,
  241 + popup->title,
  242 + popup->summary,
  243 + "%s", popup->body
  244 + );
  245 + return ENOTSUP;
  246 +}
  247 +
236 static int def_popup_ssl_error(H3270 *session, int GNUC_UNUSED(rc), const char *title, const char *summary, const char *body) 248 static int def_popup_ssl_error(H3270 *session, int GNUC_UNUSED(rc), const char *title, const char *summary, const char *body)
237 { 249 {
238 lib3270_popup_dialog(session, LIB3270_NOTIFY_ERROR, title, summary, "%s", body); 250 lib3270_popup_dialog(session, LIB3270_NOTIFY_ERROR, title, summary, "%s", body);
@@ -305,8 +317,6 @@ void lib3270_reset_callbacks(H3270 *hSession) @@ -305,8 +317,6 @@ void lib3270_reset_callbacks(H3270 *hSession)
305 hSession->cbk.update_selection = update_selection; 317 hSession->cbk.update_selection = update_selection;
306 hSession->cbk.cursor = set_cursor; 318 hSession->cbk.cursor = set_cursor;
307 hSession->cbk.message = message; 319 hSession->cbk.message = message;
308 - hSession->cbk.popup = def_popup;  
309 - hSession->cbk.popup_ssl_error = def_popup_ssl_error;  
310 hSession->cbk.update_ssl = update_ssl; 320 hSession->cbk.update_ssl = update_ssl;
311 hSession->cbk.display = screen_disp; 321 hSession->cbk.display = screen_disp;
312 hSession->cbk.set_width = nop_int; 322 hSession->cbk.set_width = nop_int;
@@ -319,6 +329,11 @@ void lib3270_reset_callbacks(H3270 *hSession) @@ -319,6 +329,11 @@ void lib3270_reset_callbacks(H3270 *hSession)
319 hSession->cbk.set_peer_certificate = set_peer_certificate; 329 hSession->cbk.set_peer_certificate = set_peer_certificate;
320 hSession->cbk.update_luname = default_update_luname; 330 hSession->cbk.update_luname = default_update_luname;
321 hSession->cbk.update_url = default_update_url; 331 hSession->cbk.update_url = default_update_url;
  332 +
  333 + hSession->cbk.popup = def_popup;
  334 + hSession->cbk.popup_ssl_error = def_popup_ssl_error;
  335 + hSession->cbk.popup_show = def_popup_show;
  336 +
322 } 337 }
323 338
324 static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset) 339 static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset)
src/core/util.c
@@ -305,6 +305,15 @@ LIB3270_EXPORT void lib3270_autoptr_cleanup_char(char **ptr) @@ -305,6 +305,15 @@ LIB3270_EXPORT void lib3270_autoptr_cleanup_char(char **ptr)
305 } 305 }
306 } 306 }
307 307
  308 +LIB3270_EXPORT void lib3270_autoptr_cleanup_LIB3270_POPUP(LIB3270_POPUP **ptr)
  309 +{
  310 + if(ptr && *ptr)
  311 + {
  312 + free((void *) *ptr);
  313 + *ptr = NULL;
  314 + }
  315 +}
  316 +
308 LIB3270_EXPORT void * lib3270_realloc(void *p, int len) 317 LIB3270_EXPORT void * lib3270_realloc(void *p, int len)
309 { 318 {
310 p = realloc(p, len); 319 p = realloc(p, len);
src/include/internals.h
@@ -795,7 +795,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); @@ -795,7 +795,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on);
795 DWORD lasterror; 795 DWORD lasterror;
796 #endif // _WIN32 796 #endif // _WIN32
797 797
798 - const LIB3270_POPUP_DESCRIPTOR *popup; /// @brief Pointer to popup message. 798 + const LIB3270_POPUP *popup; /// @brief Pointer to popup message.
799 799
800 } SSL_ERROR_MESSAGE; 800 } SSL_ERROR_MESSAGE;
801 801
src/include/lib3270/popup.h
@@ -64,10 +64,10 @@ @@ -64,10 +64,10 @@
64 const char * summary; \ 64 const char * summary; \
65 const char * body; 65 const char * body;
66 66
67 - typedef struct _lib3270_popup_descriptor 67 + typedef struct _LIB3270_POPUP
68 { 68 {
69 LIB3270_POPUP_HEAD 69 LIB3270_POPUP_HEAD
70 - } LIB3270_POPUP_DESCRIPTOR; 70 + } LIB3270_POPUP;
71 71
72 LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); 72 LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list));
73 73
@@ -100,7 +100,13 @@ @@ -100,7 +100,13 @@
100 * @retval 0 User has confirmed, continue action. 100 * @retval 0 User has confirmed, continue action.
101 * @retval ECANCELED Operation was cancelled. 101 * @retval ECANCELED Operation was cancelled.
102 */ 102 */
103 - LIB3270_EXPORT int lib3270_emit_popup(H3270 *hSession, const LIB3270_POPUP_DESCRIPTOR *popup, unsigned char wait); 103 + LIB3270_EXPORT int lib3270_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait);
  104 +
  105 + /**
  106 + * @brief Auto cleanup method (for use with lib3270_autoptr).
  107 + *
  108 + */
  109 + LIB3270_EXPORT void lib3270_autoptr_cleanup_LIB3270_POPUP(LIB3270_POPUP **ptr);
104 110
105 #ifdef __cplusplus 111 #ifdef __cplusplus
106 } 112 }
src/include/lib3270/session.h
@@ -82,8 +82,10 @@ @@ -82,8 +82,10 @@
82 int (*load)(H3270 *hSession, const char *filename); 82 int (*load)(H3270 *hSession, const char *filename);
83 83
84 void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); 84 void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text);
  85 +
85 void (*popup)(H3270 *session, LIB3270_NOTIFY id, const char *title, const char *msg, const char *fmt, va_list); 86 void (*popup)(H3270 *session, LIB3270_NOTIFY id, const char *title, const char *msg, const char *fmt, va_list);
86 int (*popup_ssl_error)(H3270 *session, int rc, const char *title, const char *summary, const char *body); 87 int (*popup_ssl_error)(H3270 *session, int rc, const char *title, const char *summary, const char *body);
  88 + int (*popup_show)(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait);
87 89
88 #ifdef HAVE_LIBSSL 90 #ifdef HAVE_LIBSSL
89 void (*set_peer_certificate)(const X509 *cert); 91 void (*set_peer_certificate)(const X509 *cert);
@@ -161,7 +161,7 @@ int lib3270_crl_new_from_x509(H3270 *hSession, void *ssl_error, X509 *cert) @@ -161,7 +161,7 @@ int lib3270_crl_new_from_x509(H3270 *hSession, void *ssl_error, X509 *cert)
161 161
162 if(!dist_points) 162 if(!dist_points)
163 { 163 {
164 - static const LIB3270_POPUP_DESCRIPTOR popup = { 164 + static const LIB3270_POPUP popup = {
165 .name = "SSL-NoDistPoints", 165 .name = "SSL-NoDistPoints",
166 .type = LIB3270_NOTIFY_SECURE, 166 .type = LIB3270_NOTIFY_SECURE,
167 .summary = N_("Can't verify"), 167 .summary = N_("Can't verify"),
src/ssl/linux/getcrl.c
@@ -51,7 +51,7 @@ X509_CRL * lib3270_download_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, co @@ -51,7 +51,7 @@ X509_CRL * lib3270_download_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, co
51 51
52 if(!(consturl && *consturl)) 52 if(!(consturl && *consturl))
53 { 53 {
54 - static const LIB3270_POPUP_DESCRIPTOR popup = { 54 + static const LIB3270_POPUP popup = {
55 .type = LIB3270_NOTIFY_SECURE, 55 .type = LIB3270_NOTIFY_SECURE,
56 .name = "SSL-INVCRLURL", 56 .name = "SSL-INVCRLURL",
57 .summary = N_( "Can't open CRL File" ), 57 .summary = N_( "Can't open CRL File" ),
@@ -73,7 +73,7 @@ X509_CRL * lib3270_download_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, co @@ -73,7 +73,7 @@ X509_CRL * lib3270_download_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, co
73 // Can't open CRL File. 73 // Can't open CRL File.
74 int err = errno; 74 int err = errno;
75 75
76 - static const LIB3270_POPUP_DESCRIPTOR popup = { 76 + static const LIB3270_POPUP popup = {
77 .type = LIB3270_NOTIFY_SECURE, 77 .type = LIB3270_NOTIFY_SECURE,
78 .name = "SSL-CRLOPEN", 78 .name = "SSL-CRLOPEN",
79 .summary = N_( "Can't open CRL File" ) 79 .summary = N_( "Can't open CRL File" )
@@ -91,7 +91,7 @@ X509_CRL * lib3270_download_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, co @@ -91,7 +91,7 @@ X509_CRL * lib3270_download_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message, co
91 trace_ssl(hSession,"Loading CRL from %s\n",consturl+7); 91 trace_ssl(hSession,"Loading CRL from %s\n",consturl+7);
92 if(d2i_X509_CRL_fp(hCRL, &x509_crl)) 92 if(d2i_X509_CRL_fp(hCRL, &x509_crl))
93 { 93 {
94 - static const LIB3270_POPUP_DESCRIPTOR popup = { 94 + static const LIB3270_POPUP popup = {
95 .type = LIB3270_NOTIFY_SECURE, 95 .type = LIB3270_NOTIFY_SECURE,
96 .name = "SSL-CRLDECODE", 96 .name = "SSL-CRLDECODE",
97 .summary = N_( "Can't decode CRL" ) 97 .summary = N_( "Can't decode CRL" )
src/ssl/linux/init.c
@@ -85,7 +85,7 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -85,7 +85,7 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
85 ssl_ctx = SSL_CTX_new(SSLv23_method()); 85 ssl_ctx = SSL_CTX_new(SSLv23_method());
86 if(ssl_ctx == NULL) 86 if(ssl_ctx == NULL)
87 { 87 {
88 - static const LIB3270_POPUP_DESCRIPTOR popup = { 88 + static const LIB3270_POPUP popup = {
89 .name = "SSL-CTXERROR", 89 .name = "SSL-CTXERROR",
90 .type = LIB3270_NOTIFY_SECURE, 90 .type = LIB3270_NOTIFY_SECURE,
91 .summary = N_( "Cant initialize the SSL context." ) 91 .summary = N_( "Cant initialize the SSL context." )
src/ssl/linux/url.c
@@ -63,7 +63,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE @@ -63,7 +63,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE
63 63
64 if(!httpText) 64 if(!httpText)
65 { 65 {
66 - LIB3270_POPUP_DESCRIPTOR popup = { 66 + LIB3270_POPUP popup = {
67 .type = LIB3270_NOTIFY_SECURE, 67 .type = LIB3270_NOTIFY_SECURE,
68 .name = "SSL-CantGetCRL", 68 .name = "SSL-CantGetCRL",
69 .summary = N_( "Error getting certificate revocation list" ), 69 .summary = N_( "Error getting certificate revocation list" ),
@@ -82,7 +82,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE @@ -82,7 +82,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE
82 char * data = strstr((char *) httpText,":: "); 82 char * data = strstr((char *) httpText,":: ");
83 if(!data) 83 if(!data)
84 { 84 {
85 - static const LIB3270_POPUP_DESCRIPTOR popup = { 85 + static const LIB3270_POPUP popup = {
86 .type = LIB3270_NOTIFY_SECURE, 86 .type = LIB3270_NOTIFY_SECURE,
87 .summary = N_( "Got a bad formatted certificate revocation list from LDAP server" ) 87 .summary = N_( "Got a bad formatted certificate revocation list from LDAP server" )
88 }; 88 };
@@ -104,7 +104,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE @@ -104,7 +104,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE
104 104
105 if(!d2i_X509_CRL_bio(bio, &x509_crl)) 105 if(!d2i_X509_CRL_bio(bio, &x509_crl))
106 { 106 {
107 - static const LIB3270_POPUP_DESCRIPTOR popup = { 107 + static const LIB3270_POPUP popup = {
108 .type = LIB3270_NOTIFY_SECURE, 108 .type = LIB3270_NOTIFY_SECURE,
109 .summary = N_( "Can't decode certificate revocation list got from LDAP server" ) 109 .summary = N_( "Can't decode certificate revocation list got from LDAP server" )
110 }; 110 };
@@ -126,7 +126,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE @@ -126,7 +126,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_url(H3270 *hSession, SSL_ERROR_MESSAGE
126 126
127 if(!d2i_X509_CRL(&x509_crl, &crl_data, szText)) 127 if(!d2i_X509_CRL(&x509_crl, &crl_data, szText))
128 { 128 {
129 - static const LIB3270_POPUP_DESCRIPTOR popup = { 129 + static const LIB3270_POPUP popup = {
130 .type = LIB3270_NOTIFY_SECURE, 130 .type = LIB3270_NOTIFY_SECURE,
131 .summary = N_( "Can't decode certificate revocation list" ) 131 .summary = N_( "Can't decode certificate revocation list" )
132 }; 132 };
src/ssl/negotiate.c
@@ -103,7 +103,7 @@ static int background_ssl_init(H3270 *hSession, void *message) @@ -103,7 +103,7 @@ static int background_ssl_init(H3270 *hSession, void *message)
103 hSession->ssl.con = SSL_new(ssl_ctx); 103 hSession->ssl.con = SSL_new(ssl_ctx);
104 if(hSession->ssl.con == NULL) 104 if(hSession->ssl.con == NULL)
105 { 105 {
106 - static const LIB3270_POPUP_DESCRIPTOR popup = { 106 + static const LIB3270_POPUP popup = {
107 .type = LIB3270_NOTIFY_SECURE, 107 .type = LIB3270_NOTIFY_SECURE,
108 .summary = N_( "Cant create a new SSL structure for current connection." ) 108 .summary = N_( "Cant create a new SSL structure for current connection." )
109 }; 109 };
@@ -242,7 +242,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) @@ -242,7 +242,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
242 { 242 {
243 trace_ssl(hSession,"%s","SSL_set_fd failed!\n"); 243 trace_ssl(hSession,"%s","SSL_set_fd failed!\n");
244 244
245 - static const LIB3270_POPUP_DESCRIPTOR popup = { 245 + static const LIB3270_POPUP popup = {
246 .summary = N_( "SSL negotiation failed" ), 246 .summary = N_( "SSL negotiation failed" ),
247 .body = N_( "Cant set the file descriptor for the input/output facility for the TLS/SSL (encrypted) side of ssl." ) 247 .body = N_( "Cant set the file descriptor for the input/output facility for the TLS/SSL (encrypted) side of ssl." )
248 }; 248 };
@@ -277,7 +277,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) @@ -277,7 +277,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
277 277
278 trace_ssl(hSession,"SSL_connect failed: %s %s\n",msg,ERR_reason_error_string(hSession->ssl.error)); 278 trace_ssl(hSession,"SSL_connect failed: %s %s\n",msg,ERR_reason_error_string(hSession->ssl.error));
279 279
280 - static const LIB3270_POPUP_DESCRIPTOR popup = { 280 + static const LIB3270_POPUP popup = {
281 .type = LIB3270_NOTIFY_ERROR, 281 .type = LIB3270_NOTIFY_ERROR,
282 .summary = N_( "SSL Connect failed" ), 282 .summary = N_( "SSL Connect failed" ),
283 }; 283 };
@@ -375,7 +375,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) @@ -375,7 +375,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
375 trace_ssl(hSession,"Unexpected or invalid TLS/SSL verify result %d\n",rv); 375 trace_ssl(hSession,"Unexpected or invalid TLS/SSL verify result %d\n",rv);
376 set_ssl_state(hSession,LIB3270_SSL_UNSECURE); 376 set_ssl_state(hSession,LIB3270_SSL_UNSECURE);
377 377
378 - static LIB3270_POPUP_DESCRIPTOR popup = { 378 + static LIB3270_POPUP popup = {
379 .summary = N_( "Can't verify." ), 379 .summary = N_( "Can't verify." ),
380 .body = N_( "Unexpected or invalid TLS/SSL verify result" ) 380 .body = N_( "Unexpected or invalid TLS/SSL verify result" )
381 }; 381 };
@@ -400,7 +400,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) @@ -400,7 +400,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
400 set_ssl_state(hSession,LIB3270_SSL_NEGOTIATED); 400 set_ssl_state(hSession,LIB3270_SSL_NEGOTIATED);
401 401
402 #ifdef SSL_ENABLE_SELF_SIGNED_CERT_CHECK 402 #ifdef SSL_ENABLE_SELF_SIGNED_CERT_CHECK
403 - static const LIB3270_POPUP_DESCRIPTOR popup = { 403 + static const LIB3270_POPUP popup = {
404 .name = "SelfSignedCert", 404 .name = "SelfSignedCert",
405 .type = LIB3270_NOTIFY_SECURE, 405 .type = LIB3270_NOTIFY_SECURE,
406 .summary = N_( "The SSL certificate for this host is not trusted." ), 406 .summary = N_( "The SSL certificate for this host is not trusted." ),
@@ -415,7 +415,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) @@ -415,7 +415,7 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
415 default: 415 default:
416 trace_ssl(hSession,"TLS/SSL verify result was %d (%s)\n", rv, msg->body); 416 trace_ssl(hSession,"TLS/SSL verify result was %d (%s)\n", rv, msg->body);
417 417
418 - ((SSL_ERROR_MESSAGE *) message)->popup = (LIB3270_POPUP_DESCRIPTOR *) msg; 418 + ((SSL_ERROR_MESSAGE *) message)->popup = (LIB3270_POPUP *) msg;
419 419
420 debug("message: %s",((SSL_ERROR_MESSAGE *) message)->popup->summary); 420 debug("message: %s",((SSL_ERROR_MESSAGE *) message)->popup->summary);
421 debug("description: %s",((SSL_ERROR_MESSAGE *) message)->popup->body); 421 debug("description: %s",((SSL_ERROR_MESSAGE *) message)->popup->body);
@@ -472,7 +472,7 @@ int ssl_negotiate(H3270 *hSession) @@ -472,7 +472,7 @@ int ssl_negotiate(H3270 *hSession)
472 } else if(rc) { 472 } else if(rc) {
473 473
474 // SSL Negotiation has failed, no popup to present. 474 // SSL Negotiation has failed, no popup to present.
475 - const LIB3270_POPUP_DESCRIPTOR popup = { 475 + const LIB3270_POPUP popup = {
476 .summary = N_("SSL negotiation has failed") 476 .summary = N_("SSL negotiation has failed")
477 }; 477 };
478 478
@@ -514,7 +514,7 @@ int ssl_init(H3270 *hSession) { @@ -514,7 +514,7 @@ int ssl_init(H3270 *hSession) {
514 } 514 }
515 else 515 else
516 { 516 {
517 - LIB3270_POPUP_DESCRIPTOR popup = { 517 + LIB3270_POPUP popup = {
518 .summary = N_("Unexpected error on SSL initialization") 518 .summary = N_("Unexpected error on SSL initialization")
519 }; 519 };
520 520
src/ssl/notify.c
@@ -52,14 +52,14 @@ @@ -52,14 +52,14 @@
52 * @return Dynamically allocated popup description. 52 * @return Dynamically allocated popup description.
53 * 53 *
54 */ 54 */
55 -static LIB3270_POPUP_DESCRIPTOR * translate_ssl_error_message(const SSL_ERROR_MESSAGE *msg, int rc) 55 +static LIB3270_POPUP * translate_ssl_error_message(const SSL_ERROR_MESSAGE *msg, int rc)
56 { 56 {
57 - LIB3270_POPUP_DESCRIPTOR * popup; 57 + LIB3270_POPUP * popup;
58 58
59 if(msg->popup->body) 59 if(msg->popup->body)
60 { 60 {
61 - popup = lib3270_malloc(sizeof(LIB3270_POPUP_DESCRIPTOR));  
62 - memcpy(popup,msg->popup,sizeof(LIB3270_POPUP_DESCRIPTOR)); 61 + popup = lib3270_malloc(sizeof(LIB3270_POPUP));
  62 + memcpy(popup,msg->popup,sizeof(LIB3270_POPUP));
63 popup->body = dgettext(GETTEXT_PACKAGE,msg->popup->body); 63 popup->body = dgettext(GETTEXT_PACKAGE,msg->popup->body);
64 } 64 }
65 else 65 else
@@ -80,8 +80,8 @@ static LIB3270_POPUP_DESCRIPTOR * translate_ssl_error_message(const SSL_ERROR_ME @@ -80,8 +80,8 @@ static LIB3270_POPUP_DESCRIPTOR * translate_ssl_error_message(const SSL_ERROR_ME
80 body = lib3270_strdup_printf(_( "%s (rc=%d)" ),strerror(rc),rc); 80 body = lib3270_strdup_printf(_( "%s (rc=%d)" ),strerror(rc),rc);
81 } 81 }
82 82
83 - popup = lib3270_malloc(sizeof(LIB3270_POPUP_DESCRIPTOR)+strlen(body)+1);  
84 - memcpy(popup,msg->popup,sizeof(LIB3270_POPUP_DESCRIPTOR)); 83 + popup = lib3270_malloc(sizeof(LIB3270_POPUP)+strlen(body)+1);
  84 + memcpy(popup,msg->popup,sizeof(LIB3270_POPUP));
85 popup->body = (char *) (popup+1); 85 popup->body = (char *) (popup+1);
86 strcpy((char *) (popup+1),body); 86 strcpy((char *) (popup+1),body);
87 87
@@ -103,7 +103,7 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG @@ -103,7 +103,7 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG
103 { 103 {
104 int response = 0; 104 int response = 0;
105 105
106 - LIB3270_POPUP_DESCRIPTOR * popup = translate_ssl_error_message(msg,0); 106 + LIB3270_POPUP * popup = translate_ssl_error_message(msg,0);
107 107
108 #ifdef _WIN32 108 #ifdef _WIN32
109 109
@@ -154,17 +154,8 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG @@ -154,17 +154,8 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG
154 154
155 void ssl_popup_message(H3270 *hSession, const SSL_ERROR_MESSAGE *msg) { 155 void ssl_popup_message(H3270 *hSession, const SSL_ERROR_MESSAGE *msg) {
156 156
157 - LIB3270_POPUP_DESCRIPTOR * popup = translate_ssl_error_message(msg,0);  
158 -  
159 - lib3270_popup_dialog(  
160 - hSession,  
161 - popup->type,  
162 - popup->title,  
163 - popup->summary,  
164 - "%s", popup->body  
165 - );  
166 -  
167 - lib3270_free(popup); 157 + lib3270_autoptr(LIB3270_POPUP) * popup = translate_ssl_error_message(msg,0);
  158 + hSession->cbk.popup_show(hSession,popup,0);
168 159
169 } 160 }
170 161