Commit 8b21b938f201a9e105cfce37c9a33f0a52d1f4e0

Authored by Perry Werneck
1 parent 09a831e6
Exists in master and in 1 other branch develop

Fixing deprecated warnings.

All ssl stuff now lives in lib3270.
configure.ac
... ... @@ -175,16 +175,6 @@ dnl ---------------------------------------------------------------------------
175 175 AC_SEARCH_LIBS( [sin], [m], AC_DEFINE(HAVE_LIBM), AC_MSG_ERROR([libm not present.]))
176 176  
177 177 dnl ---------------------------------------------------------------------------
178   -dnl Check for SSL
179   -dnl ---------------------------------------------------------------------------
180   -
181   -PKG_CHECK_MODULES( [LIBSSL], [libssl libcrypto], AC_DEFINE(HAVE_LIBSSL), AC_MSG_NOTICE([libssl not present.]) )
182   -
183   -AC_SUBST(LIBSSL_LIBS)
184   -AC_SUBST(LIBSSL_CFLAGS)
185   -
186   -
187   -dnl ---------------------------------------------------------------------------
188 178 dnl Check for libintl
189 179 dnl ---------------------------------------------------------------------------
190 180  
... ...
rpm/libv3270.spec
... ... @@ -51,7 +51,6 @@ BuildRoot: /var/tmp/%{name}-%{version}
51 51 Provides: libv3270_%{MAJOR_VERSION}_%{MINOR_VERSION}
52 52 Conflicts: otherproviders(libv3270_%{MAJOR_VERSION}_%{MINOR_VERSION})
53 53  
54   -BuildRequires: pkgconfig(openssl)
55 54 BuildRequires: pkgconfig(gtk+-3.0)
56 55 BuildRequires: lib3270-%{MAJOR_VERSION}_%{MINOR_VERSION}-devel
57 56 BuildRequires: autoconf >= 2.61
... ...
src/include/config.h.in
... ... @@ -38,6 +38,5 @@
38 38 #undef HAVE_LIBM
39 39 #undef HAVE_GNOME
40 40 #undef HAVE_GTKMAC
41   - #undef HAVE_LIBSSL
42 41  
43 42 #endif /* LIBV3270_CONFIG_INCLUDED */
... ...
src/include/v3270.h
... ... @@ -267,9 +267,9 @@
267 267 LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action);
268 268  
269 269 // SSL & Security
270   - LIB3270_EXPORT const gchar * v3270_get_ssl_status_icon(GtkWidget *widget);
271   - LIB3270_EXPORT const gchar * v3270_get_ssl_status_text(GtkWidget *widget);
272   - LIB3270_EXPORT const gchar * v3270_get_ssl_status_message(GtkWidget *widget);
  270 + LIB3270_EXPORT const gchar * v3270_get_ssl_state_icon_name(GtkWidget *widget);
  271 + LIB3270_EXPORT const gchar * v3270_get_ssl_state_message(GtkWidget *widget);
  272 + LIB3270_EXPORT const gchar * v3270_get_ssl_state_description(GtkWidget *widget);
