Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
0320-Return-error-if-ssl-is-not-started.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0320-Return-error-if-ssl-is-not-started.patch of Package erlang
From 6d379cf352c7a439f52c7f12fc1af57d0134b22b Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson <dgud@erlang.org> Date: Thu, 25 May 2023 14:20:44 +0200 Subject: [PATCH] Return error if ssl is not started It hanged since the supervisor re-write, need to catch errors when use spawn on the startup function. Fixes #7297 --- lib/ssl/src/tls_gen_connection.erl | 7 ++++++- lib/ssl/test/ssl_api_SUITE.erl | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/ssl/src/tls_gen_connection.erl b/lib/ssl/src/tls_gen_connection.erl index 940666f104..55b10472a6 100644 --- a/lib/ssl/src/tls_gen_connection.erl +++ b/lib/ssl/src/tls_gen_connection.erl @@ -101,7 +101,7 @@ handle_sender_options(ErlDist, SpawnOpts) -> start_connection_tree(User, IsErlDist, SenderOpts, Role, ReceiverOpts) -> StartConnectionTree = fun() -> - case start_dyn_connection_sup(IsErlDist) of + try start_dyn_connection_sup(IsErlDist) of {ok, DynSup} -> case tls_dyn_connection_sup:start_child(DynSup, sender, SenderOpts) of {ok, Sender} -> @@ -119,6 +119,11 @@ start_connection_tree(User, IsErlDist, SenderOpts, Role, ReceiverOpts) -> end; {error, Error} -> User ! {self(), Error} + catch exit:{noproc, _} -> + User ! {self(), {error, ssl_not_started}}; + _:Reason:ST -> %% Don't hang signal internal error + ?SSL_LOG(notice, internal_error, [{error, Reason}, {stacktrace, ST}]), + User ! {self(), {error, internal_error}} end end, spawn(StartConnectionTree). diff --git a/lib/ssl/test/ssl_api_SUITE.erl b/lib/ssl/test/ssl_api_SUITE.erl index fc56323afd..eff6a01ef2 100644 --- a/lib/ssl/test/ssl_api_SUITE.erl +++ b/lib/ssl/test/ssl_api_SUITE.erl @@ -177,6 +177,8 @@ server_options_negative_dependency_role/1, invalid_options_tls13/0, invalid_options_tls13/1, + ssl_not_started/0, + ssl_not_started/1, cookie/0, cookie/1, warn_verify_none/0, @@ -315,6 +317,7 @@ gen_api_tests() -> options_not_proplist, invalid_options, cb_info, + ssl_not_started, log_alert, getstat, warn_verify_none, @@ -2638,6 +2641,23 @@ invalid_options_tls13(Config) when is_list(Config) -> end, [Fun(Option, ErrorMsg, Type) || {Option, ErrorMsg, Type} <- TestOpts]. + +ssl_not_started() -> + [{doc, "Test that an error is returned if ssl is not started"}]. +ssl_not_started(Config) when is_list(Config) -> + application:stop(ssl), + Protocol = proplists:get_value(protocol, Config, tls), + Version = proplists:get_value(version, Config), + Opts = [{verify, verify_none}, + {versions, [Version]}, + {protocol, Protocol}], + try + {error, ssl_not_started} = ssl:connect("localhost", 22, Opts) + after + ssl:start() + end, + ok. + cookie() -> [{doc, "Test cookie extension in TLS 1.3"}]. cookie(Config) when is_list(Config) -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor