Commit 70dea602081d60d03a3f395312f515907ca4b943
1 parent
111d2402
Exists in
master
and in
3 other branches
Working on CRL download for windows.
Showing
5 changed files
with
222 additions
and
240 deletions
Show diff stats
src/lib3270/ansi.c
... | ... | @@ -35,6 +35,7 @@ |
35 | 35 | */ |
36 | 36 | |
37 | 37 | #pragma GCC diagnostic ignored "-Wsign-compare" |
38 | +#pragma GCC diagnostic ignored "-Wstringop-truncation" | |
38 | 39 | |
39 | 40 | #include "private.h" |
40 | 41 | |
... | ... | @@ -44,8 +45,6 @@ |
44 | 45 | #include <X11/Shell.h> |
45 | 46 | #endif /*]*/ |
46 | 47 | |
47 | -//#include "appres.h" | |
48 | -// #include "ctlr.h" | |
49 | 48 | #if defined(X3270_DBCS) /*[*/ |
50 | 49 | #include <lib3270/3270ds.h> |
51 | 50 | #endif /*]*/ |
... | ... | @@ -54,8 +53,6 @@ |
54 | 53 | #include "ctlrc.h" |
55 | 54 | #include "hostc.h" |
56 | 55 | #include "screenc.h" |
57 | -// #include "scrollc.h" | |
58 | -// #include "tablesc.h" | |
59 | 56 | #include "telnetc.h" |
60 | 57 | #include "trace_dsc.h" |
61 | 58 | #include "utf8c.h" |
... | ... | @@ -65,68 +62,67 @@ |
65 | 62 | |
66 | 63 | #define MB_MAX LIB3270_MB_MAX |
67 | 64 | |
68 | -#define SC 1 /* save cursor position */ | |
69 | -#define RC 2 /* restore cursor position */ | |
70 | -#define NL 3 /* new line */ | |
71 | -#define UP 4 /* cursor up */ | |
72 | -#define E2 5 /* second level of ESC processing */ | |
73 | -#define rS 6 /* reset */ | |
74 | -#define IC 7 /* insert chars */ | |
75 | -#define DN 8 /* cursor down */ | |
76 | -#define RT 9 /* cursor right */ | |
77 | -#define LT 10 /* cursor left */ | |
78 | -#define CM 11 /* cursor motion */ | |
79 | -#define ED 12 /* erase in display */ | |
80 | -#define EL 13 /* erase in line */ | |
81 | -#define IL 14 /* insert lines */ | |
82 | -#define DL 15 /* delete lines */ | |
83 | -#define DC 16 /* delete characters */ | |
84 | -#define SG 17 /* set graphic rendition */ | |
85 | -#define BL 18 /* ring bell */ | |
86 | -#define NP 19 /* new page */ | |
87 | -#define BS 20 /* backspace */ | |
88 | -#define CR 21 /* carriage return */ | |
89 | -#define LF 22 /* line feed */ | |
90 | -#define HT 23 /* horizontal tab */ | |
91 | -#define E1 24 /* first level of ESC processing */ | |
92 | -#define Xx 25 /* undefined control character (nop) */ | |
93 | -#define Pc 26 /* printing character */ | |
94 | -#define Sc 27 /* semicolon (after ESC [) */ | |
95 | -#define Dg 28 /* digit (after ESC [ or ESC [ ?) */ | |
96 | -#define RI 29 /* reverse index */ | |
97 | -#define DA 30 /* send device attributes */ | |
98 | -#define SM 31 /* set mode */ | |
99 | -#define RM 32 /* reset mode */ | |
100 | -#define DO 33 /* return terminal ID (obsolete) */ | |
101 | -#define SR 34 /* device status report */ | |
102 | -#define CS 35 /* character set designate */ | |
103 | -#define E3 36 /* third level of ESC processing */ | |
104 | -#define DS 37 /* DEC private set */ | |
105 | -#define DR 38 /* DEC private reset */ | |
106 | -#define DV 39 /* DEC private save */ | |
107 | -#define DT 40 /* DEC private restore */ | |
108 | -#define SS 41 /* set scrolling region */ | |
109 | -#define TM 42 /* text mode (ESC ]) */ | |
110 | -#define T2 43 /* semicolon (after ESC ]) */ | |
111 | -#define TX 44 /* text parameter (after ESC ] n ;) */ | |
112 | -#define TB 45 /* text parameter done (ESC ] n ; xxx BEL) */ | |
113 | -#define TS 46 /* tab set */ | |
114 | -#define TC 47 /* tab clear */ | |
115 | -#define C2 48 /* character set designate (finish) */ | |
116 | -#define G0 49 /* select G0 character set */ | |
117 | -#define G1 50 /* select G1 character set */ | |
118 | -#define G2 51 /* select G2 character set */ | |
119 | -#define G3 52 /* select G3 character set */ | |
120 | -#define S2 53 /* select G2 for next character */ | |
121 | -#define S3 54 /* select G3 for next character */ | |
122 | -#define MB 55 /* process multi-byte character */ | |
65 | +#define SC 1 /**< @brief save cursor position */ | |
66 | +#define RC 2 /**< @brief restore cursor position */ | |
67 | +#define NL 3 /**< @brief new line */ | |
68 | +#define UP 4 /**< @brief cursor up */ | |
69 | +#define E2 5 /**< @brief second level of ESC processing */ | |
70 | +#define rS 6 /**< @brief reset */ | |
71 | +#define IC 7 /**< @brief insert chars */ | |
72 | +#define DN 8 /**< @brief cursor down */ | |
73 | +#define RT 9 /**< @brief cursor right */ | |
74 | +#define LT 10 /**< @brief cursor left */ | |
75 | +#define CM 11 /**< @brief cursor motion */ | |
76 | +#define ED 12 /**< @brief erase in display */ | |
77 | +#define EL 13 /**< @brief erase in line */ | |
78 | +#define IL 14 /**< @brief insert lines */ | |
79 | +#define DL 15 /**< @brief delete lines */ | |
80 | +#define DC 16 /**< @brief delete characters */ | |
81 | +#define SG 17 /**< @brief set graphic rendition */ | |
82 | +#define BL 18 /**< @brief ring bell */ | |
83 | +#define NP 19 /**< @brief new page */ | |
84 | +#define BS 20 /**< @brief backspace */ | |
85 | +#define CR 21 /**< @brief carriage return */ | |
86 | +#define LF 22 /**< @brief line feed */ | |
87 | +#define HT 23 /**< @brief horizontal tab */ | |
88 | +#define E1 24 /**< @brief first level of ESC processing */ | |
89 | +#define Xx 25 /**< @brief undefined control character (nop) */ | |
90 | +#define Pc 26 /**< @brief printing character */ | |
91 | +#define Sc 27 /**< @brief semicolon (after ESC [) */ | |
92 | +#define Dg 28 /**< @brief digit (after ESC [ or ESC [ ?) */ | |
93 | +#define RI 29 /**< @brief reverse index */ | |
94 | +#define DA 30 /**< @brief send device attributes */ | |
95 | +#define SM 31 /**< @brief set mode */ | |
96 | +#define RM 32 /**< @brief reset mode */ | |
97 | +#define DO 33 /**< @brief return terminal ID (obsolete) */ | |
98 | +#define SR 34 /**< @brief device status report */ | |
99 | +#define CS 35 /**< @brief character set designate */ | |
100 | +#define E3 36 /**< @brief third level of ESC processing */ | |
101 | +#define DS 37 /**< @brief DEC private set */ | |
102 | +#define DR 38 /**< @brief DEC private reset */ | |
103 | +#define DV 39 /**< @brief DEC private save */ | |
104 | +#define DT 40 /**< @brief DEC private restore */ | |
105 | +#define SS 41 /**< @brief set scrolling region */ | |
106 | +#define TM 42 /**< @brief text mode (ESC ]) */ | |
107 | +#define T2 43 /**< @brief semicolon (after ESC ]) */ | |
108 | +#define TX 44 /**< @brief text parameter (after ESC ] n ;) */ | |
109 | +#define TB 45 /**< @brief text parameter done (ESC ] n ; xxx BEL) */ | |
110 | +#define TS 46 /**< @brief tab set */ | |
111 | +#define TC 47 /**< @brief tab clear */ | |
112 | +#define C2 48 /**< @brief character set designate (finish) */ | |
113 | +#define G0 49 /**< @brief select G0 character set */ | |
114 | +#define G1 50 /**< @brief select G1 character set */ | |
115 | +#define G2 51 /**< @brief select G2 character set */ | |
116 | +#define G3 52 /**< @brief select G3 character set */ | |
117 | +#define S2 53 /**< @brief select G2 for next character */ | |
118 | +#define S3 54 /**< @brief select G3 for next character */ | |
119 | +#define MB 55 /**< @brief process multi-byte character */ | |
123 | 120 | |
124 | 121 | #define DATA LIB3270_ANSI_STATE_DATA |
125 | 122 | #define ESC LIB3270_ANSI_STATE_ESC |
126 | 123 | #define CSDES LIB3270_ANSI_STATE_CSDES |
127 | 124 | #define N1 LIB3270_ANSI_STATE_N1 |
128 | 125 | #define DECP LIB3270_ANSI_STATE_DECP |
129 | -// #define TEXT LIB3270_ANSI_STATE_TEXT | |
130 | 126 | #define TEXT2 LIB3270_ANSI_STATE_TEXT2 |
131 | 127 | #define MBPEND LIB3270_ANSI_STATE_MBPEND |
132 | 128 | ... | ... |
src/lib3270/glue.c
... | ... | @@ -1,172 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | - * | |
21 | - * Este programa está nomeado como glue.c e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * licinio@bb.com.br (Licínio Luis Branco) | |
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | - * | |
30 | - */ | |
31 | - | |
32 | - | |
33 | -/* | |
34 | - * glue.c | |
35 | - * A displayless 3270 Terminal Emulator | |
36 | - * Glue for missing parts. | |
37 | - */ | |
38 | - | |
39 | - | |
40 | - | |
41 | -#include "private.h" | |
42 | - | |
43 | -#if !defined(_WIN32) /*[*/ | |
44 | - #include <sys/wait.h> | |
45 | -#else | |
46 | - #include <windows.h> | |
47 | -#endif /*]*/ | |
48 | - | |
49 | -#include <signal.h> | |
50 | -#include <errno.h> | |
51 | -#include <stdarg.h> | |
52 | - | |
53 | -#include "3270ds.h" | |
54 | -#include "resources.h" | |
55 | - | |
56 | -//#include "actionsc.h" | |
57 | -#include "ansic.h" | |
58 | -// #include "charsetc.h" | |
59 | -#include "ctlrc.h" | |
60 | -// #include "gluec.h" | |
61 | -#include "hostc.h" | |
62 | -// #include "keymapc.h" | |
63 | -#include "kybdc.h" | |
64 | -//#include "macrosc.h" | |
65 | -#include "popupsc.h" | |
66 | -#include "screenc.h" | |
67 | -// #include "selectc.h" | |
68 | -//#include "tablesc.h" | |
69 | -#include "telnetc.h" | |
70 | -#include "togglesc.h" | |
71 | -#include "trace_dsc.h" | |
72 | -#include "utilc.h" | |
73 | -// #include "idlec.h" | |
74 | -// #include "printerc.h" | |
75 | - | |
76 | -#if defined(X3270_FT) | |
77 | - #include "ftc.h" | |
78 | -#endif | |
79 | - | |
80 | -#if defined(_WIN32) /*[*/ | |
81 | -#include "winversc.h" | |
82 | -#endif /*]*/ | |
83 | - | |
84 | -// #include "session.h" | |
85 | - | |
86 | -#if defined WIN32 | |
87 | - BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd); | |
88 | -#else | |
89 | - int lib3270_loaded(void) __attribute__((constructor)); | |
90 | - int lib3270_unloaded(void) __attribute__((destructor)); | |
91 | -#endif | |
92 | - | |
93 | - #define LAST_ARG "--" | |
94 | - | |
95 | -/*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ | |
96 | - | |
97 | -/** | |
98 | - * @brief Parse an stty control-character specification; a cheap, non-complaining implementation. | |
99 | - */ | |
100 | -static char parse_ctlchar(char *s) | |
101 | -{ | |
102 | - if (!s || !*s) | |
103 | - return 0; | |
104 | - | |
105 | - if ((int) strlen(s) > 1) | |
106 | - { | |
107 | - if (*s != '^') | |
108 | - return 0; | |
109 | - else if (*(s+1) == '?') | |
110 | - return 0177; | |
111 | - else | |
112 | - return *(s+1) - '@'; | |
113 | - } else | |
114 | - return *s; | |
115 | -} | |
116 | - | |
117 | -int lib3270_loaded(void) | |
118 | -{ | |
119 | - trace("%s",__FUNCTION__); | |
120 | - | |
121 | - ansictl.vintr = parse_ctlchar("^C"); | |
122 | - ansictl.vquit = parse_ctlchar("^\\"); | |
123 | - ansictl.verase = parse_ctlchar("^H"); | |
124 | - ansictl.vkill = parse_ctlchar("^U"); | |
125 | - ansictl.veof = parse_ctlchar("^D"); | |
126 | - ansictl.vwerase = parse_ctlchar("^W"); | |
127 | - ansictl.vrprnt = parse_ctlchar("^R"); | |
128 | - ansictl.vlnext = parse_ctlchar("^V"); | |
129 | - | |
130 | - return 0; | |
131 | -} | |
132 | - | |
133 | -int lib3270_unloaded(void) | |
134 | -{ | |
135 | - trace("%s",__FUNCTION__); | |
136 | - return 0; | |
137 | -} | |
138 | - | |
139 | - | |
140 | -#if defined WIN32 | |
141 | - | |
142 | -BOOL WINAPI DllMain(HANDLE hinst unused, DWORD dwcallpurpose, LPVOID lpvResvd unused) | |
143 | -{ | |
144 | -// Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded"); | |
145 | - | |
146 | - switch(dwcallpurpose) | |
147 | - { | |
148 | - case DLL_PROCESS_ATTACH: | |
149 | - get_version_info(); | |
150 | - lib3270_loaded(); | |
151 | - break; | |
152 | - | |
153 | - case DLL_PROCESS_DETACH: | |
154 | - lib3270_unloaded(); | |
155 | - break; | |
156 | - | |
157 | - } | |
158 | - | |
159 | - return TRUE; | |
160 | -} | |
161 | - | |
162 | -#endif | |
163 | - | |
164 | - | |
165 | -#ifdef DEBUG | |
166 | -extern void lib3270_initialize(void) | |
167 | -{ | |
168 | - lib3270_loaded(); | |
169 | -} | |
170 | -#endif | |
171 | - | |
172 | - |
... | ... | @@ -0,0 +1,141 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como - e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + | |
31 | +/** | |
32 | + * @brief Init/Deinit lib3270 internals. | |
33 | + */ | |
34 | + | |
35 | +#include <config.h> | |
36 | + | |
37 | +#ifdef HAVE_LIBCURL | |
38 | + #include <curl/curl.h> | |
39 | +#endif // HAVE_LIBCURL | |
40 | + | |
41 | +#include <lib3270.h> | |
42 | + | |
43 | +#ifdef _WIN32 | |
44 | + #include <winsock2.h> | |
45 | + #include <windows.h> | |
46 | + #include "winversc.h" | |
47 | +#endif // _WIN32 | |
48 | + | |
49 | +#include <lib3270/log.h> | |
50 | +#include "private.h" | |
51 | + | |
52 | +#if defined WIN32 | |
53 | + BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd); | |
54 | +#else | |
55 | + int lib3270_loaded(void) __attribute__((constructor)); | |
56 | + int lib3270_unloaded(void) __attribute__((destructor)); | |
57 | +#endif | |
58 | + | |
59 | +/*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ | |
60 | + | |
61 | +/** | |
62 | + * @brief Parse an stty control-character specification; a cheap, non-complaining implementation. | |
63 | + */ | |
64 | +static char parse_ctlchar(char *s) | |
65 | +{ | |
66 | + if (!s || !*s) | |
67 | + return 0; | |
68 | + | |
69 | + if ((int) strlen(s) > 1) | |
70 | + { | |
71 | + if (*s != '^') | |
72 | + return 0; | |
73 | + else if (*(s+1) == '?') | |
74 | + return 0177; | |
75 | + else | |
76 | + return *(s+1) - '@'; | |
77 | + } else | |
78 | + return *s; | |
79 | +} | |
80 | + | |
81 | +int lib3270_loaded(void) | |
82 | +{ | |
83 | + trace("%s",__FUNCTION__); | |
84 | + | |
85 | + ansictl.vintr = parse_ctlchar("^C"); | |
86 | + ansictl.vquit = parse_ctlchar("^\\"); | |
87 | + ansictl.verase = parse_ctlchar("^H"); | |
88 | + ansictl.vkill = parse_ctlchar("^U"); | |
89 | + ansictl.veof = parse_ctlchar("^D"); | |
90 | + ansictl.vwerase = parse_ctlchar("^W"); | |
91 | + ansictl.vrprnt = parse_ctlchar("^R"); | |
92 | + ansictl.vlnext = parse_ctlchar("^V"); | |
93 | + | |
94 | +#ifdef HAVE_LIBCURL | |
95 | + trace("%s.curl_global_init",__FUNCTION__); | |
96 | + curl_global_init(CURL_GLOBAL_DEFAULT); | |
97 | +#endif // HAVE_LIBCURL | |
98 | + | |
99 | + return 0; | |
100 | +} | |
101 | + | |
102 | +int lib3270_unloaded(void) | |
103 | +{ | |
104 | + trace("%s",__FUNCTION__); | |
105 | + | |
106 | +#ifdef HAVE_LIBCURL | |
107 | + trace("%s.curl_global_cleanup",__FUNCTION__); | |
108 | + curl_global_cleanup(); | |
109 | +#endif // HAVE_LIBCURL | |
110 | + | |
111 | + return 0; | |
112 | +} | |
113 | + | |
114 | + | |
115 | +#if defined WIN32 | |
116 | + | |
117 | +BOOL WINAPI DllMain(HANDLE hinst unused, DWORD dwcallpurpose, LPVOID lpvResvd unused) | |
118 | +{ | |
119 | +// Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded"); | |
120 | + | |
121 | + switch(dwcallpurpose) | |
122 | + { | |
123 | + case DLL_PROCESS_ATTACH: | |
124 | + get_version_info(); | |
125 | + lib3270_loaded(); | |
126 | + break; | |
127 | + | |
128 | + case DLL_PROCESS_DETACH: | |
129 | + lib3270_unloaded(); | |
130 | + break; | |
131 | + | |
132 | + } | |
133 | + | |
134 | + return TRUE; | |
135 | +} | |
136 | + | |
137 | +#endif | |
138 | + | |
139 | + | |
140 | + | |
141 | + | ... | ... |
src/lib3270/private.h
... | ... | @@ -634,7 +634,6 @@ struct _h3270 |
634 | 634 | |
635 | 635 | /* Library internal calls */ |
636 | 636 | LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); |
637 | -LIB3270_INTERNAL void lib3270_initialize(void); | |
638 | 637 | LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); |
639 | 638 | |
640 | 639 | LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); | ... | ... |
src/lib3270/ssl/windows/getcrl.c
... | ... | @@ -31,6 +31,8 @@ |
31 | 31 | * http://www.openssl.org/docs/ssl/ |
32 | 32 | * https://stackoverflow.com/questions/4389954/does-openssl-automatically-handle-crls-certificate-revocation-lists-now |
33 | 33 | * |
34 | + * https://www.codepool.biz/build-use-libcurl-vs2015-windows.html | |
35 | + * | |
34 | 36 | */ |
35 | 37 | |
36 | 38 | #define CRL_DATA_LENGTH 4096 |
... | ... | @@ -66,8 +68,11 @@ static inline void lib3270_autoptr_cleanup_CURL(CURL **ptr) |
66 | 68 | { |
67 | 69 | debug("%s(%p)",__FUNCTION__,*ptr); |
68 | 70 | if(*ptr) |
71 | + { | |
69 | 72 | curl_easy_cleanup(*ptr); |
73 | + } | |
70 | 74 | *ptr = NULL; |
75 | + | |
71 | 76 | } |
72 | 77 | |
73 | 78 | typedef struct _curldata |
... | ... | @@ -98,17 +103,26 @@ static size_t internal_curl_write_callback(void *contents, size_t size, size_t n |
98 | 103 | CURLDATA * data = (CURLDATA *) userp; |
99 | 104 | |
100 | 105 | size_t realsize = size * nmemb; |
106 | + size_t ix; | |
107 | + | |
108 | + debug("Received %u bytes (datablock is %p)", (unsigned int) realsize, data); | |
109 | + | |
110 | + unsigned char *ptr = (unsigned char *) contents; | |
111 | + | |
112 | + debug("\n------------------------------------\n%s\n", ptr); | |
101 | 113 | |
102 | - if((size + data->length) > CRL_DATA_LENGTH) | |
114 | + for(ix = 0; ix < realsize; ix++) | |
103 | 115 | { |
104 | - debug("CRL Data block is bigger than allocated block (%u bytes)",(unsigned int) size); | |
105 | - return 0; | |
106 | - } | |
116 | + if(data->length >= CRL_DATA_LENGTH) | |
117 | + { | |
118 | + lib3270_write_log(NULL,"ssl","CRL Data block is bigger than allocated block (%u)", (unsigned int) CRL_DATA_LENGTH); | |
119 | + return 0; | |
120 | + } | |
107 | 121 | |
108 | - debug("Received %u bytes", (unsigned int) realsize); | |
122 | + data->contents[data->length++] = *(ptr++); | |
123 | + } | |
109 | 124 | |
110 | - memcpy(&(data->contents[data->length]),contents,realsize); | |
111 | - data->length += realsize; | |
125 | + debug("\n%s\n-------------------------------------------", data->contents); | |
112 | 126 | |
113 | 127 | return realsize; |
114 | 128 | } |
... | ... | @@ -158,11 +172,15 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) |
158 | 172 | |
159 | 173 | // Use CURL to download the CRL |
160 | 174 | lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA)); |
175 | + | |
176 | + // Initialize curl and curl_easy | |
161 | 177 | lib3270_autoptr(CURL) hCurl = curl_easy_init(); |
162 | 178 | |
163 | 179 | memset(crl_data,0,sizeof(CURLDATA)); |
164 | 180 | crl_data->message = message; |
165 | 181 | |
182 | + debug("datablock is %p",crl_data); | |
183 | + | |
166 | 184 | if(hCurl) |
167 | 185 | { |
168 | 186 | CURLcode res; | ... | ... |