Commit 67b6a41151bbd479cc299da985b61c153fee0302
1 parent
6b03fca4
Exists in
develop
Setting state on unexpected exit during the build of ssl_context.
Showing
1 changed file
with
24 additions
and
26 deletions
Show diff stats
src/network_modules/openssl/start.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 ', 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 openssl.c e possui - linhas de código. | 4 | + * Copyright (C) 2008 Banco do Brasil S.A. |
22 | * | 5 | * |
23 | - * Contatos: | 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. | ||
24 | * | 10 | * |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | 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. | ||
27 | * | 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/>. | ||
28 | */ | 18 | */ |
29 | 19 | ||
30 | /** | 20 | /** |
@@ -199,8 +189,17 @@ int x509_store_ctx_error_callback(int ok, X509_STORE_CTX GNUC_UNUSED(*ctx)) { | @@ -199,8 +189,17 @@ int x509_store_ctx_error_callback(int ok, X509_STORE_CTX GNUC_UNUSED(*ctx)) { | ||
199 | int openssl_network_start_tls(H3270 *hSession) { | 189 | int openssl_network_start_tls(H3270 *hSession) { |
200 | 190 | ||
201 | SSL_CTX * ctx_context = (SSL_CTX *) lib3270_openssl_get_context(hSession); | 191 | SSL_CTX * ctx_context = (SSL_CTX *) lib3270_openssl_get_context(hSession); |
202 | - if(!ctx_context) | 192 | + if(!ctx_context) { |
193 | + | ||
194 | + if(!hSession->ssl.message) { | ||
195 | + static const LIB3270_SSL_MESSAGE message = { | ||
196 | + .type = LIB3270_NOTIFY_SECURE, | ||
197 | + .summary = N_( "Cant get SSL context for current connection." ) | ||
198 | + }; | ||
199 | + hSession->ssl.message = &message; | ||
200 | + } | ||
203 | return -1; | 201 | return -1; |
202 | + } | ||
204 | 203 | ||
205 | LIB3270_NET_CONTEXT * context = hSession->network.context; | 204 | LIB3270_NET_CONTEXT * context = hSession->network.context; |
206 | 205 | ||
@@ -212,7 +211,6 @@ int openssl_network_start_tls(H3270 *hSession) { | @@ -212,7 +211,6 @@ int openssl_network_start_tls(H3270 *hSession) { | ||
212 | .type = LIB3270_NOTIFY_SECURE, | 211 | .type = LIB3270_NOTIFY_SECURE, |
213 | .summary = N_( "Cant create a new SSL structure for current connection." ) | 212 | .summary = N_( "Cant create a new SSL structure for current connection." ) |
214 | }; | 213 | }; |
215 | - | ||
216 | hSession->ssl.message = &message; | 214 | hSession->ssl.message = &message; |
217 | return -1; | 215 | return -1; |
218 | } | 216 | } |
@@ -241,6 +239,7 @@ int openssl_network_start_tls(H3270 *hSession) { | @@ -241,6 +239,7 @@ int openssl_network_start_tls(H3270 *hSession) { | ||
241 | trace_ssl(hSession, "SSL_connect exits with rc=%d\n",rv); | 239 | trace_ssl(hSession, "SSL_connect exits with rc=%d\n",rv); |
242 | 240 | ||
243 | if (rv != 1) { | 241 | if (rv != 1) { |
242 | + | ||
244 | LIB3270_SSL_MESSAGE message = { | 243 | LIB3270_SSL_MESSAGE message = { |
245 | .type = LIB3270_NOTIFY_ERROR, | 244 | .type = LIB3270_NOTIFY_ERROR, |
246 | .title = N_( "Connection failed" ), | 245 | .title = N_( "Connection failed" ), |
@@ -313,7 +312,6 @@ int openssl_network_start_tls(H3270 *hSession) { | @@ -313,7 +312,6 @@ int openssl_network_start_tls(H3270 *hSession) { | ||
313 | 312 | ||
314 | // CRL download is enabled and verification has failed; look for CRL file. | 313 | // CRL download is enabled and verification has failed; look for CRL file. |
315 | 314 | ||
316 | - | ||
317 | trace_ssl(hSession,"CRL Validation has failed, requesting CRL download\n"); | 315 | trace_ssl(hSession,"CRL Validation has failed, requesting CRL download\n"); |
318 | set_ssl_state(hSession,LIB3270_SSL_VERIFYING); | 316 | set_ssl_state(hSession,LIB3270_SSL_VERIFYING); |
319 | 317 |