Commit 0fdbd46fe958fd1c771f9ff47497aae3a2cb2153
1 parent
479bffdb
Exists in
master
and in
5 other branches
Resolvendo "Hang" quando tenta conectar a um host seguro sem que a opção corresp…
…ondente esteja setada
Showing
3 changed files
with
67 additions
and
50 deletions
Show diff stats
po/pt_BR.po
| ... | ... | @@ -5,7 +5,7 @@ msgid "" |
| 5 | 5 | msgstr "" |
| 6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
| 7 | 7 | "Report-Msgid-Bugs-To: \n" |
| 8 | -"POT-Creation-Date: 2012-12-18 10:46-0200\n" | |
| 8 | +"POT-Creation-Date: 2012-12-19 16:56-0200\n" | |
| 9 | 9 | "PO-Revision-Date: 2012-12-18 10:32-0200\n" |
| 10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
| 11 | 11 | "Language-Team: Português <>\n" | ... | ... |
src/lib3270/ft.c
| ... | ... | @@ -317,13 +317,17 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 317 | 317 | |
| 318 | 318 | /* Build the ind$file command */ |
| 319 | 319 | snprintf(op,4095,"%s%s%s", |
| 320 | - (ft->flags & LIB3270_FT_OPTION_ASCII) ? " ASCII" : "", | |
| 321 | - (ft->flags & LIB3270_FT_OPTION_CRLF) ? " CRLF" : "", | |
| 322 | - (ft->flags & LIB3270_FT_OPTION_APPEND) ? " APPEND" : "" | |
| 320 | + (ft->flags & LIB3270_FT_OPTION_ASCII) ? " ascii" : "", | |
| 321 | + (ft->flags & LIB3270_FT_OPTION_CRLF) ? " crlf" : "", | |
| 322 | + (ft->flags & LIB3270_FT_OPTION_APPEND) ? " append" : "" | |
| 323 | 323 | ); |
| 324 | 324 | |
| 325 | 325 | if(!(ft->flags & LIB3270_FT_OPTION_RECEIVE)) |
| 326 | 326 | { |
| 327 | + // Sending file | |
| 328 | + | |
| 329 | + trace("tso=%d",ft->flags & LIB3270_FT_OPTION_TSO); | |
| 330 | + | |
| 327 | 331 | if(ft->flags & LIB3270_FT_OPTION_TSO) |
| 328 | 332 | { |
| 329 | 333 | // TSO Host |
| ... | ... | @@ -365,16 +369,16 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); |
| 365 | 369 | } |
| 366 | 370 | } |
| 367 | 371 | |
| 368 | - snprintf(buffer,4095,"%s %s %s", "IND$FILE", | |
| 369 | - (ft->flags & LIB3270_FT_OPTION_RECEIVE) ? "GET" : "PUT", | |
| 372 | + snprintf(buffer,4095,"%s %s %s", "ind$file", | |
| 373 | + (ft->flags & LIB3270_FT_OPTION_RECEIVE) ? "get" : "put", | |
| 370 | 374 | ft->remote ); |
| 371 | 375 | |
| 372 | 376 | if(*op) |
| 373 | 377 | { |
| 374 | 378 | if(ft->flags & LIB3270_FT_OPTION_TSO) |
| 375 | - snconcat(buffer,4095," (%s)",op+1); | |
| 376 | - else | |
| 377 | 379 | snconcat(buffer,4095," %s",op+1); |
| 380 | + else | |
| 381 | + snconcat(buffer,4095," (%s",op+1); | |
| 378 | 382 | } |
| 379 | 383 | |
| 380 | 384 | snconcat(buffer,4095,"%s","\n"); | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -801,6 +801,56 @@ static void setup_lus(H3270 *hSession) |
| 801 | 801 | hSession->try_lu = *hSession->curr_lu; |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | +#if defined(HAVE_LIBSSL) | |
| 805 | +static void ssl_negotiate(H3270 *hSession) | |
| 806 | +{ | |
| 807 | + int rv; | |
| 808 | + | |
| 809 | + set_ssl_state(hSession,LIB3270_SSL_NEGOTIATING); | |
| 810 | + non_blocking(hSession,False); | |
| 811 | + | |
| 812 | + /* Initialize the SSL library. */ | |
| 813 | + ssl_init(hSession); | |
| 814 | + if(hSession->ssl_con == NULL) | |
| 815 | + { | |
| 816 | + /* Failed. */ | |
| 817 | + popup_an_error(hSession,_( "SSL init failed!")); | |
| 818 | + net_disconnect(hSession); | |
| 819 | + return; | |
| 820 | + } | |
| 821 | + | |
| 822 | + /* Set up the TLS/SSL connection. */ | |
| 823 | + if(SSL_set_fd(hSession->ssl_con, hSession->sock) != 1) | |
| 824 | + { | |
| 825 | + trace_dsn(hSession,"SSL_set_fd failed!\n"); | |
| 826 | + popup_an_error(hSession,_( "SSL_set_fd failed!")); | |
| 827 | + net_disconnect(hSession); | |
| 828 | + return; | |
| 829 | + } | |
| 830 | + | |
| 831 | + trace("%s: Running SSL_connect",__FUNCTION__); | |
| 832 | + rv = SSL_connect(hSession->ssl_con); | |
| 833 | + trace("%s: SSL_connect exits with rc=%d",__FUNCTION__,rv); | |
| 834 | + | |
| 835 | + if (rv != 1) | |
| 836 | + { | |
| 837 | + trace_dsn(hSession,"continue_tls: SSL_connect failed\n"); | |
| 838 | + popup_an_error(hSession,_( "SSL connect failed!")); | |
| 839 | + net_disconnect(hSession); | |
| 840 | + return; | |
| 841 | + } | |
| 842 | + | |
| 843 | +// hSession->secure_connection = True; | |
| 844 | + non_blocking(hSession,True); | |
| 845 | + | |
| 846 | + /* Success. */ | |
| 847 | + trace_dsn(hSession,"TLS/SSL negotiated connection complete. Connection is now secure.\n"); | |
| 848 | + | |
| 849 | + /* Tell the world that we are (still) connected, now in secure mode. */ | |
| 850 | + lib3270_set_connected(hSession); | |
| 851 | +} | |
| 852 | +#endif // HAVE_LIBSSL | |
| 853 | + | |
| 804 | 854 | static void net_connected(H3270 *hSession) |
| 805 | 855 | { |
| 806 | 856 | if(hSession->proxy_type > 0) |
| ... | ... | @@ -821,6 +871,8 @@ static void net_connected(H3270 *hSession) |
| 821 | 871 | /* Set up SSL. */ |
| 822 | 872 | if(hSession->ssl_con && hSession->secure == LIB3270_SSL_UNDEFINED) |
| 823 | 873 | { |
| 874 | + ssl_negotiate(hSession); | |
| 875 | +/* | |
| 824 | 876 | int rc; |
| 825 | 877 | |
| 826 | 878 | set_ssl_state(hSession,LIB3270_SSL_NEGOTIATING); |
| ... | ... | @@ -857,8 +909,9 @@ static void net_connected(H3270 *hSession) |
| 857 | 909 | // hSession->secure_connection = True; |
| 858 | 910 | trace_dsn(hSession,"TLS/SSL tunneled connection complete. Connection is now secure.\n"); |
| 859 | 911 | |
| 860 | - /* Tell everyone else again. */ | |
| 912 | + // Tell everyone else again. | |
| 861 | 913 | lib3270_set_connected(hSession); |
| 914 | +*/ | |
| 862 | 915 | } |
| 863 | 916 | #endif /*]*/ |
| 864 | 917 | |
| ... | ... | @@ -3220,8 +3273,6 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret) |
| 3220 | 3273 | */ |
| 3221 | 3274 | static void continue_tls(H3270 *hSession, unsigned char *sbbuf, int len) |
| 3222 | 3275 | { |
| 3223 | - int rv; | |
| 3224 | - | |
| 3225 | 3276 | /* Whatever happens, we're not expecting another SB STARTTLS. */ |
| 3226 | 3277 | hSession->need_tls_follows = 0; |
| 3227 | 3278 | |
| ... | ... | @@ -3237,45 +3288,7 @@ static void continue_tls(H3270 *hSession, unsigned char *sbbuf, int len) |
| 3237 | 3288 | |
| 3238 | 3289 | /* Trace what we got. */ |
| 3239 | 3290 | trace_dsn(hSession,"%s FOLLOWS %s\n", opt(TELOPT_STARTTLS), cmd(SE)); |
| 3240 | - | |
| 3241 | - /* Initialize the SSL library. */ | |
| 3242 | - ssl_init(hSession); | |
| 3243 | - if(hSession->ssl_con == NULL) | |
| 3244 | - { | |
| 3245 | - /* Failed. */ | |
| 3246 | - popup_an_error(hSession,_( "SSL init failed!")); | |
| 3247 | - net_disconnect(hSession); | |
| 3248 | - return; | |
| 3249 | - } | |
| 3250 | - | |
| 3251 | - /* Set up the TLS/SSL connection. */ | |
| 3252 | - if(SSL_set_fd(hSession->ssl_con, hSession->sock) != 1) | |
| 3253 | - { | |
| 3254 | - trace_dsn(hSession,"SSL_set_fd failed!\n"); | |
| 3255 | - popup_an_error(hSession,_( "SSL_set_fd failed!")); | |
| 3256 | - net_disconnect(hSession); | |
| 3257 | - return; | |
| 3258 | - } | |
| 3259 | - | |
| 3260 | - trace("%s: Running SSL_connect",__FUNCTION__); | |
| 3261 | - rv = SSL_connect(hSession->ssl_con); | |
| 3262 | - trace("%s: SSL_connect exits with rc=%d",__FUNCTION__,rv); | |
| 3263 | - | |
| 3264 | - if (rv != 1) | |
| 3265 | - { | |
| 3266 | - trace_dsn(hSession,"continue_tls: SSL_connect failed\n"); | |
| 3267 | - popup_an_error(hSession,_( "SSL connect failed!")); | |
| 3268 | - net_disconnect(hSession); | |
| 3269 | - return; | |
| 3270 | - } | |
| 3271 | - | |
| 3272 | -// hSession->secure_connection = True; | |
| 3273 | - | |
| 3274 | - /* Success. */ | |
| 3275 | - trace_dsn(hSession,"TLS/SSL negotiated connection complete. Connection is now secure.\n"); | |
| 3276 | - | |
| 3277 | - /* Tell the world that we are (still) connected, now in secure mode. */ | |
| 3278 | - lib3270_set_connected(hSession); | |
| 3291 | + ssl_negotiate(hSession); | |
| 3279 | 3292 | } |
| 3280 | 3293 | |
| 3281 | 3294 | #endif /*]*/ | ... | ... |