273 273 LIB3270_EXPORT GtkWidget * v3270_security_dialog_new(GtkWidget *widget);
274 274 LIB3270_EXPORT void v3270_popup_security_dialog(GtkWidget *widget);
275 275  
... ...
src/terminal/callbacks.c
... ... @@ -57,8 +57,6 @@
57 57  
58 58 /*--[ Implement ]------------------------------------------------------------------------------------*/
59 59  
60   -#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
61   -
62 60 static void set_timer(H3270 *session, unsigned char on)
63 61 {
64 62 GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session));
... ...
src/terminal/colors.c
... ... @@ -30,8 +30,6 @@
30 30 #include <config.h>
31 31 #include "private.h"
32 32  
33   - #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
34   -
35 33 #include <lib3270.h>
36 34 #include <lib3270/log.h>
37 35  
... ...
src/terminal/private.h
... ... @@ -339,8 +339,6 @@ G_GNUC_INTERNAL void v3270_emit_popup(v3270 *widget, int baddr, GdkEventButton
339 339 G_GNUC_INTERNAL gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y);
340 340 G_GNUC_INTERNAL gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event);
341 341  
342   -G_GNUC_INTERNAL const struct v3270_ssl_status_msg * v3270_get_ssl_status_msg(GtkWidget *widget);
343   -
344 342 // I/O Callbacks
345 343 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);
346 344 G_GNUC_INTERNAL void IO_source_set_state(GSource *source, gboolean enable);
... ...
src/terminal/security.c
... ... @@ -29,8 +29,6 @@
29 29  
30 30 #include <config.h>
31 31  
32   - #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
33   -
34 32 #define ENABLE_NLS
35 33 #define GETTEXT_PACKAGE PACKAGE_NAME
36 34  
... ... @@ -40,317 +38,23 @@
40 38  
41 39 #include "private.h"
42 40  
43   - #if defined(HAVE_LIBSSL)
44   - #include <openssl/ssl.h>
45   - #include <openssl/err.h>
46   - #endif
47   -
48   -
49   -/*--[ Globals ]--------------------------------------------------------------------------------------*/
50   -
51   -#if defined(HAVE_LIBSSL)
52   - static const struct v3270_ssl_status_msg ssl_status_msg[] =
53   - {
54   - // http://www.openssl.org/docs/apps/verify.html
55   - {
56   - X509_V_OK,
57   - GTK_STOCK_DIALOG_AUTHENTICATION,
58   - N_( "Secure connection was successful." ),
59   - N_( "The connection is secure and the host identity was confirmed." )
60   - },
61   -
62   - {
63   - X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT,
64   - GTK_STOCK_DIALOG_ERROR,
65   - N_( "Unable to get issuer certificate" ),
66   - N_( "The issuer certificate of a looked up certificate could not be found. This normally means the list of trusted certificates is not complete." ),
67   - },
68   -
69   - {
70   - X509_V_ERR_UNABLE_TO_GET_CRL,
71   - GTK_STOCK_DIALOG_ERROR,
72   - N_( "Unable to get certificate CRL" ),
73   - N_( "The CRL of a certificate could not be found." ),
74   - },
75   -
76   - {
77   - X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE,
78   - GTK_STOCK_DIALOG_ERROR,
79   - N_( "Unable to decrypt certificate's signature" ),
80   - 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." ),
81   - },
82   -
83   - {
84   - X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE,
85   - GTK_STOCK_DIALOG_ERROR,
86   - N_( "Unable to decrypt CRL's signature" ),
87   - 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." ),
88   - },
89   -
90   - {
91   - X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY,
92   - GTK_STOCK_DIALOG_ERROR,
93   - N_( "Unable to decode issuer public key" ),
94   - N_( "The public key in the certificate SubjectPublicKeyInfo could not be read." ),
95   - },
96   -
97   - {
98   - X509_V_ERR_CERT_SIGNATURE_FAILURE,
99   - GTK_STOCK_DIALOG_ERROR,
100   - N_( "Certificate signature failure" ),
101   - N_( "The signature of the certificate is invalid." ),
102   - },
103   -
104   - {
105   - X509_V_ERR_CRL_SIGNATURE_FAILURE,
106   - GTK_STOCK_DIALOG_ERROR,
107   - N_( "CRL signature failure" ),
108   - N_( "The signature of the certificate is invalid." ),
109   - },
110   -
111   - {
112   - X509_V_ERR_CERT_NOT_YET_VALID,
113   - GTK_STOCK_DIALOG_WARNING,
114   - N_( "Certificate is not yet valid" ),
115   - N_( "The certificate is not yet valid: the notBefore date is after the current time." ),
116   - },
117   -
118   - {
119   - X509_V_ERR_CERT_HAS_EXPIRED,
120   - GTK_STOCK_DIALOG_ERROR,
121   - N_( "Certificate has expired" ),
122   - N_( "The certificate has expired: that is the notAfter date is before the current time." ),
123   - },
124   -
125   - {
126   - X509_V_ERR_CRL_NOT_YET_VALID,
127   - GTK_STOCK_DIALOG_WARNING,
128   - N_( "CRL is not yet valid" ),
129   - N_( "The CRL is not yet valid." ),
130   - },
131   -
132   - {
133   - X509_V_ERR_CRL_HAS_EXPIRED,
134   - GTK_STOCK_DIALOG_ERROR,
135   - N_( "CRL has expired" ),
136   - N_( "The CRL has expired." ),
137   - },
138   -
139   - {
140   - X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD,
141   - GTK_STOCK_DIALOG_ERROR,
142   - N_( "Format error in certificate's notBefore field" ),
143   - N_( "The certificate notBefore field contains an invalid time." ),
144   - },
145   -
146   - {
147   - X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD,
148   - GTK_STOCK_DIALOG_ERROR,
149   - N_( "Format error in certificate's notAfter field" ),
150   - N_( "The certificate notAfter field contains an invalid time." ),
151   - },
152   -
153   - {
154   - X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD,
155   - GTK_STOCK_DIALOG_ERROR,
156   - N_( "Format error in CRL's lastUpdate field" ),
157   - N_( "The CRL lastUpdate field contains an invalid time." ),
158   - },
159   -
160   - {
161   - X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD,
162   - GTK_STOCK_DIALOG_ERROR,
163   - N_( "Format error in CRL's nextUpdate field" ),
164   - N_( "The CRL nextUpdate field contains an invalid time." ),
165   - },
166   -
167   - {
168   - X509_V_ERR_OUT_OF_MEM,
169   - GTK_STOCK_DIALOG_ERROR,
170   - N_( "Out of memory" ),
171   - N_( "An error occurred trying to allocate memory. This should never happen." ),
172   - },
173   -
174   - {
175   - X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT,
176   - GTK_STOCK_DIALOG_WARNING,
177   - N_( "Self signed certificate" ),
178   - N_( "The passed certificate is self signed and the same certificate cannot be found in the list of trusted certificates." ),
179   - },
180   -
181   - {
182   - X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN,
183   - GTK_STOCK_DIALOG_WARNING,
184   - N_( "Self signed certificate in certificate chain" ),
185   - N_( "The certificate chain could be built up using the untrusted certificates but the root could not be found locally." ),
186   - },
187   -
188   - {
189   - X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY,
190   - GTK_STOCK_DIALOG_WARNING,
191   - N_( "Unable to get local issuer certificate" ),
192   - N_( "The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found." ),
193   - },
194   -
195   - {
196   - X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE,
197   - GTK_STOCK_DIALOG_ERROR,
198   - N_( "Unable to verify the first certificate" ),
199   - N_( "No signatures could be verified because the chain contains only one certificate and it is not self signed." ),
200   - },
201   -
202   - {
203   - X509_V_ERR_CERT_REVOKED,
204   - GTK_STOCK_DIALOG_ERROR,
205   - N_( "Certificate revoked" ),
206   - N_( "The certificate has been revoked." ),
207   - },
208   -
209   - {
210   - X509_V_ERR_INVALID_CA,
211   - GTK_STOCK_DIALOG_ERROR,
212   - N_( "Invalid CA certificate" ),
213   - N_( "A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose." ),
214   - },
215   -
216   - {
217   - X509_V_ERR_PATH_LENGTH_EXCEEDED,
218   - GTK_STOCK_DIALOG_ERROR,
219   - N_( "Path length constraint exceeded" ),
220   - N_( "The basicConstraints pathlength parameter has been exceeded." ),
221   - },
222   -
223   - {
224   - X509_V_ERR_INVALID_PURPOSE,
225   - GTK_STOCK_DIALOG_ERROR,
226   - N_( "Unsupported certificate purpose" ),
227   - N_( "The supplied certificate cannot be used for the specified purpose." ),
228   - },
229   -
230   - {
231   - X509_V_ERR_CERT_UNTRUSTED,
232   - GTK_STOCK_DIALOG_WARNING,
233   - N_( "Certificate not trusted" ),
234   - N_( "The root CA is not marked as trusted for the specified purpose." ),
235   - },
236   -
237   - {
238   - X509_V_ERR_CERT_REJECTED,
239   - GTK_STOCK_DIALOG_ERROR,
240   - N_( "Certificate rejected" ),
241   - N_( "The root CA is marked to reject the specified purpose." ),
242   - },
243   -
244   - {
245   - X509_V_ERR_SUBJECT_ISSUER_MISMATCH,
246   - GTK_STOCK_DIALOG_ERROR,
247   - N_( "Subject issuer mismatch" ),
248   - 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." ),
249   - },
250   -
251   - {
252   - X509_V_ERR_AKID_SKID_MISMATCH,
253   - GTK_STOCK_DIALOG_ERROR,
254   - N_( "Authority and subject key identifier mismatch" ),
255   - 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." ),
256   - },
257   -
258   - {
259   - X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH,
260   - GTK_STOCK_DIALOG_ERROR,
261   - N_( "Authority and issuer serial number mismatch" ),
262   - 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." ),
263   - },
264   -
265   - {
266   - X509_V_ERR_KEYUSAGE_NO_CERTSIGN,
267   - GTK_STOCK_DIALOG_ERROR,
268   - N_( "Key usage does not include certificate signing" ),
269   - N_( "The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing." ),
270   - },
271   -
272   - {
273   - 0,
274   - NULL,
275   - NULL,
276   - NULL
277   - }
278   -
279   - };
280   -#endif // HAVE_LIBSSL
281   -
282 41 /*--[ Implement ]------------------------------------------------------------------------------------*/
283 42  
284   - G_GNUC_INTERNAL const struct v3270_ssl_status_msg * v3270_get_ssl_status_msg(G_GNUC_UNUSED GtkWidget *widget)
285   - {
286   -#ifdef HAVE_LIBSSL
287   - int f;
288   - long id = lib3270_get_SSL_verify_result(GTK_V3270(widget)->host);
289   -
290   - for(f=0;ssl_status_msg[f].text;f++)
291   - {
292   - if(ssl_status_msg[f].id == id)
293   - return ssl_status_msg+f;
294   - }
295   -#endif // HAVE_LIBSSL
296   - return NULL;
297   - }
298   -
299   - const gchar * v3270_get_ssl_status_icon(GtkWidget *widget)
  43 + const gchar * v3270_get_ssl_state_icon_name(GtkWidget *widget)
