Commit 48e894104c0adca137b0c9152c00d19114b75bfe

Authored by perry.werneck@gmail.com
1 parent be75b9f6

Trabalhando no SSL

Showing 1 changed file with 32 additions and 20 deletions   Show diff stats
telnet.c
... ... @@ -37,29 +37,40 @@
37 37 * the given IBM host.
38 38 */
39 39  
  40 +#include <lib3270/config.h>
  41 +#if defined(HAVE_LIBSSL)
  42 + #include <openssl/ssl.h>
  43 + #include <openssl/err.h>
  44 +#endif
  45 +
40 46 #include "globals.h"
41 47 #include <errno.h>
42 48  
43   -#if defined(_WIN32) /*[*/
44   -#include <winsock2.h>
45   -#include <ws2tcpip.h>
46   -#else /*][*/
47   -#include <sys/socket.h>
48   -#include <sys/ioctl.h>
49   -#include <netinet/in.h>
50   -#endif /*]*/
  49 +#if defined(_WIN32)
  50 + #include <winsock2.h>
  51 + #include <ws2tcpip.h>
  52 +#else
  53 + #include <sys/socket.h>
  54 + #include <sys/ioctl.h>
  55 + #include <netinet/in.h>
  56 +#endif
  57 +
51 58 #define TELCMDS 1
52 59 #define TELOPTS 1
53 60 #include "arpa_telnet.h"
54   -#if !defined(_WIN32) /*[*/
55   -#include <arpa/inet.h>
56   -#endif /*]*/
  61 +
  62 +#if !defined(_WIN32)
  63 + #include <arpa/inet.h>
  64 +#endif
  65 +
57 66 #include <errno.h>
58 67 #include <fcntl.h>
59   -#if !defined(_WIN32) /*[*/
60   -#include <netdb.h>
61   -#endif /*]*/
62   -#include <stdarg.h>
  68 +
  69 +#if !defined(_WIN32)
  70 + #include <netdb.h>
  71 +#endif
  72 +
  73 +// #include <stdarg.h>
63 74  
64 75 #include "tn3270e.h"
65 76 #include "3270ds.h"
... ... @@ -2593,11 +2604,12 @@ check_linemode(Boolean init)
2593 2604 */
2594 2605 linemode = !hisopts[TELOPT_ECHO] /* && !hisopts[TELOPT_SGA] */;
2595 2606  
2596   - if (init || linemode != wasline) {
  2607 + if (init || linemode != wasline)
  2608 + {
2597 2609 st_changed(ST_LINE_MODE, linemode);
2598   - if (!init) {
2599   - trace_dsn("Operating in %s mode.\n",
2600   - linemode ? "line" : "character-at-a-time");
  2610 + if (!init)
  2611 + {
  2612 + trace_dsn("Operating in %s mode.\n",linemode ? "line" : "character-at-a-time");
2601 2613 }
2602 2614 #if defined(X3270_ANSI) /*[*/
2603 2615 if (IN_ANSI && linemode)
... ... @@ -3375,7 +3387,7 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret)
3375 3387 lib3270_write_log(NULL,"SSL","Current state is \"%s\"",SSL_state_string_long(s));
3376 3388 }
3377 3389  
3378   - trace("%s: where=%04x ret=%d",__FUNCTION__,where,ret);
  3390 + trace("%s: state=%04x where=%04x ret=%d",__FUNCTION__,SSL_state(s),where,ret);
3379 3391  
3380 3392 #ifdef DEBUG
3381 3393 if(where & SSL_CB_EXIT)
... ...