Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0699-ssl-Fix-testcase.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0699-ssl-Fix-testcase.patch of Package erlang
From d68ff2536b82662bd4fc9936e7d52a39c326be69 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson <dgud@erlang.org> Date: Wed, 6 Oct 2021 17:08:27 +0200 Subject: [PATCH] ssl: Fix testcase Test what it is documented to test. --- lib/ssl/test/ssl_session_SUITE.erl | 59 +++++++++++++++--------------- lib/ssl/test/ssl_test_lib.erl | 25 ++++++++----- 2 files changed, 46 insertions(+), 38 deletions(-) diff --git a/lib/ssl/test/ssl_session_SUITE.erl b/lib/ssl/test/ssl_session_SUITE.erl index 8f2be84a84..c74052f6b4 100644 --- a/lib/ssl/test/ssl_session_SUITE.erl +++ b/lib/ssl/test/ssl_session_SUITE.erl @@ -159,6 +159,7 @@ init_per_testcase(server_max_session_table, Config) -> ct:timetrap({seconds, 30}), Config; init_per_testcase(_, Config) -> + ct:timetrap({seconds, 30}), Config. end_per_testcase(reuse_session_expired, Config) -> @@ -461,49 +462,49 @@ explicit_session_reuse_expired(Config) when is_list(Config) -> no_reuses_session_server_restart_new_cert() -> [{doc,"Check that a session is not reused if the server is restarted with a new cert."}]. no_reuses_session_server_restart_new_cert(Config) when is_list(Config) -> + ClientOpts = ssl_test_lib:ssl_options(client_rsa_der_opts, Config), + ServerOpts = ssl_test_lib:ssl_options(server_rsa_der_verify_opts, Config), + RSA1024ServerOpts = ssl_test_lib:ssl_options(server_rsa_1024_der_opts, Config), + RSA1024ClientOpts = ssl_test_lib:ssl_options(client_rsa_1024_der_opts, Config), - ClientOpts = ssl_test_lib:ssl_options(client_rsa_opts, Config), - ServerOpts = ssl_test_lib:ssl_options(server_rsa_verify_opts, Config), - RSA1024ServerOpts = ssl_test_lib:ssl_options(server_rsa_1024_opts, Config), - RSA1024ClientOpts = ssl_test_lib:ssl_options(client_rsa_1024_opts, Config), {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config), - Server = + Server0 = ssl_test_lib:start_server([{node, ServerNode}, {port, 0}, {from, self()}, - {mfa, {ssl_test_lib, session_info_result, []}}, + {mfa, {ssl_test_lib, session_info_result, []}}, {options, ServerOpts}]), - Port = ssl_test_lib:inet_port(Server), + Port = ssl_test_lib:inet_port(Server0), Client0 = ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {ssl_test_lib, no_result, []}}, - {from, self()}, {options, [{reuse_sessions, save} | ClientOpts]}]), - SessionInfo = - receive - {Server, Info} -> - Info - end, + {port, Port}, {host, Hostname}, + {mfa, {ssl_test_lib, session_info_result, []}}, + {from, self()}, {options, [{reuse_sessions, save} | ClientOpts]}]), + Info0 = receive {Server0, Info00} -> Info00 end, + Info0 = receive {Client0, Info01} -> Info01 end, - ssl_test_lib:close(Server), + ct:sleep(?SLEEP), ssl_test_lib:close(Client0), + ssl_test_lib:close(Server0), - Server1 = - ssl_test_lib:start_server([{node, ServerNode}, {port, Port}, - {from, self()}, - {mfa, {ssl_test_lib, no_result, []}}, - {options, [{reuseaddr, true} | RSA1024ServerOpts]}]), + Server1 = ssl_test_lib:start_server([{node, ServerNode}, {port, Port}, + {from, self()}, + {mfa, {ssl_test_lib, session_info_result, []}}, + {options, [{reuseaddr, true} | RSA1024ServerOpts]}]), + + Client1 = ssl_test_lib:start_client([{node, ClientNode}, + {port, Port}, {host, Hostname}, + {mfa, {ssl_test_lib, session_info_result, []}}, + {from, self()}, {options, RSA1024ClientOpts}]), + Info1 = receive {Server1, Info10} -> Info10 end, - Client1 = - ssl_test_lib:start_client([{node, ClientNode}, - {port, Port}, {host, Hostname}, - {mfa, {ssl_test_lib, session_info_result, []}}, - {from, self()}, {options, RSA1024ClientOpts}]), receive - {Client1, SessionInfo} -> + {Client1, Info0} -> ct:fail(session_reused_when_server_has_new_cert); - {Client1, _Other} -> - ok + {Client1, Info1} -> + ct:pal("First: ~p~nSecond ~p~n",[Info0, Info1]); + Unexpected -> + ct:fail({unexpected, Unexpected, {Client1, Info1}}) end, ssl_test_lib:close(Server1), ssl_test_lib:close(Client1). diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl index e4c23c22cf..c1448d7666 100644 --- a/lib/ssl/test/ssl_test_lib.erl +++ b/lib/ssl/test/ssl_test_lib.erl @@ -1710,16 +1710,20 @@ make_rsa_cert(Config) -> ServerChain = proplists:get_value(server_chain, Config, default_cert_chain_conf()), CertChainConf = gen_conf(rsa, rsa, ClientChain, ServerChain), GenCertData = public_key:pkix_test_data(CertChainConf), + #{client_config := ClientDerConf, server_config := ServerDerConf} = GenCertData, + [{server_config, ServerConf}, {client_config, ClientConf}] = x509_test:gen_pem_config_files(GenCertData, ClientFileBase, ServerFileBase), [{server_rsa_opts, [{reuseaddr, true} | ServerConf]}, - - {server_rsa_verify_opts, [{reuseaddr, true}, - {verify, verify_peer} | ServerConf]}, + {server_rsa_verify_opts, [{reuseaddr, true}, {verify, verify_peer} | ServerConf]}, {client_rsa_opts, ClientConf}, - {client_rsa_verify_opts, [{verify, verify_peer} |ClientConf]} - | Config]; + {client_rsa_verify_opts, [{verify, verify_peer} |ClientConf]}, + {server_rsa_der_opts, [{reuseaddr, true} | ServerDerConf]}, + {server_rsa_der_verify_opts, [{reuseaddr, true}, {verify, verify_peer} | ServerDerConf]}, + {client_rsa_der_opts, ClientDerConf}, + {client_rsa_der_verify_opts, [{verify, verify_peer} |ClientDerConf]} + | Config]; false -> Config end. @@ -1734,15 +1738,18 @@ make_rsa_1024_cert(Config) -> ServerChain = proplists:get_value(server_chain, Config, default_cert_chain_conf()), CertChainConf = gen_conf('rsa-1024', 'rsa-1024', ClientChain, ServerChain), GenCertData = public_key:pkix_test_data(CertChainConf), + #{client_config := ClientDerConf, server_config := ServerDerConf} = GenCertData, [{server_config, ServerConf}, {client_config, ClientConf}] = x509_test:gen_pem_config_files(GenCertData, ClientFileBase, ServerFileBase), [{server_rsa_1024_opts, [{ssl_imp, new},{reuseaddr, true} | ServerConf]}, - - {server_rsa_1024_verify_opts, [{ssl_imp, new}, {reuseaddr, true}, - {verify, verify_peer} | ServerConf]}, + {server_rsa_1024_verify_opts, [{ssl_imp, new}, {reuseaddr, true}, {verify, verify_peer} | ServerConf]}, {client_rsa_1024_opts, ClientConf}, - {client_rsa_1024_verify_opts, [{verify, verify_peer} |ClientConf]} + {client_rsa_1024_verify_opts, [{verify, verify_peer} |ClientConf]}, + {server_rsa_1024_der_opts, [{ssl_imp, new},{reuseaddr, true} | ServerDerConf]}, + {server_rsa_1024_der_verify_opts, [{ssl_imp, new}, {reuseaddr, true}, {verify, verify_peer} | ServerDerConf]}, + {client_rsa_1024_der_opts, ClientDerConf}, + {client_rsa_1024_der_verify_opts, [{verify, verify_peer} |ClientDerConf]} | Config]; false -> Config -- 2.31.1
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