Commit 42f8ef8001e11c640695102b12bcc879a58d69b5
1 parent
79c270d5
Exists in
master
and in
5 other branches
Melhorando indicação de status da conexão SSL
Showing
8 changed files
with
79 additions
and
25 deletions
Show diff stats
src/include/lib3270.h
@@ -267,7 +267,8 @@ | @@ -267,7 +267,8 @@ | ||
267 | typedef enum lib3270_ssl_state | 267 | typedef enum lib3270_ssl_state |
268 | { | 268 | { |
269 | LIB3270_SSL_UNSECURE, /**< No secure connection */ | 269 | LIB3270_SSL_UNSECURE, /**< No secure connection */ |
270 | - LIB3270_SSL_SECURE, /**< Connection secure */ | 270 | + LIB3270_SSL_SECURE, /**< Connection secure with CA check */ |
271 | + LIB3270_SSL_NEGOTIATED, /**< Connection secure, no CA or self-signed */ | ||
271 | LIB3270_SSL_NEGOTIATING, /**< Negotiating SSL */ | 272 | LIB3270_SSL_NEGOTIATING, /**< Negotiating SSL */ |
272 | LIB3270_SSL_UNDEFINED /**< Undefined */ | 273 | LIB3270_SSL_UNDEFINED /**< Undefined */ |
273 | } LIB3270_SSL_STATE; | 274 | } LIB3270_SSL_STATE; |
src/include/pw3270/v3270.h
@@ -84,12 +84,13 @@ | @@ -84,12 +84,13 @@ | ||
84 | V3270_COLOR_OIA_FOREGROUND, | 84 | V3270_COLOR_OIA_FOREGROUND, |
85 | V3270_COLOR_OIA_SEPARATOR, | 85 | V3270_COLOR_OIA_SEPARATOR, |
86 | V3270_COLOR_OIA_STATUS_OK, | 86 | V3270_COLOR_OIA_STATUS_OK, |
87 | + V3270_COLOR_OIA_STATUS_WARNING, | ||
87 | V3270_COLOR_OIA_STATUS_INVALID, | 88 | V3270_COLOR_OIA_STATUS_INVALID, |
88 | 89 | ||
89 | V3270_COLOR_COUNT | 90 | V3270_COLOR_COUNT |
90 | }; | 91 | }; |
91 | 92 | ||
92 | - #define V3270_COLOR_OIA_STATUS_WARNING V3270_COLOR_OIA_STATUS_OK | 93 | +// #define V3270_COLOR_OIA_STATUS_WARNING V3270_COLOR_OIA_STATUS_OK |
93 | 94 | ||
94 | typedef enum _v3270_oia_field | 95 | typedef enum _v3270_oia_field |
95 | { | 96 | { |
src/lib3270/telnet.c
@@ -861,6 +861,9 @@ static void ssl_negotiate(H3270 *hSession) | @@ -861,6 +861,9 @@ static void ssl_negotiate(H3270 *hSession) | ||
861 | SSL_get_verify_result(hSession->ssl_con)); | 861 | SSL_get_verify_result(hSession->ssl_con)); |
862 | } | 862 | } |
863 | 863 | ||
864 | + if(!SSL_get_verify_result(hSession->ssl_con)) | ||
865 | + set_ssl_state(hSession,LIB3270_SSL_SECURE); | ||
866 | + | ||
864 | /* Tell the world that we are (still) connected, now in secure mode. */ | 867 | /* Tell the world that we are (still) connected, now in secure mode. */ |
865 | lib3270_set_connected(hSession); | 868 | lib3270_set_connected(hSession); |
866 | } | 869 | } |
@@ -3277,7 +3280,7 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret) | @@ -3277,7 +3280,7 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret) | ||
3277 | { | 3280 | { |
3278 | trace_dsn(hSession,"%s: SSL_CB_HANDSHAKE_DONE state=%04x\n",__FUNCTION__,SSL_state(s)); | 3281 | trace_dsn(hSession,"%s: SSL_CB_HANDSHAKE_DONE state=%04x\n",__FUNCTION__,SSL_state(s)); |
3279 | if(SSL_state(s) == 0x03) | 3282 | if(SSL_state(s) == 0x03) |
3280 | - set_ssl_state(hSession,LIB3270_SSL_SECURE); | 3283 | + set_ssl_state(hSession,LIB3270_SSL_NEGOTIATED); |
3281 | else | 3284 | else |
3282 | set_ssl_state(hSession,LIB3270_SSL_UNSECURE); | 3285 | set_ssl_state(hSession,LIB3270_SSL_UNSECURE); |
3283 | } | 3286 | } |
src/pw3270/colors.c
@@ -126,14 +126,31 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | @@ -126,14 +126,31 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | ||
126 | clr[V3270_COLOR_OIA_SEPARATOR] = clr[V3270_COLOR_GREEN]; | 126 | clr[V3270_COLOR_OIA_SEPARATOR] = clr[V3270_COLOR_GREEN]; |
127 | clr[V3270_COLOR_OIA_STATUS_OK] = clr[V3270_COLOR_GREEN]; | 127 | clr[V3270_COLOR_OIA_STATUS_OK] = clr[V3270_COLOR_GREEN]; |
128 | clr[V3270_COLOR_OIA_STATUS_INVALID] = clr[V3270_COLOR_RED]; | 128 | clr[V3270_COLOR_OIA_STATUS_INVALID] = clr[V3270_COLOR_RED]; |
129 | + clr[V3270_COLOR_OIA_STATUS_WARNING] = clr[V3270_COLOR_YELLOW]; | ||
129 | 130 | ||
130 | val = g_key_file_get_string(conf,group,"OIA",NULL); | 131 | val = g_key_file_get_string(conf,group,"OIA",NULL); |
131 | if(val) | 132 | if(val) |
132 | { | 133 | { |
133 | - gchar **str = g_strsplit(val,",",5); | 134 | + gchar **str = g_strsplit(val,",",6); |
134 | 135 | ||
135 | - for(f=0;f< MIN(g_strv_length(str),4); f++) | ||
136 | - gdk_color_parse(str[f],clr+V3270_COLOR_OIA_BACKGROUND+f); | 136 | + // 0 = V3270_COLOR_OIA_BACKGROUND, |
137 | + // 1 = V3270_COLOR_OIA_FOREGROUND, | ||
138 | + // 2 = V3270_COLOR_OIA_SEPARATOR, | ||
139 | + // 3 = V3270_COLOR_OIA_STATUS_OK, | ||
140 | + // 4 = V3270_COLOR_OIA_STATUS_WARNING, | ||
141 | + // 5 = V3270_COLOR_OIA_STATUS_INVALID, | ||
142 | + | ||
143 | + if(g_strv_length(str) == 5) | ||
144 | + { | ||
145 | + for(f=0;f < 5; f++) | ||
146 | + gdk_color_parse(str[f],clr+V3270_COLOR_OIA_BACKGROUND+f); | ||
147 | + clr[V3270_COLOR_OIA_STATUS_INVALID] = clr[V3270_COLOR_OIA_STATUS_WARNING]; | ||
148 | + } | ||
149 | + else | ||
150 | + { | ||
151 | + for(f=0;f< MIN(g_strv_length(str),6); f++) | ||
152 | + gdk_color_parse(str[f],clr+V3270_COLOR_OIA_BACKGROUND+f); | ||
153 | + } | ||
137 | 154 | ||
138 | g_strfreev(str); | 155 | g_strfreev(str); |
139 | } | 156 | } |
@@ -405,6 +422,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | @@ -405,6 +422,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | ||
405 | N_( "OIA foreground" ), // TERMINAL_COLOR_OIA_FOREGROUND | 422 | N_( "OIA foreground" ), // TERMINAL_COLOR_OIA_FOREGROUND |
406 | N_( "OIA separator" ), // TERMINAL_COLOR_OIA_SEPARATOR | 423 | N_( "OIA separator" ), // TERMINAL_COLOR_OIA_SEPARATOR |
407 | N_( "OIA status ok" ), // TERMINAL_COLOR_OIA_STATUS_OK | 424 | N_( "OIA status ok" ), // TERMINAL_COLOR_OIA_STATUS_OK |
425 | + N_( "OIA Warning" ), // V3270_COLOR_OIA_STATUS_WARNING | ||
408 | N_( "OIA status invalid" ), // TERMINAL_COLOR_OIA_STATUS_INVALID | 426 | N_( "OIA status invalid" ), // TERMINAL_COLOR_OIA_STATUS_INVALID |
409 | 427 | ||
410 | }; | 428 | }; |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +#define negotiated_width 32 | ||
2 | +#define negotiated_height 32 | ||
3 | +static unsigned char negotiated_bits[] = { | ||
4 | + 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x07, 0xe0, 0x00, | ||
5 | + 0x80, 0x03, 0xc0, 0x01, 0xc0, 0xf1, 0x8f, 0x03, 0xc0, 0xf8, 0x1f, 0x03, | ||
6 | + 0xc0, 0x1c, 0x38, 0x03, 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, | ||
7 | + 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, | ||
8 | + 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, 0xf0, 0xff, 0xff, 0x0f, | ||
9 | + 0xf0, 0xff, 0xff, 0x0f, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, | ||
10 | + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, | ||
11 | + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, | ||
12 | + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, | ||
13 | + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, | ||
14 | + 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f }; |
src/pw3270/v3270/oia.c
@@ -52,6 +52,7 @@ static void draw_cursor_position(cairo_t *cr, GdkRectangle *rect, struct v3270_m | @@ -52,6 +52,7 @@ static void draw_cursor_position(cairo_t *cr, GdkRectangle *rect, struct v3270_m | ||
52 | 52 | ||
53 | #include "locked.xbm" | 53 | #include "locked.xbm" |
54 | #include "unlocked.xbm" | 54 | #include "unlocked.xbm" |
55 | + #include "negotiated.xbm" | ||
55 | 56 | ||
56 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 57 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
57 | 58 | ||
@@ -334,8 +335,16 @@ void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, struct v3270_metrics *metri | @@ -334,8 +335,16 @@ void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, struct v3270_metrics *metri | ||
334 | bits = (unsigned char *) unlocked_bits; | 335 | bits = (unsigned char *) unlocked_bits; |
335 | break; | 336 | break; |
336 | 337 | ||
337 | - case LIB3270_SSL_SECURE: /**< Connection secure */ | ||
338 | - gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_FOREGROUND); | 338 | + case LIB3270_SSL_NEGOTIATED: /**< Connection secure, no CA or self-signed */ |
339 | + gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_WARNING); | ||
340 | + width = negotiated_width; | ||
341 | + height = negotiated_height; | ||
342 | + bits = (unsigned char *) negotiated_bits; | ||
343 | + break; | ||
344 | + | ||
345 | + | ||
346 | + case LIB3270_SSL_SECURE: /**< Connection secure with CA check */ | ||
347 | + gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_OK); | ||
339 | width = locked_width; | 348 | width = locked_width; |
340 | height = locked_height; | 349 | height = locked_height; |
341 | bits = (unsigned char *) locked_bits; | 350 | bits = (unsigned char *) locked_bits; |
@@ -343,9 +352,9 @@ void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, struct v3270_metrics *metri | @@ -343,9 +352,9 @@ void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, struct v3270_metrics *metri | ||
343 | 352 | ||
344 | case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ | 353 | case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ |
345 | gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_WARNING); | 354 | gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_WARNING); |
346 | - width = locked_width; | ||
347 | - height = locked_height; | ||
348 | - bits = (unsigned char *) locked_bits; | 355 | + width = unlocked_width; |
356 | + height = unlocked_height; | ||
357 | + bits = (unsigned char *) unlocked_bits; | ||
349 | break; | 358 | break; |
350 | 359 | ||
351 | default: | 360 | default: |
src/pw3270/v3270/unlocked.xbm
1 | -#define unlocked_width 32 | ||
2 | -#define unlocked_height 32 | ||
3 | -static unsigned char unlocked_bits[] = { | ||
4 | - 0x00, 0x00, 0xff, 0x0f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0xc0, 0x01, 0x38, | ||
5 | - 0x00, 0xe0, 0x00, 0x70, 0x00, 0x70, 0xfc, 0xe3, 0x00, 0x30, 0xfe, 0xc7, | ||
6 | - 0x00, 0x30, 0x07, 0xce, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, | ||
7 | - 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, | ||
8 | - 0x00, 0x30, 0x03, 0xfc, 0x00, 0x30, 0x03, 0xfc, 0xff, 0xff, 0x3f, 0x00, | ||
9 | - 0xff, 0xff, 0x3f, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, | ||
10 | - 0xcf, 0xcc, 0x3c, 0x00, 0xcf, 0xcc, 0x3c, 0x00, 0x33, 0x33, 0x33, 0x00, | ||
11 | - 0x33, 0x33, 0x33, 0x00, 0xcf, 0xcc, 0x3c, 0x00, 0xcf, 0xcc, 0x3c, 0x00, | ||
12 | - 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xcf, 0xcc, 0x3c, 0x00, | ||
13 | - 0xcf, 0xcc, 0x3c, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, | ||
14 | - 0xff, 0xff, 0x3f, 0x00, 0xff, 0xff, 0x3f, 0x00 }; | 1 | +#define unlocked_width 32 |
2 | +#define unlocked_height 32 | ||
3 | +static unsigned char unlocked_bits[] = { | ||
4 | + 0x00, 0x00, 0xff, 0x0f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0xc0, 0x01, 0x38, | ||
5 | + 0x00, 0xe0, 0x00, 0x70, 0x00, 0x70, 0xfc, 0xe3, 0x00, 0x30, 0xfe, 0xc7, | ||
6 | + 0x00, 0x30, 0x07, 0xce, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, | ||
7 | + 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, | ||
8 | + 0x00, 0x30, 0x03, 0xfc, 0x00, 0x30, 0x03, 0xfc, 0xff, 0xff, 0x3f, 0x00, | ||
9 | + 0xff, 0xff, 0x3f, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, | ||
10 | + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, | ||
11 | + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, | ||
12 | + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, | ||
13 | + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, | ||
14 | + 0xff, 0xff, 0x3f, 0x00, 0xff, 0xff, 0x3f, 0x00 }; |
src/pw3270/v3270/widget.c
@@ -1167,6 +1167,7 @@ void v3270_set_colors(GtkWidget *widget, const gchar *colors) | @@ -1167,6 +1167,7 @@ void v3270_set_colors(GtkWidget *widget, const gchar *colors) | ||
1167 | "#00FF00," // V3270_COLOR_OIA | 1167 | "#00FF00," // V3270_COLOR_OIA |
1168 | "#7890F0," // V3270_COLOR_OIA_SEPARATOR | 1168 | "#7890F0," // V3270_COLOR_OIA_SEPARATOR |
1169 | "#FFFFFF," // V3270_COLOR_OIA_STATUS_OK | 1169 | "#FFFFFF," // V3270_COLOR_OIA_STATUS_OK |
1170 | + "#FFFF00," // V3270_COLOR_OIA_STATUS_WARNING | ||
1170 | "#FF0000"; // V3270_COLOR_OIA_STATUS_INVALID | 1171 | "#FF0000"; // V3270_COLOR_OIA_STATUS_INVALID |
1171 | 1172 | ||
1172 | } | 1173 | } |
@@ -1228,8 +1229,15 @@ void v3270_set_color_table(GdkColor *table, const gchar *colors) | @@ -1228,8 +1229,15 @@ void v3270_set_color_table(GdkColor *table, const gchar *colors) | ||
1228 | 1229 | ||
1229 | clr = g_strsplit(colors,",",V3270_COLOR_COUNT+1); | 1230 | clr = g_strsplit(colors,",",V3270_COLOR_COUNT+1); |
1230 | cnt = g_strv_length(clr); | 1231 | cnt = g_strv_length(clr); |
1232 | + | ||
1231 | switch(cnt) | 1233 | switch(cnt) |
1232 | { | 1234 | { |
1235 | + case 28: // Version 4 string | ||
1236 | + for(f=0;f < 28;f++) | ||
1237 | + gdk_color_parse(clr[f],table+f); | ||
1238 | + table[V3270_COLOR_OIA_STATUS_INVALID] = table[V3270_COLOR_OIA_STATUS_WARNING]; | ||
1239 | + break; | ||
1240 | + | ||
1233 | case V3270_COLOR_COUNT: // Complete string | 1241 | case V3270_COLOR_COUNT: // Complete string |
1234 | for(f=0;f < V3270_COLOR_COUNT;f++) | 1242 | for(f=0;f < V3270_COLOR_COUNT;f++) |
1235 | gdk_color_parse(clr[f],table+f); | 1243 | gdk_color_parse(clr[f],table+f); |