aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/src/ssh.appup.src26
-rw-r--r--lib/ssh/src/ssh_connection_manager.erl22
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl30
-rw-r--r--lib/ssh/vsn.mk2
4 files changed, 45 insertions, 35 deletions
diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src
index 21a0582c06..0542054596 100644
--- a/lib/ssh/src/ssh.appup.src
+++ b/lib/ssh/src/ssh.appup.src
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2012. 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
@@ -18,26 +18,12 @@
%%
{"%VSN%",
- [
- {"2.0.8", [{load_module, ssh_sftpd_file_api, soft_purge, soft_purge, []},
- {load_module, ssh_channel, soft_purge, soft_purge, []}]},
- {"2.0.7", [{load_module, ssh_sftp, soft_purge, soft_purge, []}]},
- {"2.0.6", [{load_module, ssh_userreg, soft_purge, soft_purge, []},
- {load_module, ssh_sftp, soft_purge, soft_purge, []}]},
- {"2.0.5", [{load_module, ssh_userreg, soft_purge, soft_purge, []},
- {load_module, ssh_sftp, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, [ssh_userreg]}]}
+ [
+ {<<"2\\.*">>, [{restart_application, ssh}]},
+ {<<"1\\.*">>, [{restart_application, ssh}]}
],
[
- {"2.0.8", [{load_module, ssh_sftpd_file_api, soft_purge, soft_purge, []},
- {load_module, ssh_channel, soft_purge, soft_purge, []}]},
- {"2.0.7", [{load_module, ssh_sftp, soft_purge, soft_purge, []}]},
- {"2.0.6", [{load_module, ssh_userreg, soft_purge, soft_purge, []},
- {load_module, ssh_sftp, soft_purge, soft_purge, []}]},
- {"2.0.5", [{load_module, ssh_userreg, soft_purge, soft_purge, []},
- {load_module, ssh_sftp, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, [ssh_userreg]}]}
+ {<<"2\\.*">>, [{restart_application, ssh}]},
+ {<<"1\\.*">>, [{restart_application, ssh}]}
]
}.
-
-
diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl
index 406a042d72..e993f597a5 100644
--- a/lib/ssh/src/ssh_connection_manager.erl
+++ b/lib/ssh/src/ssh_connection_manager.erl
@@ -144,27 +144,21 @@ adjust_window(ConnectionManager, Channel, Bytes) ->
cast(ConnectionManager, {adjust_window, Channel, Bytes}).
close(ConnectionManager, ChannelId) ->
- try call(ConnectionManager, {close, ChannelId}) of
- ok ->
+ case call(ConnectionManager, {close, ChannelId}) of
+ ok ->
ok;
- {error, channel_closed} ->
- ok
- catch
- exit:{noproc, _} ->
+ {error, channel_closed} ->
ok
- end.
+ end.
stop(ConnectionManager) ->
- try call(ConnectionManager, stop) of
+ case call(ConnectionManager, stop) of
ok ->
ok;
{error, channel_closed} ->
ok
- catch
- exit:{noproc, _} ->
- ok
end.
-
+
send(ConnectionManager, ChannelId, Type, Data, Timeout) ->
call(ConnectionManager, {data, ChannelId, Type, Data}, Timeout).
@@ -591,7 +585,9 @@ call(Pid, Msg, Timeout) ->
catch
exit:{timeout, _} ->
{error, timeout};
- exit:{normal, _} ->
+ exit:{normal} ->
+ {error, channel_closed};
+ exit:{{shutdown, _}, _} ->
{error, channel_closed};
exit:{noproc,_} ->
{error, channel_closed}
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index 012367a6df..d66214d415 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -110,7 +110,8 @@ all() ->
{group, rsa_pass_key},
{group, internal_error},
daemon_already_started,
- server_password_option, server_userpassword_option].
+ server_password_option, server_userpassword_option,
+ close].
groups() ->
[{dsa_key, [], [exec, exec_compressed, shell, known_hosts]},
@@ -507,7 +508,34 @@ internal_error(Config) when is_list(Config) ->
{user_dir, UserDir},
{user_interaction, false}]).
+%%--------------------------------------------------------------------
+close(doc) ->
+ ["Simulate that we try to close an already closed connection"];
+
+close(suite) ->
+ [];
+
+close(Config) when is_list(Config) ->
+ SystemDir = ?config(data_dir, Config),
+ PrivDir = ?config(priv_dir, Config),
+ UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth
+ file:make_dir(UserDir),
+
+ {_Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
+ {user_dir, UserDir},
+ {user_passwords, [{"vego", "morot"}]},
+ {failfun, fun ssh_test_lib:failfun/2}]),
+ {ok, CM} = ssh:connect(Host, Port, [{silently_accept_hosts, true},
+ {user_dir, UserDir},
+ {user, "vego"},
+ {password, "morot"},
+ {user_interaction, false}]),
+ exit(CM, {shutdown, normal}),
+ ok = ssh:close(CM).
+
+
+
%%--------------------------------------------------------------------
%% Internal functions
%%--------------------------------------------------------------------
diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk
index 42f860d6ae..bff73a1b40 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.0.9
+SSH_VSN = 2.1
APP_VSN = "ssh-$(SSH_VSN)"