Commit a1d7eb31d62e38e8feca3e66cf65cc9411e97915
1 parent
b4495b17
Exists in
master
and in
1 other branch
Working on 'FIPs' tweak.
Showing
6 changed files
with
48 additions
and
63 deletions
Show diff stats
src/core/connect.c
... | ... | @@ -134,6 +134,9 @@ void lib3270_notify_tls(H3270 *hSession) { |
134 | 134 | } |
135 | 135 | |
136 | 136 | int lib3270_start_tls(H3270 *hSession) { |
137 | + | |
138 | + debug("%s",__FUNCTION__); | |
139 | + | |
137 | 140 | hSession->ssl.message = NULL; // Reset message. |
138 | 141 | set_ssl_state(hSession,LIB3270_SSL_NEGOTIATING); |
139 | 142 | ... | ... |
src/core/host.c
... | ... | @@ -300,7 +300,7 @@ LIB3270_EXPORT const char * lib3270_get_url(const H3270 *hSession) { |
300 | 300 | LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 GNUC_UNUSED(*hSession)) { |
301 | 301 | #ifdef _WIN32 |
302 | 302 | { |
303 | - lib3270_auto_cleanup(HKEY) hKey; | |
303 | + lib3270_auto_cleanup(HKEY) hKey = 0; | |
304 | 304 | DWORD disp = 0; |
305 | 305 | LSTATUS rc = RegCreateKeyEx( |
306 | 306 | HKEY_LOCAL_MACHINE, | ... | ... |
src/core/init.c
1 | +/* SPDX-License-Identifier: LGPL-3.0-or-later */ | |
2 | + | |
1 | 3 | /* |
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. | |
4 | + * Copyright (C) 2008 Banco do Brasil S.A. | |
16 | 5 | * |
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 | |
6 | + * This program is free software: you can redistribute it and/or modify | |
7 | + * it under the terms of the GNU Lesser General Public License as published | |
8 | + * by the Free Software Foundation, either version 3 of the License, or | |
9 | + * (at your option) any later version. | |
20 | 10 | * |
21 | - * Este programa está nomeado como - e possui - linhas de código. | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
22 | 15 | * |
16 | + * You should have received a copy of the GNU Lesser General Public License | |
17 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
18 | + */ | |
19 | + | |
20 | +/* | |
23 | 21 | * Contatos: |
24 | 22 | * |
25 | 23 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) |
... | ... | @@ -27,7 +25,6 @@ |
27 | 25 | * |
28 | 26 | */ |
29 | 27 | |
30 | - | |
31 | 28 | /** |
32 | 29 | * @brief Init/Deinit lib3270 internals. |
33 | 30 | */ | ... | ... |
src/core/session.c
... | ... | @@ -107,7 +107,7 @@ void lib3270_session_free(H3270 *h) { |
107 | 107 | |
108 | 108 | |
109 | 109 | // Release memory |
110 | -#define release_pointer(x) lib3270_free(x); x = NULL; | |
110 | + #define release_pointer(x) lib3270_free(x); x = NULL; | |
111 | 111 | |
112 | 112 | // release_pointer(h->charset.display); |
113 | 113 | release_pointer(h->paste_buffer); |
... | ... | @@ -159,43 +159,6 @@ static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(* |
159 | 159 | return errno = ENOENT; |
160 | 160 | } |
161 | 161 | |
162 | - | |
163 | -/* | |
164 | -static void update_char(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(addr), unsigned char GNUC_UNUSED(chr), unsigned short GNUC_UNUSED(attr), unsigned char GNUC_UNUSED(cursor)) { | |
165 | -} | |
166 | - | |
167 | -static void update_model(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*name), int GNUC_UNUSED(model), int GNUC_UNUSED(rows), int GNUC_UNUSED(cols)) { | |
168 | -} | |
169 | - | |
170 | -static void changed(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(bstart), int GNUC_UNUSED(bend)) { | |
171 | -} | |
172 | - | |
173 | -static void update_cursor(H3270 GNUC_UNUSED(*session), unsigned short GNUC_UNUSED(row), unsigned short GNUC_UNUSED(col), unsigned char GNUC_UNUSED(c), unsigned short GNUC_UNUSED(attr)) { | |
174 | -} | |
175 | - | |
176 | -static void update_oia(H3270 GNUC_UNUSED(*session), LIB3270_FLAG GNUC_UNUSED(id), unsigned char GNUC_UNUSED(on)) { | |
177 | -} | |
178 | - | |
179 | -static void update_selection(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(start), int GNUC_UNUSED(end)) { | |
180 | -} | |
181 | - | |
182 | -static void set_cursor(H3270 GNUC_UNUSED(*session), LIB3270_POINTER GNUC_UNUSED(id)) { | |
183 | -} | |
184 | - | |
185 | -static void update_ssl(H3270 GNUC_UNUSED(*session), LIB3270_SSL_STATE GNUC_UNUSED(state)) { | |
186 | -} | |
187 | - | |
188 | -static void set_timer(H3270 GNUC_UNUSED(*session), unsigned char GNUC_UNUSED(on)) { | |
189 | -} | |
190 | - | |
191 | -static void default_update_luname(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*name)) { | |
192 | -} | |
193 | - | |
194 | -static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*url)) { | |
195 | -} | |
196 | - | |
197 | -*/ | |
198 | - | |
199 | 162 | static int print(H3270 *session, LIB3270_CONTENT_OPTION GNUC_UNUSED(mode)) { |
200 | 163 | lib3270_write_log(session, "print", "%s", "Printing is unavailable"); |
201 | 164 | lib3270_popup_dialog(session, LIB3270_NOTIFY_WARNING, _( "Can't print" ), _( "Unable to print" ), "%s", strerror(ENOTSUP)); | ... | ... |
src/network_modules/openssl/context.c
... | ... | @@ -166,7 +166,7 @@ SSL_CTX * lib3270_openssl_get_context(H3270 *hSession) { |
166 | 166 | |
167 | 167 | #elif defined(_WIN32) |
168 | 168 | { |
169 | - lib3270_auto_cleanup(HKEY) hKey; | |
169 | + lib3270_auto_cleanup(HKEY) hKey = 0; | |
170 | 170 | DWORD disp = 0; |
171 | 171 | LSTATUS rc = RegCreateKeyEx( |
172 | 172 | HKEY_LOCAL_MACHINE, |
... | ... | @@ -180,15 +180,28 @@ SSL_CTX * lib3270_openssl_get_context(H3270 *hSession) { |
180 | 180 | &disp); |
181 | 181 | |
182 | 182 | if(rc == ERROR_SUCCESS) { |
183 | - FIPS_mode_set(lib3270_win32_get_dword(hKey, "fips_mode", 1)); | |
183 | + DWORD mode = lib3270_win32_get_dword(hKey, "fips_mode", FIPS_mode()); | |
184 | + if(FIPS_mode_set(mode) != 1) { | |
185 | + char err_buff[1024]; | |
186 | + memset(err_buff,0,sizeof(err_buff)); | |
187 | + (void) ERR_error_string_n(ERR_get_error(), err_buff, 1023); | |
188 | + | |
189 | + lib3270_write_log( | |
190 | + hSession, | |
191 | + "openssl", | |
192 | + "Cant set FIPS mode to %u: %s\n", | |
193 | + (unsigned int) mode, | |
194 | + err_buff | |
195 | + ); | |
196 | + } | |
184 | 197 | } |
185 | 198 | |
186 | 199 | lib3270_write_log( |
187 | 200 | hSession, |
188 | 201 | "openssl", |
189 | - "Initializing %s %s FIPS.\n", | |
202 | + "Initializing windows %s using fips mode %u.\n", | |
190 | 203 | SSLeay_version(SSLEAY_VERSION), |
191 | - (FIPS_mode() ? "with" : "without" ) | |
204 | + FIPS_mode() | |
192 | 205 | ); |
193 | 206 | |
194 | 207 | } |
... | ... | @@ -204,6 +217,8 @@ SSL_CTX * lib3270_openssl_get_context(H3270 *hSession) { |
204 | 217 | |
205 | 218 | #endif |
206 | 219 | |
220 | + exit(-1); | |
221 | + | |
207 | 222 | context = SSL_CTX_new(SSLv23_method()); |
208 | 223 | if(context == NULL) { |
209 | 224 | static const LIB3270_SSL_MESSAGE message = { | ... | ... |
src/network_modules/openssl/main.c
... | ... | @@ -264,6 +264,8 @@ static char * openssl_network_getcrl(const H3270 *hSession) { |
264 | 264 | |
265 | 265 | static int openssl_network_init(H3270 *hSession) { |
266 | 266 | |
267 | + debug("%s",__FUNCTION__); | |
268 | + | |
267 | 269 | set_ssl_state(hSession,LIB3270_SSL_UNDEFINED); |
268 | 270 | |
269 | 271 | SSL_CTX * ctx_context = (SSL_CTX *) lib3270_openssl_get_context(hSession); |
... | ... | @@ -349,7 +351,12 @@ void lib3270_set_libssl_network_module(H3270 *hSession) { |
349 | 351 | .reset = openssl_network_reset |
350 | 352 | }; |
351 | 353 | |
352 | - debug("%s",__FUNCTION__); | |
354 | + if(hSession->network.module == &module) { | |
355 | + debug("%s - Network module is already set",__FUNCTION__); | |
356 | + return; | |
357 | + } | |
358 | + | |
359 | + debug("%s - Setting network module",__FUNCTION__); | |
353 | 360 | |
354 | 361 | if(hSession->network.context) { |
355 | 362 | // Has context, finalize it. | ... | ... |