aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/doc/src/notes.xml68
-rw-r--r--lib/ssh/doc/src/ssh.xml3
-rw-r--r--lib/ssh/src/ssh.appup.src6
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl44
-rw-r--r--lib/ssh/src/ssh_connection_manager.erl52
-rw-r--r--lib/ssh/src/ssh_sftp.erl2
-rw-r--r--lib/ssh/src/ssh_transport.erl6
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl70
-rw-r--r--lib/ssh/test/ssh_connection_SUITE.erl22
-rw-r--r--lib/ssh/test/ssh_echo_server.erl4
-rw-r--r--lib/ssh/test/ssh_sftp_SUITE.erl98
-rw-r--r--lib/ssh/test/ssh_sftpd_SUITE.erl65
-rw-r--r--lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl29
-rw-r--r--lib/ssh/test/ssh_to_openssh_SUITE.erl60
-rw-r--r--lib/ssh/vsn.mk2
15 files changed, 355 insertions, 176 deletions
diff --git a/lib/ssh/doc/src/notes.xml b/lib/ssh/doc/src/notes.xml
index 3c289cdc46..f65b66a7c5 100644
--- a/lib/ssh/doc/src/notes.xml
+++ b/lib/ssh/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2012</year>
+ <year>2004</year><year>2013</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -29,6 +29,72 @@
<file>notes.xml</file>
</header>
+<section><title>Ssh 2.1.6</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fixed timing rekeying bug.</p>
+ <p>
+ Own Id: OTP-10940</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Ssh 2.1.5</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Bug in rekeying for daemon fixed.</p>
+ <p>
+ Own Id: OTP-10911</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Enhanced error message and added test for ssh clients
+ trying to start non existing subsystems.</p>
+ <p>
+ Own Id: OTP-10714</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Ssh 2.1.4</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Better quality on the error messages for when key
+ exchange failed.</p>
+ <p>
+ Own Id: OTP-10553 Aux Id: seq12152 </p>
+ </item>
+ <item>
+ <p>
+ Fix link to documentation for ssh:connect/3,4. Thanks to
+ Martin H�ssler.</p>
+ <p>
+ Own Id: OTP-10862</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Ssh 2.1.3</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml
index f57ee13460..bd0d3d49dd 100644
--- a/lib/ssh/doc/src/ssh.xml
+++ b/lib/ssh/doc/src/ssh.xml
@@ -91,7 +91,8 @@
</type>
<desc>
<p>Connects to an SSH server. No channel is started. This is done
- by calling ssh_connect:session_channel/2.</p>
+ by calling
+ <seealso marker="ssh_connection#session_channel/2">ssh_connection:session_channel/[2, 4]</seealso>.</p>
<p>Options are:</p>
<taglist>
<tag><c><![CDATA[{user_dir, string()}]]></c></tag>
diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src
index 5ba3742de7..b25e0c9e37 100644
--- a/lib/ssh/src/ssh.appup.src
+++ b/lib/ssh/src/ssh.appup.src
@@ -19,6 +19,9 @@
{"%VSN%",
[
+ {<<"2.1.4">>, [{load_module, ssh_sftp, soft_purge, soft_purge, []},
+ {load_module, ssh_connection_handler, soft_purge, soft_purge, []}]},
+ {<<"2.1.3">>, [{restart_application, ssh}]},
{<<"2.1.2">>, [{restart_application, ssh}]},
{<<"2.1.1">>, [{restart_application, ssh}]},
{<<"2.1">>, [{restart_application, ssh}]},
@@ -26,6 +29,9 @@
{<<"1\\.*">>, [{restart_application, ssh}]}
],
[
+ {<<"2.1.4">>, [{load_module, ssh_sftp, soft_purge, soft_purge, []},
+ {load_module, ssh_connection_handler, soft_purge, soft_purge, []}]},
+ {<<"2.1.3">>, [{restart_application, ssh}]},
{<<"2.1.2">>, [{restart_application, ssh}]},
{<<"2.1.1">>, [{restart_application, ssh}]},
{<<"2.1">>,[{restart_application, ssh}]},
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 787d82c4db..1c4477aeb3 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -213,6 +213,29 @@ key_exchange(#ssh_msg_kexdh_init{} = Msg,
description = Desc,
language = "en"}, State)
end;
+
+key_exchange({#ssh_msg_kexinit{} = Kex, Payload},
+ #state{ssh_params = #ssh{role = Role} = Ssh0,
+ key_exchange_init_msg = OwnKex} =
+ State) ->
+ Ssh1 = ssh_transport:key_init(opposite_role(Role), Ssh0, Payload),
+ try ssh_transport:handle_kexinit_msg(Kex, OwnKex, Ssh1) of
+ {ok, NextKexMsg, Ssh} when Role == client ->
+ send_msg(NextKexMsg, State),
+ {next_state, key_exchange,
+ next_packet(State#state{ssh_params = Ssh})};
+ {ok, Ssh} when Role == server ->
+ {next_state, key_exchange,
+ next_packet(State#state{ssh_params = Ssh})}
+ catch
+ #ssh_msg_disconnect{} = DisconnectMsg ->
+ handle_disconnect(DisconnectMsg, State);
+ _:Error ->
+ Desc = log_error(Error),
+ handle_disconnect(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED,
+ description = Desc,
+ language = "en"}, State)
+ end;
key_exchange(#ssh_msg_kexdh_reply{} = Msg,
#state{ssh_params = #ssh{role = client} = Ssh0} = State) ->
@@ -223,11 +246,13 @@ key_exchange(#ssh_msg_kexdh_reply{} = Msg,
catch
#ssh_msg_disconnect{} = DisconnectMsg ->
handle_disconnect(DisconnectMsg, State);
+ {ErrorToDisplay, #ssh_msg_disconnect{} = DisconnectMsg} ->
+ handle_disconnect(DisconnectMsg, State, ErrorToDisplay);
_:Error ->
Desc = log_error(Error),
handle_disconnect(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED,
- description = Desc,
- language = "en"}, State)
+ description = Desc,
+ language = "en"}, State)
end;
key_exchange(#ssh_msg_kex_dh_gex_group{} = Msg,
@@ -454,7 +479,9 @@ userauth(#ssh_msg_userauth_banner{message = Msg},
{next_state, userauth, next_packet(State)}.
connected({#ssh_msg_kexinit{}, _Payload} = Event, State) ->
- kexinit(Event, State#state{renegotiate = true}).
+ kexinit(Event, State#state{renegotiate = true});
+connected({#ssh_msg_kexdh_init{}, _Payload} = Event, State) ->
+ key_exchange(Event, State#state{renegotiate = true}).
%%--------------------------------------------------------------------
%% Function:
@@ -508,7 +535,7 @@ handle_event({info, From, Options}, StateName, #state{ssh_params = Ssh} = State
spawn(?MODULE, ssh_info_handler, [Options, Ssh, From]),
{next_state, StateName, State};
handle_event(data_size, connected, #state{ssh_params = Ssh0} = State) ->
- Sent = inet:getstat(State#state.socket, [send_oct]),
+ {ok, [{send_oct,Sent}]} = inet:getstat(State#state.socket, [send_oct]),
MaxSent = proplists:get_value(rekey_limit, State#state.opts, 1024000000),
case Sent >= MaxSent of
true ->
@@ -516,7 +543,7 @@ handle_event(data_size, connected, #state{ssh_params = Ssh0} = State) ->
send_msg(SshPacket, State),
{next_state, connected,
next_packet(State#state{ssh_params = Ssh,
- key_exchange_init_msg = KeyInitMsg,
+ key_exchange_init_msg = KeyInitMsg,
renegotiate = true})};
_ ->
{next_state, connected, next_packet(State)}
@@ -673,6 +700,11 @@ terminate({shutdown, #ssh_msg_disconnect{} = Msg}, StateName, #state{ssh_params
send_msg(SshPacket, State),
ssh_connection_manager:event(Pid, Msg),
terminate(normal, StateName, State#state{ssh_params = Ssh});
+terminate({shutdown, {#ssh_msg_disconnect{} = Msg, ErrorMsg}}, StateName, #state{ssh_params = Ssh0, manager = Pid} = State) ->
+ {SshPacket, Ssh} = ssh_transport:ssh_packet(Msg, Ssh0),
+ send_msg(SshPacket, State),
+ ssh_connection_manager:event(Pid, Msg, ErrorMsg),
+ terminate(normal, StateName, State#state{ssh_params = Ssh});
terminate(Reason, StateName, #state{ssh_params = Ssh0, manager = Pid} = State) ->
log_error(Reason),
DisconnectMsg =
@@ -950,6 +982,8 @@ handle_ssh_packet(Length, StateName, #state{decoded_data_buffer = DecData0,
handle_disconnect(#ssh_msg_disconnect{} = Msg, State) ->
{stop, {shutdown, Msg}, State}.
+handle_disconnect(#ssh_msg_disconnect{} = Msg, State, ErrorMsg) ->
+ {stop, {shutdown, {Msg, ErrorMsg}}, State}.
counterpart_versions(NumVsn, StrVsn, #ssh{role = server} = Ssh) ->
Ssh#ssh{c_vsn = NumVsn , c_version = StrVsn};
diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl
index 94a9ed505f..99a0b6a7c8 100644
--- a/lib/ssh/src/ssh_connection_manager.erl
+++ b/lib/ssh/src/ssh_connection_manager.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -40,8 +40,7 @@
close/2, stop/1, send/5,
send_eof/2]).
--export([open_channel/6, reply_request/3, request/6, request/7, global_request/4, event/2,
- cast/2]).
+-export([open_channel/6, reply_request/3, request/6, request/7, global_request/4, event/2, event/3, cast/2]).
%% Internal application API and spawn
-export([send_msg/1, ssh_channel_info_handler/3]).
@@ -110,10 +109,11 @@ global_request(ConnectionManager, Type, true = Reply, Data) ->
global_request(ConnectionManager, Type, false = Reply, Data) ->
cast(ConnectionManager, {global_request, self(), Type, Reply, Data}).
-
+
+event(ConnectionManager, BinMsg, ErrorMsg) ->
+ call(ConnectionManager, {ssh_msg, self(), BinMsg, ErrorMsg}).
event(ConnectionManager, BinMsg) ->
call(ConnectionManager, {ssh_msg, self(), BinMsg}).
-
info(ConnectionManager) ->
info(ConnectionManager, {info, all}).
@@ -262,8 +262,7 @@ handle_call({ssh_msg, Pid, Msg}, From,
%% To avoid that not all data sent by the other side is processes before
%% possible crash in ssh_connection_handler takes down the connection.
- gen_server:reply(From, ok),
-
+ gen_server:reply(From, ok),
ConnectionMsg = decode_ssh_msg(Msg),
try ssh_connection:handle_msg(ConnectionMsg, Connection0, Pid, Role) of
{{replies, Replies}, Connection} ->
@@ -294,7 +293,45 @@ handle_call({ssh_msg, Pid, Msg}, From,
disconnect_fun(Reason, SSHOpts),
{stop, {shutdown, Error}, State#state{connection_state = Connection}}
end;
+handle_call({ssh_msg, Pid, Msg, ErrorMsg}, From,
+ #state{connection_state = Connection0,
+ role = Role, opts = Opts, connected = IsConnected,
+ client = ClientPid}
+ = State) ->
+ %% To avoid that not all data sent by the other side is processes before
+ %% possible crash in ssh_connection_handler takes down the connection.
+ gen_server:reply(From, ok),
+ ConnectionMsg = decode_ssh_msg(Msg),
+ try ssh_connection:handle_msg(ConnectionMsg, Connection0, Pid, Role) of
+ {{replies, Replies}, Connection} ->
+ lists:foreach(fun send_msg/1, Replies),
+ {noreply, State#state{connection_state = Connection}};
+ {noreply, Connection} ->
+ {noreply, State#state{connection_state = Connection}};
+ {disconnect, {_, Reason}, {{replies, Replies}, Connection}}
+ when Role == client andalso (not IsConnected) ->
+ lists:foreach(fun send_msg/1, Replies),
+ ClientPid ! {self(), not_connected, {Reason, ErrorMsg}},
+ {stop, {shutdown, normal}, State#state{connection = Connection}};
+ {disconnect, Reason, {{replies, Replies}, Connection}} ->
+ lists:foreach(fun send_msg/1, Replies),
+ SSHOpts = proplists:get_value(ssh_opts, Opts),
+ disconnect_fun(Reason, SSHOpts),
+ {stop, {shutdown, normal}, State#state{connection_state = Connection}}
+ catch
+ _:Error ->
+ {disconnect, Reason, {{replies, Replies}, Connection}} =
+ ssh_connection:handle_msg(
+ #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION,
+ description = "Internal error",
+ language = "en"}, Connection0, undefined,
+ Role),
+ lists:foreach(fun send_msg/1, Replies),
+ SSHOpts = proplists:get_value(ssh_opts, Opts),
+ disconnect_fun(Reason, SSHOpts),
+ {stop, {shutdown, Error}, State#state{connection_state = Connection}}
+ end;
handle_call({global_request, Pid, _, _, _} = Request, From,
#state{connection_state =
#connection{channel_cache = Cache}} = State0) ->
@@ -523,7 +560,6 @@ handle_info({start_connection, server,
Exec = proplists:get_value(exec, Options),
CliSpec = proplists:get_value(ssh_cli, Options, {ssh_cli, [Shell]}),
ssh_connection_handler:send_event(Connection, socket_control),
- erlang:send_after(3600000, self(), rekey),
erlang:send_after(60000, self(), rekey_data),
{noreply, State#state{connection = Connection,
connection_state =
diff --git a/lib/ssh/src/ssh_sftp.erl b/lib/ssh/src/ssh_sftp.erl
index f3afbe01bf..10167a9223 100644
--- a/lib/ssh/src/ssh_sftp.erl
+++ b/lib/ssh/src/ssh_sftp.erl
@@ -403,7 +403,7 @@ init([Cm, ChannelId, Timeout]) ->
rep_buf = <<>>,
inf = new_inf()}};
failure ->
- {stop, {error, "server failed to start sftp subsystem"}};
+ {stop, "server failed to start sftp subsystem"};
Error ->
{stop, Error}
end.
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index 1abb69921d..98d59d01de 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -356,12 +356,12 @@ handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = HostKey, f = F,
{ok, SshPacket, Ssh#ssh{shared_secret = K,
exchanged_hash = H,
session_id = sid(Ssh, H)}};
- _Error ->
+ Error ->
Disconnect = #ssh_msg_disconnect{
code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED,
description = "Key exchange failed",
language = "en"},
- throw(Disconnect)
+ throw({Error, Disconnect})
end.
handle_kex_dh_gex_request(#ssh_msg_kex_dh_gex_request{min = _Min,
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index efcb11f88f..93029c5038 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -137,16 +137,16 @@ end_per_testcase(_Config) ->
%%--------------------------------------------------------------------
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
-app_test(doc) ->
- ["Application consistency test."];
+app_test() ->
+ [{doc, "App lication consistency test."}].
app_test(Config) when is_list(Config) ->
?t:app_test(ssh),
ok.
%%--------------------------------------------------------------------
-misc_ssh_options(doc) ->
- ["Test that we can set some misc options not tested elsewhere, "
- "some options not yet present are not decided if we should support or "
- "if they need thier own test case."];
+misc_ssh_options() ->
+ [{doc, "Test that we can set some misc options not tested elsewhere, "
+ "some options not yet present are not decided if we should support or "
+ "if they need thier own test case."}].
misc_ssh_options(Config) when is_list(Config) ->
SystemDir = filename:join(?config(priv_dir, Config), system),
UserDir = ?config(priv_dir, Config),
@@ -163,8 +163,8 @@ misc_ssh_options(Config) when is_list(Config) ->
basic_test([{client_opts, CMiscOpt1 ++ ClientOpts}, {server_opts, SMiscOpt1 ++ ServerOpts}]).
%%--------------------------------------------------------------------
-exec(doc) ->
- ["Test api function ssh_connection:exec"];
+exec() ->
+ [{doc, "Test api function ssh_connection:exec"}].
exec(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
@@ -205,8 +205,8 @@ exec(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-exec_compressed(doc) ->
- ["Test that compression option works"];
+exec_compressed() ->
+ [{doc, "Test that compression option works"}].
exec_compressed(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
@@ -234,8 +234,8 @@ exec_compressed(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-idle_time(doc) ->
- ["Idle timeout test"];
+idle_time() ->
+ [{doc, "Idle timeout test"}].
idle_time(Config) ->
SystemDir = filename:join(?config(priv_dir, Config), system),
UserDir = ?config(priv_dir, Config),
@@ -256,8 +256,8 @@ idle_time(Config) ->
end,
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-rekey(doc) ->
- ["Idle timeout test"];
+rekey() ->
+ [{doc, "Idle timeout test"}].
rekey(Config) ->
SystemDir = filename:join(?config(priv_dir, Config), system),
UserDir = ?config(priv_dir, Config),
@@ -272,14 +272,14 @@ rekey(Config) ->
{user_interaction, false},
{rekey_limit, 0}]),
receive
- after 15000 ->
+ after 200000 ->
%%By this time rekeying would have been done
ssh:close(ConnectionRef),
ssh:stop_daemon(Pid)
end.
%%--------------------------------------------------------------------
-shell(doc) ->
- ["Test that ssh:shell/2 works"];
+shell() ->
+ [{doc, "Test that ssh:shell/2 works"}].
shell(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
@@ -300,9 +300,9 @@ shell(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-daemon_already_started(doc) ->
- ["Test that get correct error message if you try to start a daemon",
- "on an adress that already runs a daemon see also seq10667" ];
+daemon_already_started() ->
+ [{doc, "Test that get correct error message if you try to start a daemon",
+ "on an adress that already runs a daemon see also seq10667"}].
daemon_already_started(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
UserDir = ?config(priv_dir, Config),
@@ -317,8 +317,8 @@ daemon_already_started(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-server_password_option(doc) ->
- ["validate to server that uses the 'password' option"];
+server_password_option() ->
+ [{doc, "validate to server that uses the 'password' option"}].
server_password_option(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth
@@ -351,8 +351,8 @@ server_password_option(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-server_userpassword_option(doc) ->
- ["validate to server that uses the 'password' option"];
+server_userpassword_option() ->
+ [{doc, "validate to server that uses the 'password' option"}].
server_userpassword_option(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth
@@ -387,8 +387,8 @@ server_userpassword_option(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-known_hosts(doc) ->
- ["check that known_hosts is updated correctly"];
+known_hosts() ->
+ [{doc, "check that known_hosts is updated correctly"}].
known_hosts(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
@@ -414,8 +414,8 @@ known_hosts(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-pass_phrase(doc) ->
- ["Test that we can use keyes protected by pass phrases"];
+pass_phrase() ->
+ [{doc, "Test that we can use keyes protected by pass phrases"}].
pass_phrase(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
@@ -435,8 +435,8 @@ pass_phrase(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-internal_error(doc) ->
- ["Test that client does not hang if disconnects due to internal error"];
+internal_error() ->
+ [{doc,"Test that client does not hang if disconnects due to internal error"}].
internal_error(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
@@ -452,8 +452,8 @@ internal_error(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-send(doc) ->
- ["Test ssh_connection:send/3"];
+send() ->
+ [{doc, "Test ssh_connection:send/3"}].
send(Config) when is_list(Config) ->
process_flag(trap_exit, true),
SystemDir = filename:join(?config(priv_dir, Config), system),
@@ -473,8 +473,8 @@ send(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-close(doc) ->
- ["Simulate that we try to close an already closed connection"];
+close() ->
+ [{doc, "Simulate that we try to close an already closed connection"}].
close(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl
index acaf3d6eeb..6c781e0e91 100644
--- a/lib/ssh/test/ssh_connection_SUITE.erl
+++ b/lib/ssh/test/ssh_connection_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -82,8 +82,8 @@ end_per_testcase(_Config) ->
%%--------------------------------------------------------------------
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
-simple_exec(doc) ->
- ["Simple openssh connectivity test for ssh_connection:exec"];
+simple_exec() ->
+ [{doc, "Simple openssh connectivity test for ssh_connection:exec"}].
simple_exec(Config) when is_list(Config) ->
ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
@@ -113,8 +113,8 @@ simple_exec(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-small_cat(doc) ->
- ["Use 'cat' to echo small data block back to us."];
+small_cat() ->
+ [{doc, "Use 'cat' to echo small data block back to us."}].
small_cat(Config) when is_list(Config) ->
ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
@@ -148,8 +148,8 @@ small_cat(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-big_cat(doc) ->
- ["Use 'cat' to echo large data block back to us."];
+big_cat() ->
+ [{doc,"Use 'cat' to echo large data block back to us."}].
big_cat(Config) when is_list(Config) ->
ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
@@ -197,8 +197,8 @@ big_cat(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-send_after_exit(doc) ->
- ["Send channel data after the channel has been closed."];
+send_after_exit() ->
+ [{doc, "Send channel data after the channel has been closed."}].
send_after_exit(Config) when is_list(Config) ->
ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
@@ -236,8 +236,8 @@ send_after_exit(Config) when is_list(Config) ->
ok
end.
%%--------------------------------------------------------------------
-interrupted_send(doc) ->
- ["Use a subsystem that echos n char and then sends eof to cause a channel exit partway through a large send."];
+interrupted_send() ->
+ [{doc, "Use a subsystem that echos n char and then sends eof to cause a channel exit partway through a large send."}].
interrupted_send(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
diff --git a/lib/ssh/test/ssh_echo_server.erl b/lib/ssh/test/ssh_echo_server.erl
index 007b00c373..315ffecfd7 100644
--- a/lib/ssh/test/ssh_echo_server.erl
+++ b/lib/ssh/test/ssh_echo_server.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -21,7 +21,7 @@
%%% Description: Example ssh server
-module(ssh_echo_server).
--behaviour(ssh_subsytem).
+-behaviour(ssh_daemon_channel).
-record(state, {
n,
id,
diff --git a/lib/ssh/test/ssh_sftp_SUITE.erl b/lib/ssh/test/ssh_sftp_SUITE.erl
index 232161d029..56b1363b7a 100644
--- a/lib/ssh/test/ssh_sftp_SUITE.erl
+++ b/lib/ssh/test/ssh_sftp_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -41,7 +41,9 @@ suite() ->
all() ->
[{group, erlang_server},
- {group, openssh_server}].
+ {group, openssh_server},
+ sftp_nonexistent_subsystem
+ ].
init_per_suite(Config) ->
@@ -76,9 +78,7 @@ init_per_group(erlang_server, Config) ->
ssh_test_lib:daemon([{system_dir, SysDir},
{user_dir, PrivDir},
{user_passwords,
- [{?USER, ?PASSWD}]},
- {failfun,
- fun ssh_test_lib:failfun/2}]),
+ [{?USER, ?PASSWD}]}]),
[{group, erlang_server}, {sftpd, Sftpd} | Config];
init_per_group(openssh_server, Config) ->
@@ -100,6 +100,17 @@ end_per_group(_, Config) ->
%%--------------------------------------------------------------------
+init_per_testcase(sftp_nonexistent_subsystem, Config) ->
+ PrivDir = ?config(priv_dir, Config),
+ SysDir = ?config(data_dir, Config),
+ Sftpd = ssh_test_lib:daemon([{system_dir, SysDir},
+ {user_dir, PrivDir},
+ {subsystems, []},
+ {user_passwords,
+ [{?USER, ?PASSWD}]}
+ ]),
+ [{sftpd, Sftpd} | Config];
+
init_per_testcase(Case, Config) ->
prep(Config),
TmpConfig0 = lists:keydelete(watchdog, 1, Config),
@@ -129,6 +140,8 @@ init_per_testcase(Case, Config) ->
[{sftp, Sftp}, {watchdog, Dog} | TmpConfig]
end.
+end_per_testcase(sftp_nonexistent_subsystem, Config) ->
+ Config;
end_per_testcase(rename_file, Config) ->
PrivDir = ?config(priv_dir, Config),
NewFileName = filename:join(PrivDir, "test.txt"),
@@ -145,8 +158,8 @@ end_per_testcase(Config) ->
%%--------------------------------------------------------------------
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
-open_close_file(doc) ->
- ["Test API functions open/3 and close/2"];
+open_close_file() ->
+ [{doc, "Test API functions open/3 and close/2"}].
open_close_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "sftp.txt"),
@@ -165,8 +178,8 @@ open_close_file(Server, File, Mode) ->
ok = ssh_sftp:close(Server, Handle).
%%--------------------------------------------------------------------
-open_close_dir(doc) ->
- ["Test API functions opendir/2 and close/2"];
+open_close_dir() ->
+ [{doc, "Test API functions opendir/2 and close/2"}].
open_close_dir(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
{Sftp, _} = ?config(sftp, Config),
@@ -177,8 +190,8 @@ open_close_dir(Config) when is_list(Config) ->
{error, _} = ssh_sftp:opendir(Sftp, FileName).
%%--------------------------------------------------------------------
-read_file(doc) ->
- ["Test API funtion read_file/2"];
+read_file() ->
+ [{doc, "Test API funtion read_file/2"}].
read_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "sftp.txt"),
@@ -187,8 +200,8 @@ read_file(Config) when is_list(Config) ->
{ok, Data} = file:read_file(FileName).
%%--------------------------------------------------------------------
-read_dir(doc) ->
- ["Test API function list_dir/2"];
+read_dir() ->
+ [{doc,"Test API function list_dir/2"}].
read_dir(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
{Sftp, _} = ?config(sftp, Config),
@@ -196,8 +209,8 @@ read_dir(Config) when is_list(Config) ->
ct:pal("sftp list dir: ~p~n", [Files]).
%%--------------------------------------------------------------------
-write_file(doc) ->
- ["Test API function write_file/2"];
+write_file() ->
+ [{doc, "Test API function write_file/2"}].
write_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "sftp.txt"),
@@ -208,8 +221,8 @@ write_file(Config) when is_list(Config) ->
{ok, Data} = file:read_file(FileName).
%%--------------------------------------------------------------------
-remove_file(doc) ->
- ["Test API function delete/2"];
+remove_file() ->
+ [{doc,"Test API function delete/2"}].
remove_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "sftp.txt"),
@@ -222,8 +235,8 @@ remove_file(Config) when is_list(Config) ->
false = lists:member(filename:basename(FileName), NewFiles),
{error, _} = ssh_sftp:delete(Sftp, FileName).
%%--------------------------------------------------------------------
-rename_file(doc) ->
- ["Test API function rename_file/2"];
+rename_file() ->
+ [{doc, "Test API function rename_file/2"}].
rename_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "sftp.txt"),
@@ -242,8 +255,8 @@ rename_file(Config) when is_list(Config) ->
true = lists:member(filename:basename(NewFileName), NewFiles).
%%--------------------------------------------------------------------
-mk_rm_dir(doc) ->
- ["Test API functions make_dir/2, del_dir/2"];
+mk_rm_dir() ->
+ [{doc,"Test API functions make_dir/2, del_dir/2"}].
mk_rm_dir(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
{Sftp, _} = ?config(sftp, Config),
@@ -256,8 +269,8 @@ mk_rm_dir(Config) when is_list(Config) ->
{error, _} = ssh_sftp:del_dir(Sftp, PrivDir).
%%--------------------------------------------------------------------
-links(doc) ->
- ["Tests API function make_symlink/3"];
+links() ->
+ [{doc,"Tests API function make_symlink/3"}].
links(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
@@ -273,8 +286,8 @@ links(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-retrieve_attributes(doc) ->
- ["Test API function read_file_info/3"];
+retrieve_attributes() ->
+ [{doc, "Test API function read_file_info/3"}].
retrieve_attributes(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "sftp.txt"),
@@ -287,8 +300,8 @@ retrieve_attributes(Config) when is_list(Config) ->
ct:pal("SFTP: ~p FILE: ~p~n", [FileInfo, NewFileInfo]).
%%--------------------------------------------------------------------
-set_attributes(doc) ->
- ["Test API function write_file_info/3"];
+set_attributes() ->
+ [{doc,"Test API function write_file_info/3"}].
set_attributes(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -303,8 +316,8 @@ set_attributes(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-async_read(doc) ->
- ["Test API aread/3"];
+async_read() ->
+ [{doc,"Test API aread/3"}].
async_read(Config) when is_list(Config) ->
{Sftp, _} = ?config(sftp, Config),
PrivDir = ?config(priv_dir, Config),
@@ -321,8 +334,8 @@ async_read(Config) when is_list(Config) ->
ct:fail(Msg)
end.
%%--------------------------------------------------------------------
-async_write(doc) ->
- ["Test API awrite/3"];
+async_write() ->
+ [{doc,"Test API awrite/3"}].
async_write(Config) when is_list(Config) ->
{Sftp, _} = ?config(sftp, Config),
PrivDir = ?config(priv_dir, Config),
@@ -340,8 +353,8 @@ async_write(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-position(doc) ->
- ["Test API functions position/3"];
+position() ->
+ [{doc, "Test API functions position/3"}].
position(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -370,8 +383,8 @@ position(Config) when is_list(Config) ->
{ok, "2"} = ssh_sftp:read(Sftp, Handle, 1).
%%--------------------------------------------------------------------
-pos_read(doc) ->
- ["Test API functions pread/3 and apread/3"];
+pos_read() ->
+ [{doc,"Test API functions pread/3 and apread/3"}].
pos_read(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -396,8 +409,8 @@ pos_read(Config) when is_list(Config) ->
{ok, NewData1} = ssh_sftp:pread(Sftp, Handle, {bof, 4}, 4).
%%--------------------------------------------------------------------
-pos_write(doc) ->
- ["Test API functions pwrite/4 and apwrite/4"];
+pos_write() ->
+ [{doc,"Test API functions pwrite/4 and apwrite/4"}].
pos_write(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -423,6 +436,17 @@ pos_write(Config) when is_list(Config) ->
{ok, NewData1} = ssh_sftp:read_file(Sftp, FileName).
%%--------------------------------------------------------------------
+sftp_nonexistent_subsystem() ->
+ [{doc, "Try to execute sftp subsystem on a server that does not support it"}].
+sftp_nonexistent_subsystem(Config) when is_list(Config) ->
+ {_,Host, Port} = ?config(sftpd, Config),
+ {error,"server failed to start sftp subsystem"} =
+ ssh_sftp:start_channel(Host, Port,
+ [{user_interaction, false},
+ {user, ?USER}, {password, ?PASSWD},
+ {silently_accept_hosts, true}]).
+
+%%--------------------------------------------------------------------
%% Internal functions ------------------------------------------------
%%--------------------------------------------------------------------
prep(Config) ->
diff --git a/lib/ssh/test/ssh_sftpd_SUITE.erl b/lib/ssh/test/ssh_sftpd_SUITE.erl
index 5aa46872ee..7b22e45d5e 100644
--- a/lib/ssh/test/ssh_sftpd_SUITE.erl
+++ b/lib/ssh/test/ssh_sftpd_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -163,8 +163,8 @@ end_per_testcase(_TestCase, Config) ->
%%--------------------------------------------------------------------
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
-open_close_file(doc) ->
- ["Test SSH_FXP_OPEN and SSH_FXP_CLOSE commands"];
+open_close_file() ->
+ [{doc, "Test SSH_FXP_OPEN and SSH_FXP_CLOSE commands"}].
open_close_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -194,8 +194,8 @@ open_close_file(Config) when is_list(Config) ->
?SSH_FXF_OPEN_EXISTING).
%%--------------------------------------------------------------------
-open_close_dir(doc) ->
- ["Test SSH_FXP_OPENDIR and SSH_FXP_CLOSE commands"];
+open_close_dir() ->
+ [{doc,"Test SSH_FXP_OPENDIR and SSH_FXP_CLOSE commands"}].
open_close_dir(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
{Cm, Channel} = ?config(sftp, Config),
@@ -221,8 +221,8 @@ open_close_dir(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-read_file(doc) ->
- ["Test SSH_FXP_READ command"];
+read_file() ->
+ [{doc, "Test SSH_FXP_READ command"}].
read_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -244,8 +244,8 @@ read_file(Config) when is_list(Config) ->
{ok, Data} = file:read_file(FileName).
%%--------------------------------------------------------------------
-read_dir(doc) ->
- ["Test SSH_FXP_READDIR command"];
+read_dir() ->
+ [{doc,"Test SSH_FXP_READDIR command"}].
read_dir(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
{Cm, Channel} = ?config(sftp, Config),
@@ -255,8 +255,8 @@ read_dir(Config) when is_list(Config) ->
ok = read_dir(Handle, Cm, Channel, ReqId).
%%--------------------------------------------------------------------
-write_file(doc) ->
- ["Test SSH_FXP_WRITE command"];
+write_file() ->
+ [{doc, "Test SSH_FXP_WRITE command"}].
write_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -279,8 +279,8 @@ write_file(Config) when is_list(Config) ->
{ok, Data} = file:read_file(FileName).
%%--------------------------------------------------------------------
-remove_file(doc) ->
- ["Test SSH_FXP_REMOVE command"];
+remove_file() ->
+ [{doc, "Test SSH_FXP_REMOVE command"}].
remove_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -300,8 +300,8 @@ remove_file(Config) when is_list(Config) ->
remove(PrivDir, Cm, Channel, NewReqId).
%%--------------------------------------------------------------------
-rename_file(doc) ->
- ["Test SSH_FXP_RENAME command"];
+rename_file() ->
+ [{doc, "Test SSH_FXP_RENAME command"}].
rename_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -337,8 +337,8 @@ rename_file(Config) when is_list(Config) ->
?SSH_FXP_RENAME_ATOMIC).
%%--------------------------------------------------------------------
-mk_rm_dir(doc) ->
- ["Test SSH_FXP_MKDIR and SSH_FXP_RMDIR command"];
+mk_rm_dir() ->
+ [{doc, "Test SSH_FXP_MKDIR and SSH_FXP_RMDIR command"}].
mk_rm_dir(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
{Cm, Channel} = ?config(sftp, Config),
@@ -360,8 +360,8 @@ mk_rm_dir(Config) when is_list(Config) ->
_/binary>>, _} = rmdir(DirName, Cm, Channel, NewReqId2).
%%--------------------------------------------------------------------
-real_path(doc) ->
- ["Test SSH_FXP_REALPATH command"];
+real_path() ->
+ [{doc, "Test SSH_FXP_REALPATH command"}].
real_path(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
@@ -388,8 +388,6 @@ real_path(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-links(doc) ->
- [];
links(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
@@ -417,8 +415,8 @@ links(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-retrieve_attributes(doc) ->
- ["Test SSH_FXP_STAT, SSH_FXP_LSTAT AND SSH_FXP_FSTAT commands"];
+retrieve_attributes() ->
+ [{"Test SSH_FXP_STAT, SSH_FXP_LSTAT AND SSH_FXP_FSTAT commands"}].
retrieve_attributes(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -482,8 +480,8 @@ retrieve_attributes(Config) when is_list(Config) ->
end, AttrValues).
%%--------------------------------------------------------------------
-set_attributes(doc) ->
- ["Test SSH_FXP_SETSTAT AND SSH_FXP_FSETSTAT commands"];
+set_attributes() ->
+ [{doc, "Test SSH_FXP_SETSTAT AND SSH_FXP_FSETSTAT commands"}].
set_attributes(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
@@ -540,8 +538,8 @@ set_attributes(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-ver3_rename(doc) ->
- ["Test that ver3 rename message is handled OTP 6352"];
+ver3_rename() ->
+ [{doc, "Test that ver3 rename message is handled OTP 6352"}].
ver3_rename(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -554,8 +552,8 @@ ver3_rename(Config) when is_list(Config) ->
rename(FileName, NewFileName, Cm, Channel, ReqId, 3, 0).
%%--------------------------------------------------------------------
-relpath(doc) ->
- ["Check that realpath works ok seq10670"];
+relpath() ->
+ [{doc, "Check that realpath works ok seq10670"}].
relpath(Config) when is_list(Config) ->
ReqId = 0,
{Cm, Channel} = ?config(sftp, Config),
@@ -577,8 +575,8 @@ relpath(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-sshd_read_file(doc) ->
- ["Test SSH_FXP_READ command, using sshd-server"];
+sshd_read_file() ->
+ [{doc,"Test SSH_FXP_READ command, using sshd-server"}].
sshd_read_file(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
FileName = filename:join(PrivDir, "test.txt"),
@@ -598,8 +596,9 @@ sshd_read_file(Config) when is_list(Config) ->
read_file(Handle, 100, 0, Cm, Channel, NewReqId),
{ok, Data} = file:read_file(FileName).
-ver6_basic(doc) ->
- ["Test SFTP Version 6"];
+%%--------------------------------------------------------------------
+ver6_basic() ->
+ [{doc, "Test SFTP Version 6"}].
ver6_basic(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
%FileName = filename:join(PrivDir, "test.txt"),
diff --git a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl
index 8f722941d4..cc34cc0793 100644
--- a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl
+++ b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -145,9 +145,9 @@ end_per_testcase(_TestCase, Config) ->
%%--------------------------------------------------------------------
%% Test cases starts here. -------------------------------------------
%%--------------------------------------------------------------------
-close_file(doc) ->
- ["Test that sftpd closes its fildescriptors after compleating the "
- "transfer OTP-6350"];
+close_file() ->
+ [{doc, "Test that sftpd closes its fildescriptors after compleating the "
+ "transfer OTP-6350"}].
close_file(Config) when is_list(Config) ->
DataDir = ?config(data_dir, Config),
@@ -165,10 +165,10 @@ close_file(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-quit(doc) ->
- [" When the sftp client ends the session the "
+quit() ->
+ [{doc, " When the sftp client ends the session the "
"server will now behave correctly and not leave the "
- "client hanging. OTP-6349"];
+ "client hanging. OTP-6349"}].
quit(Config) when is_list(Config) ->
DataDir = ?config(data_dir, Config),
@@ -197,9 +197,9 @@ quit(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-file_cb(doc) ->
- ["Test that it is possible to change the callback module for"
- " the sftpds filehandling. OTP-6356"];
+file_cb() ->
+ [{"Test that it is possible to change the callback module for"
+ " the sftpds filehandling. OTP-6356"}].
file_cb(Config) when is_list(Config) ->
DataDir = ?config(data_dir, Config),
@@ -245,8 +245,6 @@ file_cb(Config) when is_list(Config) ->
alt_file_handler_check(alt_del_dir).
%%--------------------------------------------------------------------
-root_dir(doc) ->
- [""];
root_dir(Config) when is_list(Config) ->
{Sftp, _} = ?config(sftp, Config),
FileName = "test.txt",
@@ -258,16 +256,15 @@ root_dir(Config) when is_list(Config) ->
ct:pal("Listing: ~p~n", [Listing]).
%%--------------------------------------------------------------------
-list_dir_limited(doc) ->
- [""];
list_dir_limited(Config) when is_list(Config) ->
{Sftp, _} = ?config(sftp, Config),
{ok, Listing} =
ssh_sftp:list_dir(Sftp, "."),
ct:pal("Listing: ~p~n", [Listing]).
-ver6_basic(doc) ->
- ["Test some version 6 features"];
+%%--------------------------------------------------------------------
+ver6_basic() ->
+ [{doc, "Test some version 6 features"}].
ver6_basic(Config) when is_list(Config) ->
PrivDir = ?config(priv_dir, Config),
NewDir = filename:join(PrivDir, "testdir2"),
diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl
index 99dc76e12d..8b5343cecc 100644
--- a/lib/ssh/test/ssh_to_openssh_SUITE.erl
+++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -49,7 +49,9 @@ groups() ->
erlang_client_openssh_server_setenv,
erlang_client_openssh_server_publickey_rsa,
erlang_client_openssh_server_publickey_dsa,
- erlang_client_openssh_server_password]},
+ erlang_client_openssh_server_password,
+ erlang_client_openssh_server_nonexistent_subsystem
+ ]},
{erlang_server, [], [erlang_server_openssh_client_exec,
erlang_server_openssh_client_exec_compressed,
erlang_server_openssh_client_pulic_key_dsa]}
@@ -99,8 +101,8 @@ end_per_testcase(_TestCase, _Config) ->
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
-erlang_shell_client_openssh_server(doc) ->
- ["Test that ssh:shell/2 works"];
+erlang_shell_client_openssh_server() ->
+ [{doc, "Test that ssh:shell/2 works"}].
erlang_shell_client_openssh_server(Config) when is_list(Config) ->
process_flag(trap_exit, true),
@@ -126,8 +128,8 @@ erlang_shell_client_openssh_server(Config) when is_list(Config) ->
end.
%--------------------------------------------------------------------
-erlang_client_openssh_server_exec(doc) ->
- ["Test api function ssh_connection:exec"];
+erlang_client_openssh_server_exec() ->
+ [{doc, "Test api function ssh_connection:exec"}].
erlang_client_openssh_server_exec(Config) when is_list(Config) ->
ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
@@ -165,8 +167,8 @@ erlang_client_openssh_server_exec(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-erlang_client_openssh_server_exec_compressed(doc) ->
- ["Test that compression option works"];
+erlang_client_openssh_server_exec_compressed() ->
+ [{doc, "Test that compression option works"}].
erlang_client_openssh_server_exec_compressed(Config) when is_list(Config) ->
ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
@@ -188,8 +190,8 @@ erlang_client_openssh_server_exec_compressed(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-erlang_server_openssh_client_exec(doc) ->
- ["Test that exec command works."];
+erlang_server_openssh_client_exec() ->
+ [{doc, "Test that exec command works."}].
erlang_server_openssh_client_exec(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
@@ -219,8 +221,8 @@ erlang_server_openssh_client_exec(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-erlang_server_openssh_client_exec_compressed(doc) ->
- ["Test that exec command works."];
+erlang_server_openssh_client_exec_compressed() ->
+ [{doc, "Test that exec command works."}].
erlang_server_openssh_client_exec_compressed(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
@@ -247,8 +249,8 @@ erlang_server_openssh_client_exec_compressed(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-erlang_client_openssh_server_setenv(doc) ->
- ["Test api function ssh_connection:setenv"];
+erlang_client_openssh_server_setenv() ->
+ [{doc, "Test api function ssh_connection:setenv"}].
erlang_client_openssh_server_setenv(Config) when is_list(Config) ->
ConnectionRef =
@@ -290,8 +292,8 @@ erlang_client_openssh_server_setenv(Config) when is_list(Config) ->
%% setenv not meaningfull on erlang ssh daemon!
%%--------------------------------------------------------------------
-erlang_client_openssh_server_publickey_rsa(doc) ->
- ["Validate using rsa publickey."];
+erlang_client_openssh_server_publickey_rsa() ->
+ [{doc, "Validate using rsa publickey."}].
erlang_client_openssh_server_publickey_rsa(Config) when is_list(Config) ->
{ok,[[Home]]} = init:get_argument(home),
KeyFile = filename:join(Home, ".ssh/id_rsa"),
@@ -317,8 +319,8 @@ erlang_client_openssh_server_publickey_rsa(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
-erlang_client_openssh_server_publickey_dsa(doc) ->
- ["Validate using dsa publickey."];
+erlang_client_openssh_server_publickey_dsa() ->
+ [{doc, "Validate using dsa publickey."}].
erlang_client_openssh_server_publickey_dsa(Config) when is_list(Config) ->
{ok,[[Home]]} = init:get_argument(home),
KeyFile = filename:join(Home, ".ssh/id_dsa"),
@@ -342,8 +344,8 @@ erlang_client_openssh_server_publickey_dsa(Config) when is_list(Config) ->
{skip, "no ~/.ssh/id_dsa"}
end.
%%--------------------------------------------------------------------
-erlang_server_openssh_client_pulic_key_dsa(doc) ->
- ["Validate using dsa publickey."];
+erlang_server_openssh_client_pulic_key_dsa() ->
+ [{doc, "Validate using dsa publickey."}].
erlang_server_openssh_client_pulic_key_dsa(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
@@ -369,8 +371,8 @@ erlang_server_openssh_client_pulic_key_dsa(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
-erlang_client_openssh_server_password(doc) ->
- ["Test client password option"];
+erlang_client_openssh_server_password() ->
+ [{doc, "Test client password option"}].
erlang_client_openssh_server_password(Config) when is_list(Config) ->
%% to make sure we don't public-key-auth
UserDir = ?config(data_dir, Config),
@@ -402,6 +404,20 @@ erlang_client_openssh_server_password(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
+
+erlang_client_openssh_server_nonexistent_subsystem() ->
+ [{doc, "Test client password option"}].
+erlang_client_openssh_server_nonexistent_subsystem(Config) when is_list(Config) ->
+
+ ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT,
+ [{user_interaction, false},
+ silently_accept_hosts]),
+
+ {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
+
+ failure = ssh_connection:subsystem(ConnectionRef, ChannelId, "foo", infinity).
+
+%%--------------------------------------------------------------------
%
%% Not possible to send password with openssh without user interaction
%%
diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk
index 71666a3179..d5ca1cb3fe 100644
--- a/lib/ssh/vsn.mk
+++ b/lib/ssh/vsn.mk
@@ -1,5 +1,5 @@
#-*-makefile-*- ; force emacs to enter makefile-mode
-SSH_VSN = 2.1.3
+SSH_VSN = 2.1.6
APP_VSN = "ssh-$(SSH_VSN)"