diff --git a/src/core/connect.c b/src/core/connect.c index 58d4938..19c1543 100644 --- a/src/core/connect.c +++ b/src/core/connect.c @@ -90,7 +90,7 @@ .label = _("Try again") }; - if(hSession->cbk.popup_show(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0) + if(hSession->cbk.popup(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0) lib3270_activate_auto_reconnect(hSession,1000); } diff --git a/src/core/popup.c b/src/core/popup.c index 2ec065a..e0f8bd5 100644 --- a/src/core/popup.c +++ b/src/core/popup.c @@ -41,8 +41,8 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ -LIB3270_EXPORT int lib3270_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait) { - return hSession->cbk.popup_show(hSession,popup,wait); +LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait) { + return hSession->cbk.popup(hSession,popup,wait); } /// @brief Pop up an error dialog. @@ -64,7 +64,7 @@ void popup_an_error(H3270 *hSession, const char *fmt, ...) .summary = summary }; - hSession->cbk.popup_show(hSession,&popup,0); + hSession->cbk.popup(hSession,&popup,0); } @@ -88,7 +88,7 @@ void popup_system_error(H3270 *hSession, const char *title, const char *summary, .body = body }; - hSession->cbk.popup_show(hSession,&popup,0); + hSession->cbk.popup(hSession,&popup,0); } @@ -117,7 +117,7 @@ LIB3270_EXPORT void lib3270_popup_va(H3270 *hSession, LIB3270_NOTIFY id , const .body = body }; - hSession->cbk.popup_show(hSession,&popup,0); + hSession->cbk.popup(hSession,&popup,0); } diff --git a/src/core/session.c b/src/core/session.c index eba4bef..82c06c2 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -207,7 +207,8 @@ static int load(H3270 *session, const char GNUC_UNUSED(*filename)) return errno = ENOTSUP; } -static void message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char *title, const char *msg, const char *text) +/* +static void def_message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char *title, const char *msg, const char *text) { #ifdef ANDROID __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title); @@ -219,13 +220,16 @@ static void message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char * lib3270_write_log(session,"lib3270","%s",text); #endif // ANDROID } +*/ +/* static void def_popup(H3270 *hSession, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) { lib3270_popup_va(hSession,type,title,msg,fmt,args); } +*/ -static int def_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait) +static int def_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char GNUC_UNUSED wait) { const char * text[] = { popup->title, @@ -243,24 +247,6 @@ static int def_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned return ENOTSUP; } -static int def_popup_ssl_error(H3270 *hSession, int GNUC_UNUSED(rc), const char *title, const char *summary, const char *body) -{ - LIB3270_POPUP popup = { - .type = LIB3270_NOTIFY_SECURE, - .title = title, - .summary = summary, - .body = body, - .label = _("Continue") - }; - - return hSession->cbk.popup_show(hSession,&popup,1); - - /* - lib3270_popup_dialog(session, LIB3270_NOTIFY_ERROR, title, summary, "%s", body); - return -1; - */ -} - static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) { vfprintf(stdout,fmt,args); @@ -326,7 +312,6 @@ void lib3270_reset_callbacks(H3270 *hSession) hSession->cbk.update_oia = update_oia; hSession->cbk.update_selection = update_selection; hSession->cbk.cursor = set_cursor; - hSession->cbk.message = message; hSession->cbk.update_ssl = update_ssl; hSession->cbk.display = screen_disp; hSession->cbk.set_width = nop_int; @@ -339,10 +324,7 @@ void lib3270_reset_callbacks(H3270 *hSession) hSession->cbk.set_peer_certificate = set_peer_certificate; hSession->cbk.update_luname = default_update_luname; hSession->cbk.update_url = default_update_url; - hSession->cbk.popup = def_popup; - hSession->cbk.popup_ssl_error = def_popup_ssl_error; - hSession->cbk.popup_show = def_popup_show; } @@ -467,10 +449,6 @@ LIB3270_EXPORT void lib3270_get_trace_handler(H3270 *hSession, LIB3270_TRACE_HAN } -LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)) { - session->cbk.popup = handler ? handler : def_popup; -} - H3270 * lib3270_session_new(const char *model) { H3270 * hSession; diff --git a/src/core/telnet.c b/src/core/telnet.c index bd34c2a..023c99c 100644 --- a/src/core/telnet.c +++ b/src/core/telnet.c @@ -642,6 +642,17 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED #if defined(HAVE_LIBSSL) /*[*/ if(hSession->ssl.con != NULL) { + static const LIB3270_POPUP popup = { + .type = LIB3270_NOTIFY_ERROR, + .summary = N_( "SSL Read error" ) + }; + + SSL_ERROR_MESSAGE message = { + .code = ERR_get_error(), + .popup = &popup + }; + + /* unsigned long e; char err_buf[120]; @@ -651,11 +662,13 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED (void) ERR_error_string(e, err_buf); trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e,err_buf); hSession->cbk.message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); + ssl_popup_message(hSession,msg); } else { trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e, "unknown"); } + */ host_disconnect(hSession,True); return; diff --git a/src/include/lib3270/popup.h b/src/include/lib3270/popup.h index a9077a5..042511b 100644 --- a/src/include/lib3270/popup.h +++ b/src/include/lib3270/popup.h @@ -70,8 +70,6 @@ LIB3270_POPUP_HEAD } LIB3270_POPUP; - LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); - /** * Pop up an error dialog, based on an error number. * @@ -110,9 +108,9 @@ * @return User action. * * @retval 0 User has confirmed, continue action. - * @retval ECANCELED Operation was cancelled. + * @retval ECANCELED Operation was canceled. */ - LIB3270_EXPORT int lib3270_popup_show(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); + LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); /** * @brief Auto cleanup method (for use with lib3270_autoptr). diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index 523294d..3ff28af 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -81,11 +81,7 @@ int (*save)(H3270 *session, LIB3270_CONTENT_OPTION mode, const char *filename); int (*load)(H3270 *hSession, const char *filename); - void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); - - void (*popup)(H3270 *session, LIB3270_NOTIFY id, const char *title, const char *msg, const char *fmt, va_list); - int (*popup_ssl_error)(H3270 *session, int rc, const char *title, const char *summary, const char *body); - int (*popup_show)(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); + int (*popup)(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait); #ifdef HAVE_LIBSSL void (*set_peer_certificate)(const X509 *cert); diff --git a/src/ssl/notify.c b/src/ssl/notify.c index f8d5534..c9071bd 100644 --- a/src/ssl/notify.c +++ b/src/ssl/notify.c @@ -144,6 +144,8 @@ static LIB3270_POPUP * translate_ssl_error_message(const SSL_ERROR_MESSAGE *msg, popup->summary = dgettext(GETTEXT_PACKAGE,msg->popup->summary); + debug("%s: names[\"%s\",\"%s\"]",__FUNCTION__,popup->name, msg->popup->name); + if(popup->title) popup->title = dgettext(GETTEXT_PACKAGE,popup->title); else @@ -191,14 +193,7 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG #ifdef SSL_ENABLE_NOTIFICATION_WHEN_FAILED - response = hSession->cbk.popup_ssl_error( - hSession, - rc, - popup->title, - popup->summary, - popup->body - ); - + response = hSession->cbk.popup(hSession,popup,1); #endif // SSL_ENABLE_NOTIFICATION_WHEN_FAILED @@ -210,7 +205,7 @@ int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const SSL_ERROR_MESSAG void ssl_popup_message(H3270 *hSession, const SSL_ERROR_MESSAGE *msg) { LIB3270_POPUP * popup = translate_ssl_error_message(msg,0); - hSession->cbk.popup_show(hSession,popup,0); + hSession->cbk.popup(hSession,popup,0); lib3270_free(popup); } diff --git a/src/ssl/state.c b/src/ssl/state.c index aa09cf9..dcdf252 100644 --- a/src/ssl/state.c +++ b/src/ssl/state.c @@ -104,6 +104,7 @@ static const struct ssl_status_msg status_msg[] = { .id = X509_V_ERR_UNABLE_TO_GET_CRL, + .name = "X509_V_ERR_UNABLE_TO_GET_CRL", .type = LIB3270_NOTIFY_ERROR, .iconName = "dialog-error", .summary = N_( "Unable to get certificate CRL." ), -- libgit2 0.21.2