Commit a43ac115efcfbd0c350107de1bf4ebf0305c77d6
Committed by
GitHub
Exists in
master
and in
1 other branch
Merge pull request #34 from PerryWerneck/develop
Updating to latest code.
Showing
18 changed files
with
251 additions
and
168 deletions
Show diff stats
README.md
| ... | ... | @@ -182,7 +182,7 @@ Using jhbuild |
| 182 | 182 | 2. build |
| 183 | 183 | |
| 184 | 184 | ```shell |
| 185 | - jhbuild --moduleset=https://raw.githubusercontent.com/PerryWerneck/lib3270/macos/mac/lib3270.modules build lib3270 | |
| 185 | + jhbuild --moduleset=https://raw.githubusercontent.com/PerryWerneck/lib3270/master/mac/lib3270.modules build lib3270 | |
| 186 | 186 | ``` |
| 187 | 187 | |
| 188 | 188 | ... | ... |
arch/PKGBUILD
| ... | ... | @@ -9,7 +9,7 @@ url="https://github.com/PerryWerneck/lib3270" |
| 9 | 9 | arch=(i686 x86_64) |
| 10 | 10 | license=(GPL) |
| 11 | 11 | depends=() |
| 12 | -makedepends=(autoconf automake make openssl libtool) | |
| 12 | +makedepends=(autoconf automake make openssl libtool gzip) | |
| 13 | 13 | checkdepends=() |
| 14 | 14 | |
| 15 | 15 | #groups=(gnome) | ... | ... |
configure.ac
| ... | ... | @@ -143,6 +143,9 @@ case "$host" in |
| 143 | 143 | |
| 144 | 144 | app_cv_static='no' |
| 145 | 145 | |
| 146 | + AC_CONFIG_FILES(debian/control) | |
| 147 | + AC_CONFIG_FILES(debian/shlibs) | |
| 148 | + | |
| 146 | 149 | esac |
| 147 | 150 | |
| 148 | 151 | AC_SUBST(OSNAME,$app_cv_osname) |
| ... | ... | @@ -388,6 +391,8 @@ dnl --------------------------------------------------------------------------- |
| 388 | 391 | dnl SSL Security options |
| 389 | 392 | dnl --------------------------------------------------------------------------- |
| 390 | 393 | |
| 394 | +AC_CHECK_HEADER(openssl/fips.h, AC_DEFINE(HAVE_FIPS_H, 1, [FIPS Header is available]), AC_MSG_NOTICE(fips.h is not available)) | |
| 395 | + | |
| 391 | 396 | AC_ARG_ENABLE([self-signed-cert-check], |
| 392 | 397 | [AS_HELP_STRING([--enable-self-signed-cert-check], [Emit Warning when host presents a self signed certificate])], |
| 393 | 398 | [ | ... | ... |
debian/control
| ... | ... | @@ -8,7 +8,7 @@ Package: lib3270 |
| 8 | 8 | Architecture: any |
| 9 | 9 | Section: libs |
| 10 | 10 | Depends: ${misc:Depends}, ${shlibs:Depends} |
| 11 | -Provides: lib3270 (= ${binary:Version}) | |
| 11 | +Provides: lib3270 (= ${binary:Version}), lib3270 (= 5.4) | |
| 12 | 12 | Description: TN3270 Access library. |
| 13 | 13 | TN3270 access library originally designed as part of the pw3270 application. |
| 14 | 14 | ... | ... |
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +Source: lib3270 | |
| 2 | +Section: unknown | |
| 3 | +Priority: optional | |
| 4 | +Maintainer: Perry Werneck <perry.werneck@gmail.com> | |
| 5 | +Build-Depends: debhelper (>= 7), autotools-dev, autoconf, automake, pkg-config, gettext, libssl-dev, libcurl4-openssl-dev | |
| 6 | + | |
| 7 | +Package: lib3270 | |
| 8 | +Architecture: any | |
| 9 | +Section: libs | |
| 10 | +Depends: ${misc:Depends}, ${shlibs:Depends} | |
| 11 | +Provides: lib3270 (= ${binary:Version}), @PACKAGE_NAME@ (= @PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@) | |
| 12 | +Description: TN3270 Access library. | |
| 13 | + TN3270 access library originally designed as part of the pw3270 application. | |
| 14 | + | |
| 15 | +Package: lib3270-dev | |
| 16 | +Architecture: any | |
| 17 | +Provides: lib3270-dev (= ${binary:Version}) | |
| 18 | +Section: libdevel | |
| 19 | +Depends: ${misc:Depends}, pkg-config, lib3270 (= ${binary:Version}) | |
| 20 | +Description: TN3270 Access library development files. | |
| 21 | + TN3270 access library originally designed as part of the pw3270 application. | |
| 22 | + | |
| 23 | +Package: lib3270-dbg | |
| 24 | +Architecture: any | |
| 25 | +Depends: lib3270 (= ${binary:Version}) | |
| 26 | +Description: Debugging symbols for lib3270 | |
| 27 | + This package contains the debugging symbols for lib3270. | |
| 28 | + | ... | ... |
rpm/_service
| ... | ... | @@ -31,11 +31,11 @@ |
| 31 | 31 | <param name="files">*/debian/*.dsc</param> |
| 32 | 32 | </service> |
| 33 | 33 | |
| 34 | - <service name="extract_file"> | |
| 34 | + <!-- service name="extract_file"> | |
| 35 | 35 | <param name="archive">*.tar</param> |
| 36 | 36 | <param name="files">*/debian/control</param> |
| 37 | 37 | <param name="outfilename">debian.control</param> |
| 38 | - </service> | |
| 38 | + </service --> | |
| 39 | 39 | |
| 40 | 40 | <!-- service name="extract_file"> |
| 41 | 41 | <param name="archive">*.tar</param> | ... | ... |
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
| 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 host.c e possui 1078 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) |
| 26 | 24 | * 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 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | |
| 30 | 25 | * |
| 31 | 26 | */ |
| 32 | 27 | |
| 33 | - | |
| 34 | 28 | /** |
| 35 | 29 | * @brief Handle connect and disconnect from hosts, and state changes on the host connection. |
| 36 | 30 | */ |
| ... | ... | @@ -306,7 +300,7 @@ LIB3270_EXPORT const char * lib3270_get_url(const H3270 *hSession) { |
| 306 | 300 | LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 GNUC_UNUSED(*hSession)) { |
| 307 | 301 | #ifdef _WIN32 |
| 308 | 302 | { |
| 309 | - lib3270_auto_cleanup(HKEY) hKey; | |
| 303 | + lib3270_auto_cleanup(HKEY) hKey = 0; | |
| 310 | 304 | DWORD disp = 0; |
| 311 | 305 | LSTATUS rc = RegCreateKeyEx( |
| 312 | 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/linkedlist.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 linkedlist.c 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 Handle linked lists. |
| 33 | 30 | */ |
| ... | ... | @@ -36,6 +33,7 @@ |
| 36 | 33 | #include <lib3270/log.h> |
| 37 | 34 | #include <linkedlist.h> |
| 38 | 35 | #include <string.h> |
| 36 | +#include <errno.h> | |
| 39 | 37 | |
| 40 | 38 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
| 41 | 39 | ... | ... |
src/core/session.c
| ... | ... | @@ -17,6 +17,14 @@ |
| 17 | 17 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | +/* | |
| 21 | + * Contatos: | |
| 22 | + * | |
| 23 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 24 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 20 | 28 | #ifndef ANDROID |
| 21 | 29 | #include <stdlib.h> |
| 22 | 30 | #endif // !ANDROID |
| ... | ... | @@ -99,7 +107,7 @@ void lib3270_session_free(H3270 *h) { |
| 99 | 107 | |
| 100 | 108 | |
| 101 | 109 | // Release memory |
| 102 | -#define release_pointer(x) lib3270_free(x); x = NULL; | |
| 110 | + #define release_pointer(x) lib3270_free(x); x = NULL; | |
| 103 | 111 | |
| 104 | 112 | // release_pointer(h->charset.display); |
| 105 | 113 | release_pointer(h->paste_buffer); |
| ... | ... | @@ -151,43 +159,6 @@ static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(* |
| 151 | 159 | return errno = ENOENT; |
| 152 | 160 | } |
| 153 | 161 | |
| 154 | - | |
| 155 | -/* | |
| 156 | -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)) { | |
| 157 | -} | |
| 158 | - | |
| 159 | -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)) { | |
| 160 | -} | |
| 161 | - | |
| 162 | -static void changed(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(bstart), int GNUC_UNUSED(bend)) { | |
| 163 | -} | |
| 164 | - | |
| 165 | -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)) { | |
| 166 | -} | |
| 167 | - | |
| 168 | -static void update_oia(H3270 GNUC_UNUSED(*session), LIB3270_FLAG GNUC_UNUSED(id), unsigned char GNUC_UNUSED(on)) { | |
| 169 | -} | |
| 170 | - | |
| 171 | -static void update_selection(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(start), int GNUC_UNUSED(end)) { | |
| 172 | -} | |
| 173 | - | |
| 174 | -static void set_cursor(H3270 GNUC_UNUSED(*session), LIB3270_POINTER GNUC_UNUSED(id)) { | |
| 175 | -} | |
| 176 | - | |
| 177 | -static void update_ssl(H3270 GNUC_UNUSED(*session), LIB3270_SSL_STATE GNUC_UNUSED(state)) { | |
| 178 | -} | |
| 179 | - | |
| 180 | -static void set_timer(H3270 GNUC_UNUSED(*session), unsigned char GNUC_UNUSED(on)) { | |
| 181 | -} | |
| 182 | - | |
| 183 | -static void default_update_luname(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*name)) { | |
| 184 | -} | |
| 185 | - | |
| 186 | -static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*url)) { | |
| 187 | -} | |
| 188 | - | |
| 189 | -*/ | |
| 190 | - | |
| 191 | 162 | static int print(H3270 *session, LIB3270_CONTENT_OPTION GNUC_UNUSED(mode)) { |
| 192 | 163 | lib3270_write_log(session, "print", "%s", "Printing is unavailable"); |
| 193 | 164 | lib3270_popup_dialog(session, LIB3270_NOTIFY_WARNING, _( "Can't print" ), _( "Unable to print" ), "%s", strerror(ENOTSUP)); | ... | ... |
src/core/windows/registry.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 | |
| 5 | - * o nome G3270. | |
| 6 | - * | |
| 7 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 8 | - * | |
| 9 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 10 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 11 | - * Free Software Foundation. | |
| 12 | - * | |
| 13 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 14 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 15 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 16 | - * obter mais detalhes. | |
| 4 | + * Copyright (C) 2008 Banco do Brasil S.A. | |
| 17 | 5 | * |
| 18 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 19 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
| 20 | - * 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. | |
| 21 | 10 | * |
| 22 | - * 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. | |
| 23 | 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 | +/* | |
| 24 | 21 | * Contatos: |
| 25 | 22 | * |
| 26 | 23 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ... | ... |
src/include/config.h.in
src/include/windows/lib3270/win32.h
| 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. | |
| 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 lib3270.h 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) |
| ... | ... | @@ -28,7 +26,7 @@ |
| 28 | 26 | */ |
| 29 | 27 | |
| 30 | 28 | /** |
| 31 | - * @brief TN3270 API windows definitions. | |
| 29 | + * @brief TN3270 WIN32 API definitions. | |
| 32 | 30 | * |
| 33 | 31 | * @author perry.werneck@gmail.com |
| 34 | 32 | * | ... | ... |
src/network_modules/openssl/context.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. | |
| 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) |
| 26 | 24 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
| 27 | 25 | * |
| 28 | - * | |
| 29 | 26 | * References: |
| 30 | 27 | * |
| 31 | 28 | * http://www.openssl.org/docs/ssl/ |
| ... | ... | @@ -37,15 +34,22 @@ |
| 37 | 34 | * @brief OpenSSL initialization for linux. |
| 38 | 35 | */ |
| 39 | 36 | |
| 40 | -#include "private.h" | |
| 41 | - | |
| 37 | +#include <config.h> | |
| 42 | 38 | #ifdef _WIN32 |
| 43 | -#include <lib3270/win32.h> | |
| 39 | + #include <winsock2.h> | |
| 40 | + #include <windows.h> | |
| 41 | + #include <lib3270/win32.h> | |
| 44 | 42 | #endif // _WIN32 |
| 45 | 43 | |
| 44 | +#include "private.h" | |
| 45 | + | |
| 46 | 46 | #include <openssl/err.h> |
| 47 | 47 | #include <openssl/x509_vfy.h> |
| 48 | 48 | |
| 49 | +#ifdef HAVE_FIPS_H | |
| 50 | + #include <openssl/fips.h> | |
| 51 | +#endif // HAVE_FIPS_H | |
| 52 | + | |
| 49 | 53 | #ifndef SSL_ST_OK |
| 50 | 54 | #define SSL_ST_OK 3 |
| 51 | 55 | #endif // !SSL_ST_OK |
| ... | ... | @@ -151,9 +155,81 @@ SSL_CTX * lib3270_openssl_get_context(H3270 *hSession) { |
| 151 | 155 | if(context) |
| 152 | 156 | return context; |
| 153 | 157 | |
| 154 | - trace_ssl(hSession,"Initializing SSL context.\n"); | |
| 155 | - | |
| 156 | 158 | SSL_load_error_strings(); |
| 159 | + | |
| 160 | +#if !defined(OPENSSL_FIPS) | |
| 161 | + | |
| 162 | + lib3270_write_log( | |
| 163 | + hSession, | |
| 164 | + "openssl", | |
| 165 | + "Initializing %s\n", | |
| 166 | + SSLeay_version(SSLEAY_VERSION) | |
| 167 | + ); | |
| 168 | + | |
| 169 | +#elif defined(_WIN32) | |
| 170 | + { | |
| 171 | + lib3270_auto_cleanup(HKEY) hKey = 0; | |
| 172 | + DWORD disp = 0; | |
| 173 | + LSTATUS rc = RegCreateKeyEx( | |
| 174 | + HKEY_LOCAL_MACHINE, | |
| 175 | + "Software\\" LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME) "\\tweaks", | |
| 176 | + 0, | |
| 177 | + NULL, | |
| 178 | + REG_OPTION_NON_VOLATILE, | |
| 179 | + KEY_QUERY_VALUE|KEY_READ, | |
| 180 | + NULL, | |
| 181 | + &hKey, | |
| 182 | + &disp); | |
| 183 | + | |
| 184 | + if(rc == ERROR_SUCCESS) { | |
| 185 | + DWORD mode = lib3270_win32_get_dword(hKey, "fips_mode", FIPS_mode()); | |
| 186 | + if(FIPS_mode_set(mode) != 1) { | |
| 187 | + | |
| 188 | + SSL_load_error_strings(); | |
| 189 | + | |
| 190 | + char err_buff[1024]; | |
| 191 | + memset(err_buff,0,sizeof(err_buff)); | |
| 192 | + (void) ERR_error_string_n(ERR_get_error(), err_buff, 1023); | |
| 193 | + | |
| 194 | + lib3270_write_log( | |
| 195 | + hSession, | |
| 196 | + "openssl", | |
| 197 | + "Cant set FIPS mode to %u: %s\n", | |
| 198 | + (unsigned int) mode, | |
| 199 | + err_buff | |
| 200 | + ); | |
| 201 | + | |
| 202 | + } else { | |
| 203 | + lib3270_write_log( | |
| 204 | + hSession, | |
| 205 | + "openssl", | |
| 206 | + "FIPS mode set to %u\n", | |
| 207 | + (unsigned int) mode | |
| 208 | + ); | |
| 209 | + } | |
| 210 | + } | |
| 211 | + | |
| 212 | + lib3270_write_log( | |
| 213 | + hSession, | |
| 214 | + "openssl", | |
| 215 | + "Initializing windows %s using fips mode %u.\n", | |
| 216 | + SSLeay_version(SSLEAY_VERSION), | |
| 217 | + FIPS_mode() | |
| 218 | + ); | |
| 219 | + | |
| 220 | + } | |
| 221 | +#else | |
| 222 | + | |
| 223 | + lib3270_write_log( | |
| 224 | + hSession, | |
| 225 | + "openssl", | |
| 226 | + "Initializing %s %s FIPS.\n", | |
| 227 | + SSLeay_version(SSLEAY_VERSION), | |
| 228 | + (FIPS_mode() ? "with" : "without" ) | |
| 229 | + ); | |
| 230 | + | |
| 231 | +#endif | |
| 232 | + | |
| 157 | 233 | SSL_library_init(); |
| 158 | 234 | |
| 159 | 235 | context = SSL_CTX_new(SSLv23_method()); | ... | ... |
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. | ... | ... |
src/testprogram/testprogram.c
| ... | ... | @@ -41,9 +41,14 @@ |
| 41 | 41 | #include <lib3270/log.h> |
| 42 | 42 | #include <lib3270/properties.h> |
| 43 | 43 | #include <lib3270/charset.h> |
| 44 | +#include <stdio.h> | |
| 45 | + | |
| 46 | +#ifdef HAVE_FIPS_H | |
| 47 | + #include <openssl/fips.h> | |
| 48 | +#endif // HAVE_FIPS_H | |
| 44 | 49 | |
| 45 | 50 | #ifdef _WIN32 |
| 46 | -#include <lib3270/win32.h> | |
| 51 | + #include <lib3270/win32.h> | |
| 47 | 52 | #endif // _WIN32 |
| 48 | 53 | |
| 49 | 54 | #define MAX_ARGS 10 | ... | ... |