diff --git a/configure.ac b/configure.ac index 54fdf63..c930a51 100644 --- a/configure.ac +++ b/configure.ac @@ -175,16 +175,6 @@ dnl --------------------------------------------------------------------------- AC_SEARCH_LIBS( [sin], [m], AC_DEFINE(HAVE_LIBM), AC_MSG_ERROR([libm not present.])) dnl --------------------------------------------------------------------------- -dnl Check for SSL -dnl --------------------------------------------------------------------------- - -PKG_CHECK_MODULES( [LIBSSL], [libssl libcrypto], AC_DEFINE(HAVE_LIBSSL), AC_MSG_NOTICE([libssl not present.]) ) - -AC_SUBST(LIBSSL_LIBS) -AC_SUBST(LIBSSL_CFLAGS) - - -dnl --------------------------------------------------------------------------- dnl Check for libintl dnl --------------------------------------------------------------------------- diff --git a/rpm/libv3270.spec b/rpm/libv3270.spec index afa45d8..79514e2 100644 --- a/rpm/libv3270.spec +++ b/rpm/libv3270.spec @@ -51,7 +51,6 @@ BuildRoot: /var/tmp/%{name}-%{version} Provides: libv3270_%{MAJOR_VERSION}_%{MINOR_VERSION} Conflicts: otherproviders(libv3270_%{MAJOR_VERSION}_%{MINOR_VERSION}) -BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: lib3270-%{MAJOR_VERSION}_%{MINOR_VERSION}-devel BuildRequires: autoconf >= 2.61 diff --git a/src/include/config.h.in b/src/include/config.h.in index f098eaf..856bad0 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -38,6 +38,5 @@ #undef HAVE_LIBM #undef HAVE_GNOME #undef HAVE_GTKMAC - #undef HAVE_LIBSSL #endif /* LIBV3270_CONFIG_INCLUDED */ diff --git a/src/include/v3270.h b/src/include/v3270.h index 4e28a87..25a6589 100644 --- a/src/include/v3270.h +++ b/src/include/v3270.h @@ -267,9 +267,9 @@ LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action); // SSL & Security - LIB3270_EXPORT const gchar * v3270_get_ssl_status_icon(GtkWidget *widget); - LIB3270_EXPORT const gchar * v3270_get_ssl_status_text(GtkWidget *widget); - LIB3270_EXPORT const gchar * v3270_get_ssl_status_message(GtkWidget *widget); + LIB3270_EXPORT const gchar * v3270_get_ssl_state_icon_name(GtkWidget *widget); + LIB3270_EXPORT const gchar * v3270_get_ssl_state_message(GtkWidget *widget); + LIB3270_EXPORT const gchar * v3270_get_ssl_state_description(GtkWidget *widget); LIB3270_EXPORT GtkWidget * v3270_security_dialog_new(GtkWidget *widget); LIB3270_EXPORT void v3270_popup_security_dialog(GtkWidget *widget); diff --git a/src/terminal/callbacks.c b/src/terminal/callbacks.c index 2765fd3..2dad66f 100644 --- a/src/terminal/callbacks.c +++ b/src/terminal/callbacks.c @@ -57,8 +57,6 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - static void set_timer(H3270 *session, unsigned char on) { GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); diff --git a/src/terminal/colors.c b/src/terminal/colors.c index 84ae488..893a499 100644 --- a/src/terminal/colors.c +++ b/src/terminal/colors.c @@ -30,8 +30,6 @@ #include #include "private.h" - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #include #include diff --git a/src/terminal/private.h b/src/terminal/private.h index 14c65cb..7427a36 100644 --- a/src/terminal/private.h +++ b/src/terminal/private.h @@ -339,8 +339,6 @@ G_GNUC_INTERNAL void v3270_emit_popup(v3270 *widget, int baddr, GdkEventButton G_GNUC_INTERNAL gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y); G_GNUC_INTERNAL gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event); -G_GNUC_INTERNAL const struct v3270_ssl_status_msg * v3270_get_ssl_status_msg(GtkWidget *widget); - // I/O Callbacks G_GNUC_INTERNAL GSource * IO_source_new(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); G_GNUC_INTERNAL void IO_source_set_state(GSource *source, gboolean enable); diff --git a/src/terminal/security.c b/src/terminal/security.c index 34d228c..2e9867e 100644 --- a/src/terminal/security.c +++ b/src/terminal/security.c @@ -29,8 +29,6 @@ #include - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #define ENABLE_NLS #define GETTEXT_PACKAGE PACKAGE_NAME @@ -40,317 +38,23 @@ #include "private.h" - #if defined(HAVE_LIBSSL) - #include - #include - #endif - - -/*--[ Globals ]--------------------------------------------------------------------------------------*/ - -#if defined(HAVE_LIBSSL) - static const struct v3270_ssl_status_msg ssl_status_msg[] = - { - // http://www.openssl.org/docs/apps/verify.html - { - X509_V_OK, - GTK_STOCK_DIALOG_AUTHENTICATION, - N_( "Secure connection was successful." ), - N_( "The connection is secure and the host identity was confirmed." ) - }, - - { - X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT, - GTK_STOCK_DIALOG_ERROR, - N_( "Unable to get issuer certificate" ), - N_( "The issuer certificate of a looked up certificate could not be found. This normally means the list of trusted certificates is not complete." ), - }, - - { - X509_V_ERR_UNABLE_TO_GET_CRL, - GTK_STOCK_DIALOG_ERROR, - N_( "Unable to get certificate CRL" ), - N_( "The CRL of a certificate could not be found." ), - }, - - { - X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE, - GTK_STOCK_DIALOG_ERROR, - N_( "Unable to decrypt certificate's signature" ), - 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." ), - }, - - { - X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE, - GTK_STOCK_DIALOG_ERROR, - N_( "Unable to decrypt CRL's signature" ), - 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." ), - }, - - { - X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY, - GTK_STOCK_DIALOG_ERROR, - N_( "Unable to decode issuer public key" ), - N_( "The public key in the certificate SubjectPublicKeyInfo could not be read." ), - }, - - { - X509_V_ERR_CERT_SIGNATURE_FAILURE, - GTK_STOCK_DIALOG_ERROR, - N_( "Certificate signature failure" ), - N_( "The signature of the certificate is invalid." ), - }, - - { - X509_V_ERR_CRL_SIGNATURE_FAILURE, - GTK_STOCK_DIALOG_ERROR, - N_( "CRL signature failure" ), - N_( "The signature of the certificate is invalid." ), - }, - - { - X509_V_ERR_CERT_NOT_YET_VALID, - GTK_STOCK_DIALOG_WARNING, - N_( "Certificate is not yet valid" ), - N_( "The certificate is not yet valid: the notBefore date is after the current time." ), - }, - - { - X509_V_ERR_CERT_HAS_EXPIRED, - GTK_STOCK_DIALOG_ERROR, - N_( "Certificate has expired" ), - N_( "The certificate has expired: that is the notAfter date is before the current time." ), - }, - - { - X509_V_ERR_CRL_NOT_YET_VALID, - GTK_STOCK_DIALOG_WARNING, - N_( "CRL is not yet valid" ), - N_( "The CRL is not yet valid." ), - }, - - { - X509_V_ERR_CRL_HAS_EXPIRED, - GTK_STOCK_DIALOG_ERROR, - N_( "CRL has expired" ), - N_( "The CRL has expired." ), - }, - - { - X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD, - GTK_STOCK_DIALOG_ERROR, - N_( "Format error in certificate's notBefore field" ), - N_( "The certificate notBefore field contains an invalid time." ), - }, - - { - X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD, - GTK_STOCK_DIALOG_ERROR, - N_( "Format error in certificate's notAfter field" ), - N_( "The certificate notAfter field contains an invalid time." ), - }, - - { - X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD, - GTK_STOCK_DIALOG_ERROR, - N_( "Format error in CRL's lastUpdate field" ), - N_( "The CRL lastUpdate field contains an invalid time." ), - }, - - { - X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD, - GTK_STOCK_DIALOG_ERROR, - N_( "Format error in CRL's nextUpdate field" ), - N_( "The CRL nextUpdate field contains an invalid time." ), - }, - - { - X509_V_ERR_OUT_OF_MEM, - GTK_STOCK_DIALOG_ERROR, - N_( "Out of memory" ), - N_( "An error occurred trying to allocate memory. This should never happen." ), - }, - - { - X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, - GTK_STOCK_DIALOG_WARNING, - N_( "Self signed certificate" ), - N_( "The passed certificate is self signed and the same certificate cannot be found in the list of trusted certificates." ), - }, - - { - X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN, - GTK_STOCK_DIALOG_WARNING, - N_( "Self signed certificate in certificate chain" ), - N_( "The certificate chain could be built up using the untrusted certificates but the root could not be found locally." ), - }, - - { - X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, - GTK_STOCK_DIALOG_WARNING, - N_( "Unable to get local issuer certificate" ), - N_( "The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found." ), - }, - - { - X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE, - GTK_STOCK_DIALOG_ERROR, - N_( "Unable to verify the first certificate" ), - N_( "No signatures could be verified because the chain contains only one certificate and it is not self signed." ), - }, - - { - X509_V_ERR_CERT_REVOKED, - GTK_STOCK_DIALOG_ERROR, - N_( "Certificate revoked" ), - N_( "The certificate has been revoked." ), - }, - - { - X509_V_ERR_INVALID_CA, - GTK_STOCK_DIALOG_ERROR, - N_( "Invalid CA certificate" ), - N_( "A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose." ), - }, - - { - X509_V_ERR_PATH_LENGTH_EXCEEDED, - GTK_STOCK_DIALOG_ERROR, - N_( "Path length constraint exceeded" ), - N_( "The basicConstraints pathlength parameter has been exceeded." ), - }, - - { - X509_V_ERR_INVALID_PURPOSE, - GTK_STOCK_DIALOG_ERROR, - N_( "Unsupported certificate purpose" ), - N_( "The supplied certificate cannot be used for the specified purpose." ), - }, - - { - X509_V_ERR_CERT_UNTRUSTED, - GTK_STOCK_DIALOG_WARNING, - N_( "Certificate not trusted" ), - N_( "The root CA is not marked as trusted for the specified purpose." ), - }, - - { - X509_V_ERR_CERT_REJECTED, - GTK_STOCK_DIALOG_ERROR, - N_( "Certificate rejected" ), - N_( "The root CA is marked to reject the specified purpose." ), - }, - - { - X509_V_ERR_SUBJECT_ISSUER_MISMATCH, - GTK_STOCK_DIALOG_ERROR, - N_( "Subject issuer mismatch" ), - 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." ), - }, - - { - X509_V_ERR_AKID_SKID_MISMATCH, - GTK_STOCK_DIALOG_ERROR, - N_( "Authority and subject key identifier mismatch" ), - 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." ), - }, - - { - X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH, - GTK_STOCK_DIALOG_ERROR, - N_( "Authority and issuer serial number mismatch" ), - 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." ), - }, - - { - X509_V_ERR_KEYUSAGE_NO_CERTSIGN, - GTK_STOCK_DIALOG_ERROR, - N_( "Key usage does not include certificate signing" ), - N_( "The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing." ), - }, - - { - 0, - NULL, - NULL, - NULL - } - - }; -#endif // HAVE_LIBSSL - /*--[ Implement ]------------------------------------------------------------------------------------*/ - G_GNUC_INTERNAL const struct v3270_ssl_status_msg * v3270_get_ssl_status_msg(G_GNUC_UNUSED GtkWidget *widget) - { -#ifdef HAVE_LIBSSL - int f; - long id = lib3270_get_SSL_verify_result(GTK_V3270(widget)->host); - - for(f=0;ssl_status_msg[f].text;f++) - { - if(ssl_status_msg[f].id == id) - return ssl_status_msg+f; - } -#endif // HAVE_LIBSSL - return NULL; - } - - const gchar * v3270_get_ssl_status_icon(GtkWidget *widget) + const gchar * v3270_get_ssl_state_icon_name(GtkWidget *widget) { g_return_val_if_fail(GTK_IS_V3270(widget),""); - - if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE) - return GTK_STOCK_DIALOG_INFO; - - -#ifdef HAVE_LIBSSL - if(lib3270_get_secure(GTK_V3270(widget)->host) != LIB3270_SSL_UNSECURE) - { - const struct v3270_ssl_status_msg *info = v3270_get_ssl_status_msg(widget); - if(info) - return info->icon; - } -#endif // HAVE_LIBSSL - - return GTK_STOCK_DIALOG_ERROR; - + return lib3270_get_ssl_state_icon_name(v3270_get_session(widget)); } - const gchar * v3270_get_ssl_status_text(GtkWidget *widget) + const gchar * v3270_get_ssl_state_message(GtkWidget *widget) { g_return_val_if_fail(GTK_IS_V3270(widget),""); - - if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE) - return v3270_get_hostname(widget); - -#ifdef HAVE_LIBSSL - if(lib3270_get_secure(GTK_V3270(widget)->host) != LIB3270_SSL_UNSECURE) - { - const struct v3270_ssl_status_msg *info = v3270_get_ssl_status_msg(widget); - if(info) - return gettext(info->text); - } -#endif // HAVE_LIBSSL - return v3270_get_hostname(widget); + return lib3270_get_ssl_state_message(v3270_get_session(widget)); } - const gchar * v3270_get_ssl_status_message(GtkWidget *widget) + const gchar * v3270_get_ssl_status_description(GtkWidget *widget) { g_return_val_if_fail(GTK_IS_V3270(widget),""); - - if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE) - return _( "The connection is insecure" ); - -#ifdef HAVE_LIBSSL - if(lib3270_get_secure(GTK_V3270(widget)->host) != LIB3270_SSL_UNSECURE) - { - const struct v3270_ssl_status_msg *info = v3270_get_ssl_status_msg(widget); - if(info) - return gettext(info->message); - } -#endif // HAVE_LIBSSL - - return _( "Unexpected or unknown security status"); + return lib3270_get_ssl_state_description(v3270_get_session(widget)); } diff --git a/src/terminal/widget.c b/src/terminal/widget.c index 5905623..57cf25e 100644 --- a/src/terminal/widget.c +++ b/src/terminal/widget.c @@ -190,49 +190,28 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, G_GNUC_UNUSED g if(x >= rect[V3270_OIA_SSL].x && x <= (rect[V3270_OIA_SSL].x + rect[V3270_OIA_SSL].width)) { - if(!lib3270_connected(GTK_V3270(widget)->host)) + H3270 *hSession = GTK_V3270(widget)->host; + + if(!lib3270_connected(hSession)) { #ifndef _WIN32 - gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_MENU); + gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_DIALOG); #endif // GTK_CHECK_VERSION gtk_tooltip_set_markup(tooltip,_( "Identity not verified\nDisconnected from host" ) ); } - else if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE) - { -#ifndef _WIN32 - gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-information",GTK_ICON_SIZE_MENU); -#endif - gtk_tooltip_set_markup(tooltip,_( "Identity not verified\nThe connection is insecure" ) ); - } - else if(!lib3270_get_SSL_verify_result(GTK_V3270(widget)->host)) - { -#ifndef _WIN32 - gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-dialog-authentication",GTK_ICON_SIZE_MENU); -#endif - gtk_tooltip_set_markup(tooltip,_( "Identity verified\nThe connection is secure" ) ); - } else { - const struct v3270_ssl_status_msg *msg = v3270_get_ssl_status_msg(widget); - - if(msg) - { - gchar *text = g_strdup_printf("%s\n%s",_("Identity not verified"),gettext(msg->text)); #ifndef _WIN32 - gtk_tooltip_set_icon_from_icon_name(tooltip,msg->icon,GTK_ICON_SIZE_MENU); + gtk_tooltip_set_icon_from_icon_name(tooltip,lib3270_get_ssl_state_icon_name(hSession),GTK_ICON_SIZE_DIALOG); #endif - gtk_tooltip_set_markup(tooltip,text); - g_free(text); - } - else - { - gchar *text = g_strdup_printf(_("SSL state is undefinedUnexpected SSL status %ld"),lib3270_get_SSL_verify_result(GTK_V3270(widget)->host)); -#ifndef _WIN32 - gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-error",GTK_ICON_SIZE_MENU); -#endif // GTK_CHECK_VERSION - gtk_tooltip_set_markup(tooltip,text); - g_free(text); - } + v3270_autofree gchar * message = + g_strdup_printf( + "%s\n%s", + lib3270_get_ssl_state_message(hSession), + lib3270_get_ssl_state_description(hSession) + ); + gtk_tooltip_set_markup(tooltip,message); + } return TRUE; diff --git a/src/trace/trace.c b/src/trace/trace.c index d9b4a15..e7e09fe 100644 --- a/src/trace/trace.c +++ b/src/trace/trace.c @@ -45,8 +45,6 @@ #include #endif // HAVE_SYSLOG -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - /*--[ Widget definition ]----------------------------------------------------------------------------*/ G_BEGIN_DECLS -- libgit2 0.21.2