Commit 2a12b812f491baec3b208f570c081f565ae136a0

Authored by Perry Werneck
1 parent 36dc653d

Indicador de SSL não estava atualizando em algumas situações.

src/lib3270/host.c
@@ -135,12 +135,19 @@ void lib3270_set_disconnected(H3270 *hSession) @@ -135,12 +135,19 @@ void lib3270_set_disconnected(H3270 *hSession)
135 135
136 hSession->cstate = LIB3270_NOT_CONNECTED; 136 hSession->cstate = LIB3270_NOT_CONNECTED;
137 hSession->starting = 0; 137 hSession->starting = 0;
  138 + hSession->secure = LIB3270_SSL_UNDEFINED;
138 139
139 set_status(hSession,OIA_FLAG_UNDERA,False); 140 set_status(hSession,OIA_FLAG_UNDERA,False);
  141 +
140 lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); 142 lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False);
  143 +
141 status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); 144 status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED);
  145 +
142 if(hSession->update_connect) 146 if(hSession->update_connect)
143 hSession->update_connect(hSession,0); 147 hSession->update_connect(hSession,0);
  148 +
  149 + hSession->update_ssl(hSession,hSession->secure);
  150 +
144 } 151 }
145 152
146 /* Register a function interested in a state change. */ 153 /* Register a function interested in a state change. */
src/lib3270/ssl.c
@@ -418,16 +418,6 @@ void ssl_info_callback(INFO_CONST SSL *s, int where, int ret) @@ -418,16 +418,6 @@ void ssl_info_callback(INFO_CONST SSL *s, int where, int ret)
418 418
419 #endif /*]*/ 419 #endif /*]*/
420 420
421 -LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_secure(H3270 *session)  
422 -{  
423 - CHECK_SESSION_HANDLE(session);  
424 -  
425 - if(!lib3270_is_connected(session))  
426 - return LIB3270_SSL_UNDEFINED;  
427 -  
428 - return session->secure;  
429 -}  
430 -  
431 LIB3270_EXPORT int lib3270_is_secure(H3270 *hSession) 421 LIB3270_EXPORT int lib3270_is_secure(H3270 *hSession)
432 { 422 {
433 return lib3270_get_secure(hSession) == LIB3270_SSL_SECURE; 423 return lib3270_get_secure(hSession) == LIB3270_SSL_SECURE;
@@ -443,12 +433,22 @@ LIB3270_EXPORT long lib3270_get_SSL_verify_result(H3270 *hSession) @@ -443,12 +433,22 @@ LIB3270_EXPORT long lib3270_get_SSL_verify_result(H3270 *hSession)
443 return -1; 433 return -1;
444 } 434 }
445 435
  436 +LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_secure(H3270 *session)
  437 +{
  438 + CHECK_SESSION_HANDLE(session);
  439 +
  440 + return session->secure;
  441 +}
  442 +
446 void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state) 443 void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state)
447 { 444 {
  445 + CHECK_SESSION_HANDLE(session);
  446 +
448 if(state == session->secure) 447 if(state == session->secure)
449 return; 448 return;
450 449
  450 + session->secure = state;
451 trace_dsn(session,"SSL state changes to %d\n",(int) state); 451 trace_dsn(session,"SSL state changes to %d\n",(int) state);
452 452
453 - session->update_ssl(session,session->secure = state); 453 + session->update_ssl(session,session->secure);
454 } 454 }
src/pw3270/v3270/oia.c
@@ -1081,6 +1081,8 @@ void v3270_stop_timer(GtkWidget *widget) @@ -1081,6 +1081,8 @@ void v3270_stop_timer(GtkWidget *widget)
1081 1081
1082 void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state) 1082 void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state)
1083 { 1083 {
  1084 + debug("%s **************************************** %d",__FUNCTION__,(int) state);
  1085 +
1084 v3270 * terminal = GTK_V3270(session->user_data); 1086 v3270 * terminal = GTK_V3270(session->user_data);
1085 cairo_t * cr; 1087 cairo_t * cr;
1086 GdkRectangle * r; 1088 GdkRectangle * r;
src/pw3270/v3270/widget.c
@@ -226,28 +226,22 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa @@ -226,28 +226,22 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa
226 { 226 {
227 if(!lib3270_connected(GTK_V3270(widget)->host)) 227 if(!lib3270_connected(GTK_V3270(widget)->host))
228 { 228 {
229 -#if GTK_CHECK_VERSION(2,14,0) 229 +#ifndef _WIN32
230 gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_MENU); 230 gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_MENU);
231 -#else  
232 - gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_DISCONNECT,GTK_ICON_SIZE_MENU);  
233 #endif // GTK_CHECK_VERSION 231 #endif // GTK_CHECK_VERSION
234 gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nDisconnected from host" ) ); 232 gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nDisconnected from host" ) );
235 } 233 }
236 else if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE) 234 else if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE)
237 { 235 {
238 -#if GTK_CHECK_VERSION(2,14,0) 236 +#ifndef _WIN32
239 gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-information",GTK_ICON_SIZE_MENU); 237 gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-information",GTK_ICON_SIZE_MENU);
240 -#else  
241 - gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_INFO,GTK_ICON_SIZE_MENU);  
242 #endif 238 #endif
243 gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nThe connection is insecure" ) ); 239 gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nThe connection is insecure" ) );
244 } 240 }
245 else if(!lib3270_get_SSL_verify_result(GTK_V3270(widget)->host)) 241 else if(!lib3270_get_SSL_verify_result(GTK_V3270(widget)->host))
246 { 242 {
247 -#if GTK_CHECK_VERSION(2,14,0) 243 +#ifndef _WIN32
248 gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-dialog-authentication",GTK_ICON_SIZE_MENU); 244 gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-dialog-authentication",GTK_ICON_SIZE_MENU);
249 -#else  
250 - gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_DIALOG_AUTHENTICATION,GTK_ICON_SIZE_MENU);  
251 #endif 245 #endif
252 gtk_tooltip_set_markup(tooltip,_( "<b>Identity verified</b>\nThe connection is secure" ) ); 246 gtk_tooltip_set_markup(tooltip,_( "<b>Identity verified</b>\nThe connection is secure" ) );
253 } 247 }
@@ -258,10 +252,8 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa @@ -258,10 +252,8 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa
258 if(msg) 252 if(msg)
259 { 253 {
260 gchar *text = g_strdup_printf("<b>%s</b>\n%s",_("Identity not verified"),gettext(msg->text)); 254 gchar *text = g_strdup_printf("<b>%s</b>\n%s",_("Identity not verified"),gettext(msg->text));
261 -#if GTK_CHECK_VERSION(2,14,0) 255 +#ifndef _WIN32
262 gtk_tooltip_set_icon_from_icon_name(tooltip,msg->icon,GTK_ICON_SIZE_MENU); 256 gtk_tooltip_set_icon_from_icon_name(tooltip,msg->icon,GTK_ICON_SIZE_MENU);
263 -#else  
264 - gtk_tooltip_set_icon_from_stock(tooltip,msg->icon,GTK_ICON_SIZE_MENU);  
265 #endif 257 #endif
266 gtk_tooltip_set_markup(tooltip,text); 258 gtk_tooltip_set_markup(tooltip,text);
267 g_free(text); 259 g_free(text);
@@ -269,10 +261,8 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa @@ -269,10 +261,8 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa
269 else 261 else
270 { 262 {
271 gchar *text = g_strdup_printf(_("<b>SSL state is undefined</b>Unexpected SSL status %ld"),lib3270_get_SSL_verify_result(GTK_V3270(widget)->host)); 263 gchar *text = g_strdup_printf(_("<b>SSL state is undefined</b>Unexpected SSL status %ld"),lib3270_get_SSL_verify_result(GTK_V3270(widget)->host));
272 -#if GTK_CHECK_VERSION(2,14,0) 264 +#ifndef _WIN32
273 gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-error",GTK_ICON_SIZE_MENU); 265 gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-error",GTK_ICON_SIZE_MENU);
274 -#else  
275 - gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_DIALOG_ERROR,GTK_ICON_SIZE_MENU);  
276 #endif // GTK_CHECK_VERSION 266 #endif // GTK_CHECK_VERSION
277 gtk_tooltip_set_markup(tooltip,text); 267 gtk_tooltip_set_markup(tooltip,text);
278 g_free(text); 268 g_free(text);