300 44 {
301 45 g_return_val_if_fail(GTK_IS_V3270(widget),"");
302   -
303   - if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE)
304   - return GTK_STOCK_DIALOG_INFO;
305   -
306   -
307   -#ifdef HAVE_LIBSSL
308   - if(lib3270_get_secure(GTK_V3270(widget)->host) != LIB3270_SSL_UNSECURE)
309   - {
310   - const struct v3270_ssl_status_msg *info = v3270_get_ssl_status_msg(widget);
311   - if(info)
312   - return info->icon;
313   - }
314   -#endif // HAVE_LIBSSL
315   -
316   - return GTK_STOCK_DIALOG_ERROR;
317   -
  46 + return lib3270_get_ssl_state_icon_name(v3270_get_session(widget));
318 47 }
319 48  
320   - const gchar * v3270_get_ssl_status_text(GtkWidget *widget)
  49 + const gchar * v3270_get_ssl_state_message(GtkWidget *widget)
321 50 {
322 51 g_return_val_if_fail(GTK_IS_V3270(widget),"");
323   -
324   - if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE)
325   - return v3270_get_hostname(widget);
326   -
327   -#ifdef HAVE_LIBSSL
328   - if(lib3270_get_secure(GTK_V3270(widget)->host) != LIB3270_SSL_UNSECURE)
329   - {
330   - const struct v3270_ssl_status_msg *info = v3270_get_ssl_status_msg(widget);
331   - if(info)
332   - return gettext(info->text);
333   - }
334   -#endif // HAVE_LIBSSL
335   - return v3270_get_hostname(widget);
  52 + return lib3270_get_ssl_state_message(v3270_get_session(widget));
336 53 }
337 54  
338   - const gchar * v3270_get_ssl_status_message(GtkWidget *widget)
  55 + const gchar * v3270_get_ssl_status_description(GtkWidget *widget)
339 56 {
340 57 g_return_val_if_fail(GTK_IS_V3270(widget),"");
341   -
342   - if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE)
343   - return _( "The connection is insecure" );
344   -
345   -#ifdef HAVE_LIBSSL
346   - if(lib3270_get_secure(GTK_V3270(widget)->host) != LIB3270_SSL_UNSECURE)
347   - {
348   - const struct v3270_ssl_status_msg *info = v3270_get_ssl_status_msg(widget);
349   - if(info)
350   - return gettext(info->message);
351   - }
352   -#endif // HAVE_LIBSSL
353   -
354   - return _( "Unexpected or unknown security status");
  58 + return lib3270_get_ssl_state_description(v3270_get_session(widget));
355 59 }
356 60  
... ...
src/terminal/widget.c
... ... @@ -190,49 +190,28 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, G_GNUC_UNUSED g
190 190  
191 191 if(x >= rect[V3270_OIA_SSL].x && x <= (rect[V3270_OIA_SSL].x + rect[V3270_OIA_SSL].width))
192 192 {
193   - if(!lib3270_connected(GTK_V3270(widget)->host))
  193 + H3270 *hSession = GTK_V3270(widget)->host;
  194 +
  195 + if(!lib3270_connected(hSession))
194 196 {
195 197 #ifndef _WIN32
196   - gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_MENU);
  198 + gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_DIALOG);
197 199 #endif // GTK_CHECK_VERSION
198 200 gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nDisconnected from host" ) );
199 201 }
200   - else if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE)
201   - {
202   -#ifndef _WIN32
203   - gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-information",GTK_ICON_SIZE_MENU);
204   -#endif
205   - gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nThe connection is insecure" ) );
206   - }
207   - else if(!lib3270_get_SSL_verify_result(GTK_V3270(widget)->host))
208   - {
209   -#ifndef _WIN32
210   - gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-dialog-authentication",GTK_ICON_SIZE_MENU);
211   -#endif
212   - gtk_tooltip_set_markup(tooltip,_( "<b>Identity verified</b>\nThe connection is secure" ) );
213   - }
214 202 else
215 203 {
216   - const struct v3270_ssl_status_msg *msg = v3270_get_ssl_status_msg(widget);
217   -
218   - if(msg)
219   - {
220   - gchar *text = g_strdup_printf("<b>%s</b>\n%s",_("Identity not verified"),gettext(msg->text));
221 204 #ifndef _WIN32
222   - gtk_tooltip_set_icon_from_icon_name(tooltip,msg->icon,GTK_ICON_SIZE_MENU);
  205 + gtk_tooltip_set_icon_from_icon_name(tooltip,lib3270_get_ssl_state_icon_name(hSession),GTK_ICON_SIZE_DIALOG);
223 206 #endif
224   - gtk_tooltip_set_markup(tooltip,text);
225   - g_free(text);
226   - }
227   - else
228   - {
229   - gchar *text = g_strdup_printf(_("<b>SSL state is undefined</b>Unexpected SSL status %ld"),lib3270_get_SSL_verify_result(GTK_V3270(widget)->host));
230   -#ifndef _WIN32
231   - gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-error",GTK_ICON_SIZE_MENU);
232   -#endif // GTK_CHECK_VERSION
233   - gtk_tooltip_set_markup(tooltip,text);
234   - g_free(text);
235   - }
  207 + v3270_autofree gchar * message =
  208 + g_strdup_printf(
  209 + "<b>%s</b>\n%s",
  210 + lib3270_get_ssl_state_message(hSession),
  211 + lib3270_get_ssl_state_description(hSession)
  212 + );
  213 + gtk_tooltip_set_markup(tooltip,message);
  214 +
236 215 }
237 216  
238 217 return TRUE;
... ...
src/trace/trace.c
... ... @@ -45,8 +45,6 @@
45 45 #include <syslog.h>
46 46 #endif // HAVE_SYSLOG
47 47  
48   -#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
49   -
50 48 /*--[ Widget definition ]----------------------------------------------------------------------------*/
51 49  
52 50 G_BEGIN_DECLS
... ...