Commit 9921a4085fe67a6631a35851b9fe3d06ec42687f

Authored by perry.werneck@gmail.com
1 parent 78b6471f

Trabalhando no SSL

pw3270.cbp
... ... @@ -220,6 +220,7 @@
220 220 </Unit>
221 221 <Unit filename="src/lib3270/xioc.h" />
222 222 <Unit filename="src/lib3270/xl.h" />
  223 + <Unit filename="src/pw3270/Makefile.in" />
223 224 <Unit filename="src/pw3270/actions.c">
224 225 <Option compilerVar="CC" />
225 226 </Unit>
... ... @@ -320,6 +321,7 @@
320 321 <Unit filename="src/pw3270/window.c">
321 322 <Option compilerVar="CC" />
322 323 </Unit>
  324 + <Unit filename="src/tools/Makefile.in" />
323 325 <Unit filename="ui/00default.xml" />
324 326 <Unit filename="ui/99debug.xml" />
325 327 <Extensions>
... ...
src/include/lib3270/session.h
... ... @@ -36,11 +36,6 @@
36 36 #define LIB3270_LUNAME_LENGTH 16
37 37 #define LIB3270_FULL_MODEL_NAME_LENGTH 13
38 38  
39   - #if defined(HAVE_LIBSSL)
40   - #include <openssl/ssl.h>
41   - #include <openssl/err.h>
42   - #endif
43   -
44 39 /** extended attributes */
45 40 struct ea
46 41 {
... ... @@ -66,6 +61,10 @@
66 61 void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */
67 62 };
68 63  
  64 +#ifndef HEADER_SSL_H
  65 + #define SSL void
  66 +#endif // !HEADER_SSL_H
  67 +
69 68 struct _h3270
70 69 {
71 70 unsigned short sz; /**< Struct size */
... ... @@ -157,10 +156,9 @@
157 156 char reading;
158 157 char excepting;
159 158  
160   -#if defined(HAVE_LIBSSL) /*[*/
  159 + // SSL Data (Always defined to mantain the same structure size
161 160 unsigned long last_ssl_error;
162 161 SSL * ssl_con;
163   -#endif
164 162  
165 163 // State change callbacks.
166 164 struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER];
... ...
src/lib3270/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)
... ...