aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/test/ssl_test_lib.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2018-11-01 09:25:57 +0100
committerIngela Anderton Andin <[email protected]>2018-11-01 15:19:29 +0100
commit68d9244ae33e5eea36250c3bb9ffe046a4db5647 (patch)
treec246e69d5d13cdf650b662c2594594e1690d0e19 /lib/ssl/test/ssl_test_lib.erl
parent91776a3b24e89a343dfa5769747e72e95b194a29 (diff)
downloadotp-68d9244ae33e5eea36250c3bb9ffe046a4db5647.tar.gz
otp-68d9244ae33e5eea36250c3bb9ffe046a4db5647.tar.bz2
otp-68d9244ae33e5eea36250c3bb9ffe046a4db5647.zip
ssl: Return error to user that tries to use a "transport accepted" socket for
other purposes than handshaking
Diffstat (limited to 'lib/ssl/test/ssl_test_lib.erl')
-rw-r--r--lib/ssl/test/ssl_test_lib.erl24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl
index 39a5bcaad6..0ab845c4d1 100644
--- a/lib/ssl/test/ssl_test_lib.erl
+++ b/lib/ssl/test/ssl_test_lib.erl
@@ -196,6 +196,30 @@ connect(ListenSocket, Node, _, _, Timeout, Opts, _) ->
rpc:call(Node, ssl, ssl_accept, [AcceptSocket, Opts, Timeout]),
AcceptSocket.
+
+start_server_transport_abuse_socket(Args) ->
+ Result = spawn_link(?MODULE, transport_accept_abuse, [Args]),
+ receive
+ {listen, up} ->
+ Result
+ end.
+
+transport_accept_abuse(Opts) ->
+ Node = proplists:get_value(node, Opts),
+ Port = proplists:get_value(port, Opts),
+ Options = proplists:get_value(options, Opts),
+ Pid = proplists:get_value(from, Opts),
+ Transport = proplists:get_value(transport, Opts, ssl),
+ ct:log("~p:~p~nssl:listen(~p, ~p)~n", [?MODULE,?LINE, Port, Options]),
+ {ok, ListenSocket} = rpc:call(Node, Transport, listen, [Port, Options]),
+ Pid ! {listen, up},
+ send_selected_port(Pid, Port, ListenSocket),
+ {ok, AcceptSocket} = rpc:call(Node, ssl, transport_accept,
+ [ListenSocket]),
+ {error, _} = rpc:call(Node, ssl, connection_information, [AcceptSocket]),
+ _ = rpc:call(Node, ssl, handshake, [AcceptSocket, infinity]),
+ Pid ! {self(), ok}.
+
remove_close_msg(0) ->
ok;
remove_close_msg(ReconnectTimes) ->