Commit 8a48b00257436ea165aa95edb46ce4f3ae8385da
1 parent
9f587083
Exists in
master
and in
3 other branches
Melhorando negociação SSL
Showing
1 changed file
with
16 additions
and
7 deletions
Show diff stats
telnet.c
| ... | ... | @@ -350,6 +350,8 @@ static void output_possible(H3270 *session); |
| 350 | 350 | #define SOCK_IOCTL ioctl |
| 351 | 351 | #endif /*]*/ |
| 352 | 352 | |
| 353 | + | |
| 354 | + | |
| 353 | 355 | |
| 354 | 356 | #if defined(_WIN32) /*[*/ |
| 355 | 357 | void sockstart(H3270 *session) |
| ... | ... | @@ -768,7 +770,7 @@ static void net_connected(H3270 *session) |
| 768 | 770 | if (SSL_set_fd(session->ssl_con, session->sock) != 1) |
| 769 | 771 | { |
| 770 | 772 | trace_dsn("Can't set fd!\n"); |
| 771 | - popup_system_error(&h3270,_( "Connection failed error" ), _( "Can't set SSL socket file descriptor" ), "%s", SSL_state_string_long(session->ssl_con)); | |
| 773 | + popup_system_error(&h3270,_( "Connection failed" ), _( "Can't set SSL socket file descriptor" ), "%s", SSL_state_string_long(session->ssl_con)); | |
| 772 | 774 | } |
| 773 | 775 | |
| 774 | 776 | non_blocking(False); |
| ... | ... | @@ -3284,12 +3286,13 @@ static void ssl_init(H3270 *session) |
| 3284 | 3286 | /* Callback for tracing protocol negotiation. */ |
| 3285 | 3287 | static void client_info_callback(INFO_CONST SSL *s, int where, int ret) |
| 3286 | 3288 | { |
| 3287 | - if (where == SSL_CB_CONNECT_LOOP) | |
| 3289 | + switch(where) | |
| 3288 | 3290 | { |
| 3291 | + case SSL_CB_CONNECT_LOOP: | |
| 3289 | 3292 | trace_dsn("SSL_connect: %s %s\n",SSL_state_string(s), SSL_state_string_long(s)); |
| 3290 | - } | |
| 3291 | - else if (where == SSL_CB_CONNECT_EXIT) | |
| 3292 | - { | |
| 3293 | + break; | |
| 3294 | + | |
| 3295 | + case SSL_CB_CONNECT_EXIT: | |
| 3293 | 3296 | if (ret == 0) |
| 3294 | 3297 | { |
| 3295 | 3298 | trace_dsn("SSL_connect: failed in %s\n",SSL_state_string_long(s)); |
| ... | ... | @@ -3297,10 +3300,9 @@ static void client_info_callback(INFO_CONST SSL *s, int where, int ret) |
| 3297 | 3300 | } |
| 3298 | 3301 | else if (ret < 0) |
| 3299 | 3302 | { |
| 3300 | - unsigned long e; | |
| 3303 | + unsigned long e = ERR_get_error(); | |
| 3301 | 3304 | char err_buf[1024]; |
| 3302 | 3305 | |
| 3303 | - e = ERR_get_error(); | |
| 3304 | 3306 | while(ERR_peek_error() == e) // Remove other messages with the same error |
| 3305 | 3307 | e = ERR_get_error(); |
| 3306 | 3308 | |
| ... | ... | @@ -3339,7 +3341,14 @@ static void client_info_callback(INFO_CONST SSL *s, int where, int ret) |
| 3339 | 3341 | |
| 3340 | 3342 | |
| 3341 | 3343 | } |
| 3344 | + | |
| 3345 | + | |
| 3346 | + default: | |
| 3347 | + lib3270_write_log(NULL,"SSL","Current state is \"%s\"",SSL_state_string_long(s)); | |
| 3342 | 3348 | } |
| 3349 | + | |
| 3350 | + if(where & SSL_CB_ALERT) | |
| 3351 | + lib3270_write_log(NULL,"SSL","ALERT: %s",SSL_alert_type_string_long(ret)); | |
| 3343 | 3352 | } |
| 3344 | 3353 | |
| 3345 | 3354 | /* Process a STARTTLS subnegotiation. */ | ... | ... |