Commit 9921a4085fe67a6631a35851b9fe3d06ec42687f

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

Trabalhando no SSL

@@ -220,6 +220,7 @@ @@ -220,6 +220,7 @@
220 </Unit> 220 </Unit>
221 <Unit filename="src/lib3270/xioc.h" /> 221 <Unit filename="src/lib3270/xioc.h" />
222 <Unit filename="src/lib3270/xl.h" /> 222 <Unit filename="src/lib3270/xl.h" />
  223 + <Unit filename="src/pw3270/Makefile.in" />
223 <Unit filename="src/pw3270/actions.c"> 224 <Unit filename="src/pw3270/actions.c">
224 <Option compilerVar="CC" /> 225 <Option compilerVar="CC" />
225 </Unit> 226 </Unit>
@@ -320,6 +321,7 @@ @@ -320,6 +321,7 @@
320 <Unit filename="src/pw3270/window.c"> 321 <Unit filename="src/pw3270/window.c">
321 <Option compilerVar="CC" /> 322 <Option compilerVar="CC" />
322 </Unit> 323 </Unit>
  324 + <Unit filename="src/tools/Makefile.in" />
323 <Unit filename="ui/00default.xml" /> 325 <Unit filename="ui/00default.xml" />
324 <Unit filename="ui/99debug.xml" /> 326 <Unit filename="ui/99debug.xml" />
325 <Extensions> 327 <Extensions>
src/include/lib3270/session.h
@@ -36,11 +36,6 @@ @@ -36,11 +36,6 @@
36 #define LIB3270_LUNAME_LENGTH 16 36 #define LIB3270_LUNAME_LENGTH 16
37 #define LIB3270_FULL_MODEL_NAME_LENGTH 13 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 /** extended attributes */ 39 /** extended attributes */
45 struct ea 40 struct ea
46 { 41 {
@@ -66,6 +61,10 @@ @@ -66,6 +61,10 @@
66 void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */ 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 struct _h3270 68 struct _h3270
70 { 69 {
71 unsigned short sz; /**< Struct size */ 70 unsigned short sz; /**< Struct size */
@@ -157,10 +156,9 @@ @@ -157,10 +156,9 @@
157 char reading; 156 char reading;
158 char excepting; 157 char excepting;
159 158
160 -#if defined(HAVE_LIBSSL) /*[*/ 159 + // SSL Data (Always defined to mantain the same structure size
161 unsigned long last_ssl_error; 160 unsigned long last_ssl_error;
162 SSL * ssl_con; 161 SSL * ssl_con;
163 -#endif  
164 162
165 // State change callbacks. 163 // State change callbacks.
166 struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER]; 164 struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER];
src/lib3270/telnet.c
@@ -37,29 +37,40 @@ @@ -37,29 +37,40 @@
37 * the given IBM host. 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 #include "globals.h" 46 #include "globals.h"
41 #include <errno.h> 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 #define TELCMDS 1 58 #define TELCMDS 1
52 #define TELOPTS 1 59 #define TELOPTS 1
53 #include "arpa_telnet.h" 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 #include <errno.h> 66 #include <errno.h>
58 #include <fcntl.h> 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 #include "tn3270e.h" 75 #include "tn3270e.h"
65 #include "3270ds.h" 76 #include "3270ds.h"
@@ -2593,11 +2604,12 @@ check_linemode(Boolean init) @@ -2593,11 +2604,12 @@ check_linemode(Boolean init)
2593 */ 2604 */
2594 linemode = !hisopts[TELOPT_ECHO] /* && !hisopts[TELOPT_SGA] */; 2605 linemode = !hisopts[TELOPT_ECHO] /* && !hisopts[TELOPT_SGA] */;
2595 2606
2596 - if (init || linemode != wasline) { 2607 + if (init || linemode != wasline)
  2608 + {
2597 st_changed(ST_LINE_MODE, linemode); 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 #if defined(X3270_ANSI) /*[*/ 2614 #if defined(X3270_ANSI) /*[*/
2603 if (IN_ANSI && linemode) 2615 if (IN_ANSI && linemode)
@@ -3375,7 +3387,7 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret) @@ -3375,7 +3387,7 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret)
3375 lib3270_write_log(NULL,"SSL","Current state is \"%s\"",SSL_state_string_long(s)); 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 #ifdef DEBUG 3392 #ifdef DEBUG
3381 if(where & SSL_CB_EXIT) 3393 if(where & SSL_CB_EXIT)