diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ssh/doc/src/notes.xml | 33 | ||||
-rw-r--r-- | lib/ssh/doc/src/ssh.xml | 11 | ||||
-rw-r--r-- | lib/ssh/examples/ssh_sample_cli.erl | 56 | ||||
-rw-r--r-- | lib/ssh/src/ssh.appup.src | 20 | ||||
-rw-r--r-- | lib/ssh/src/ssh.erl | 8 | ||||
-rw-r--r-- | lib/ssh/src/ssh_cli.erl | 2 | ||||
-rw-r--r-- | lib/ssh/src/ssh_connection.erl | 2 | ||||
-rw-r--r-- | lib/ssh/src/ssh_connection_manager.erl | 12 | ||||
-rw-r--r-- | lib/ssh/vsn.mk | 9 |
9 files changed, 104 insertions, 49 deletions
diff --git a/lib/ssh/doc/src/notes.xml b/lib/ssh/doc/src/notes.xml index 9597137cdf..0ce83fa5d1 100644 --- a/lib/ssh/doc/src/notes.xml +++ b/lib/ssh/doc/src/notes.xml @@ -29,6 +29,39 @@ <file>notes.xml</file> </header> + <section><title>Ssh 1.1.9</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>The function ssh:connect/4 was not exported.</p> + <p>Own Id: OTP-8550 Aux Id:</p> + </item> + </list> + </section> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>The configuration parameter ip_v6_disabled is now available, + which makes it possible for the user to alter the IP version + SSH shall use.</p> + <p>Own Id: OTP-8535 Aux Id:</p> + </item> + <item> + <p>The ssh_connection:send operation now accepts infinity as timeout.</p> + <p>Own Id: OTP-8534 Aux Id:</p> + </item> + <item> + <p>The connection handler now include stack traces when a channel + message is not handled correctly.</p> + <p>Own Id: OTP-8524 Aux Id:</p> + </item> + </list> + </section> + + </section> + <section><title>Ssh 1.1.8</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 1aea9e76d1..71e6b2cd3d 100644 --- a/lib/ssh/doc/src/ssh.xml +++ b/lib/ssh/doc/src/ssh.xml @@ -159,6 +159,9 @@ <item> <p>Allow an existing file-descriptor to be used (simply passed on to the transport protocol).</p></item> + <tag><c><![CDATA[{ip_v6_disabled, boolean()}]]></c></tag> + <item> + <p>Determines if SSH shall use IPv6 or not.</p></item> </taglist> </desc> </func> @@ -198,8 +201,8 @@ <item> Provides specifications for handling of subsystems. The "sftp" subsystem-spec can be retrieved by calling - ssh_sftd:subsystem_spec/1. If the subsystems option in not present - the value of <c>[ssh_sftd:subsystem_spec([])]</c> will be used. + ssh_sftpd:subsystem_spec/1. If the subsystems option in not present + the value of <c>[ssh_sftpd:subsystem_spec([])]</c> will be used. It is of course possible to set the option to the empty list if you do not want the daemon to run any subsystems at all. </item> @@ -252,6 +255,10 @@ <item> <p>Allow an existing file-descriptor to be used (simply passed on to the transport protocol).</p></item> + <tag><c><![CDATA[{ip_v6_disabled, boolean()}]]></c></tag> + <item> + <p>Determines if SSH shall use IPv6 or not (only used when + HostAddress is set to any).</p></item> </taglist> </desc> </func> diff --git a/lib/ssh/examples/ssh_sample_cli.erl b/lib/ssh/examples/ssh_sample_cli.erl index a6df373379..6f3092e567 100644 --- a/lib/ssh/examples/ssh_sample_cli.erl +++ b/lib/ssh/examples/ssh_sample_cli.erl @@ -30,19 +30,15 @@ %% our command functions -export([cli_prime/1, cli_primes/1, cli_gcd/2, cli_lcm/2, cli_factors/1, cli_exit/0, cli_rho/1, cli_help/0, - cli_crash/0, cli_users/0, cli_self/0, - cli_user/0, cli_host/0]). - -%% imports --import(lists, [reverse/1, reverse/2, seq/2, prefix/2]). --import(math, [sqrt/1]). - + cli_crash/0, cli_self/0, cli_user/0, cli_host/0]). listen(Port) -> listen(Port, []). listen(Port, Options) -> - ssh_cli:listen(fun(U, H) -> start_our_shell(U, H) end, Port, Options). + crypto:start(), + ssh:start(), + ssh:daemon(any, Port, [{shell, fun(U, H) -> start_our_shell(U, H) end} | Options]). %% our_routines our_routines() -> @@ -56,7 +52,6 @@ our_routines() -> {"prime", cli_prime, "<int> check for primality"}, {"primes", cli_primes, "<int> print all primes up to <int>"}, {"rho", cli_rho, "<int> prime factors using rho's alg."}, - {"who", cli_users, " lists users"}, {"user", cli_user, " print name of user"}, {"host", cli_host, " print host addr"}, {"self", cli_self, " print my pid"} @@ -85,11 +80,11 @@ our_routines() -> common_prefix([C | R1], [C | R2], Acc) -> common_prefix(R1, R2, [C | Acc]); common_prefix(_, _, Acc) -> - reverse(Acc). + lists:reverse(Acc). %% longest prefix in a list, given a prefix longest_prefix(List, Prefix) -> - case [A || {A, _, _} <- List, prefix(Prefix, A)] of + case [A || {A, _, _} <- List, lists:prefix(Prefix, A)] of [] -> {none, List}; [S | Rest] -> @@ -112,7 +107,7 @@ longest_prefix(List, Prefix) -> expand([$ | _]) -> {no, "", []}; expand(RevBefore) -> - Before = reverse(RevBefore), + Before = lists:reverse(RevBefore), case longest_prefix(our_routines(), Before) of {prefix, P, [_]} -> {yes, P ++ " ", []}; @@ -139,22 +134,27 @@ start_our_shell(User, Peer) -> %%% an ordinary Read-Eval-Print-loop our_shell_loop() -> % Read - Line = io:get_line({format, "CLI> ", []}), + Line = io:get_line("CLI> "), % Eval Result = eval_cli(Line), % Print io:format("---> ~p\n", [Result]), case Result of - done -> exit(normal); - crash -> 1 / 0; - _ -> our_shell_loop() + done -> + exit(normal); + crash -> + 1 / 0; + _ -> + our_shell_loop() end. %%% translate a command to a function command_to_function(Command) -> case lists:keysearch(Command, 1, our_routines()) of - {value, {_, Proc, _}} -> Proc; - false -> unknown_cli + {value, {_, Proc, _}} -> + Proc; + false -> + unknown_cli end. %%% evaluate a command line @@ -209,14 +209,6 @@ cli_user() -> cli_host() -> get(peer_name). -cli_users() -> - case ssh_userauth:get_auth_users() of - {ok, UsersPids} -> - UsersPids; % [U || {U, _} <- UsersPids]; - E -> - E - end. - cli_self() -> self(). @@ -243,7 +235,7 @@ cli_help() -> %% a quite simple Sieve of Erastothenes (not tail-recursive, though) primes(Size) -> - era(sqrt(Size), seq(2,Size)). + era(math:sqrt(Size), lists:seq(2,Size)). era(Max, [H|T]) when H =< Max -> [H | era(Max, sieve([H|T], H))]; @@ -267,7 +259,7 @@ next_prime(Primes, P) -> next_prime1(Primes, P) -> P1 = P + 2, - case divides(Primes, trunc(sqrt(P1)), P1) of + case divides(Primes, trunc(math:sqrt(P1)), P1) of false -> P1; true -> next_prime1(Primes, P1) end. @@ -282,7 +274,7 @@ divides([_ | R], Nsqrt, N) -> divides(R, Nsqrt, N). is_prime(P) -> - lists:all(fun(A) -> P rem A =/= 0 end, primes(trunc(sqrt(P)))). + lists:all(fun(A) -> P rem A =/= 0 end, primes(trunc(math:sqrt(P)))). %% Normal gcd, Euclid gcd(R, Q) when abs(Q) < abs(R) -> gcd1(Q,R); @@ -300,17 +292,17 @@ lcm(R, Q) -> %%% Prime factors of a number (na�ve implementation) factors(N) -> - Nsqrt = trunc(sqrt(N)), + Nsqrt = trunc(math:sqrt(N)), factors([], N, 2, Nsqrt, []). factors(_Primes, N, Prime, Nsqrt, Factors) when Prime > Nsqrt -> - reverse(Factors, [N]); + lists:reverse(Factors, [N]); factors(Primes, N, Prime, Nsqrt, Factors) -> case N rem Prime of 0 -> %%io:format("factor ------- ~p\n", [Prime]), N1 = N div Prime, - factors(Primes, N1, Prime, trunc(sqrt(N1)), [Prime|Factors]); + factors(Primes, N1, Prime, trunc(math:sqrt(N1)), [Prime|Factors]); _ -> Primes1 = Primes ++ [Prime], Prime1 = next_prime(Primes1, Prime), diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src index 5329373862..8f4b46051d 100644 --- a/lib/ssh/src/ssh.appup.src +++ b/lib/ssh/src/ssh.appup.src @@ -19,7 +19,15 @@ {"%VSN%", [ - {"1.1.7", [{load_module, ssh_connection_handler, soft_purge, soft_purge, []}]}, + {"1.1.8", [{load_module, ssh_connection_manager, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_cli, soft_purge, soft_purge, []}, + {load_module, ssh_connection, soft_purge, soft_purge, []}]}, + {"1.1.7", [{load_module, ssh_connection_handler, soft_purge, soft_purge, []}, + {load_module, ssh_connection, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_cli, soft_purge, soft_purge, []}, + {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}, {"1.1.6", [{restart_application, ssh}]}, {"1.1.5", [{restart_application, ssh}]}, {"1.1.4", [{restart_application, ssh}]}, @@ -27,7 +35,15 @@ {"1.1.2", [{restart_application, ssh}]} ], [ - {"1.1.7", [{load_module, ssh_connection_handler, soft_purge, soft_purge, []}]}, + {"1.1.8", [{load_module, ssh_connection_manager, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_cli, soft_purge, soft_purge, []}, + {load_module, ssh_connection, soft_purge, soft_purge, []}]}, + {"1.1.7", [{load_module, ssh_connection_handler, soft_purge, soft_purge, []}, + {load_module, ssh_connection, soft_purge, soft_purge, []}, + {load_module, ssh, soft_purge, soft_purge, []}, + {load_module, ssh_cli, soft_purge, soft_purge, []}, + {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}, {"1.1.6", [{restart_application, ssh}]}, {"1.1.5", [{restart_application, ssh}]}, {"1.1.4", [{restart_application, ssh}]}, diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 1e98e3d930..994c77436a 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -24,7 +24,7 @@ -include("ssh.hrl"). -include("ssh_connect.hrl"). --export([start/0, start/1, stop/0, connect/3, close/1, connection_info/2, +-export([start/0, start/1, stop/0, connect/3, connect/4, close/1, connection_info/2, channel_info/3, daemon/1, daemon/2, daemon/3, stop_listener/1, stop_listener/2, stop_daemon/1, stop_daemon/2, @@ -330,10 +330,10 @@ handle_options([{nodelay, _} = Opt | Rest], SockOpts, Opts) -> handle_options([Opt | Rest], SockOpts, Opts) -> handle_options(Rest, SockOpts, [Opt | Opts]). +%% Has IPv6 been disabled? inetopt(true) -> - inet6; - + inet; inetopt(false) -> - inet. + inet6. diff --git a/lib/ssh/src/ssh_cli.erl b/lib/ssh/src/ssh_cli.erl index beff6455d1..2764ea2e43 100644 --- a/lib/ssh/src/ssh_cli.erl +++ b/lib/ssh/src/ssh_cli.erl @@ -428,7 +428,7 @@ start_shell(ConnectionManager, State) -> {ok, User} = ssh_userreg:lookup_user(ConnectionManager), {ok, PeerAddr} = - ssh_cm:get_peer_addr(ConnectionManager), + ssh_connection_manager:peer_addr(ConnectionManager), fun() -> Shell(User, PeerAddr) end; _ -> Shell diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index 9fb7d7ac01..b9827c90ea 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -123,6 +123,8 @@ send(ConnectionManager, ChannelId, Data) -> send(ConnectionManager, ChannelId, 0, Data, infinity). send(ConnectionManager, ChannelId, Data, TimeOut) when is_integer(TimeOut) -> send(ConnectionManager, ChannelId, 0, Data, TimeOut); +send(ConnectionManager, ChannelId, Data, infinity) -> + send(ConnectionManager, ChannelId, 0, Data, infinity); send(ConnectionManager, ChannelId, Type, Data) -> send(ConnectionManager, ChannelId, Type, Data, infinity). send(ConnectionManager, ChannelId, Type, Data, TimeOut) -> diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl index 7f0993a5b7..a2effc177e 100644 --- a/lib/ssh/src/ssh_connection_manager.erl +++ b/lib/ssh/src/ssh_connection_manager.erl @@ -272,18 +272,18 @@ handle_call({ssh_msg, Pid, Msg}, From, {stop, normal, State#state{connection_state = Connection}} catch exit:{noproc, Reason} -> - Report = io_lib:format("Connection probably terminated:~n~p~n~p~n", - [ConnectionMsg, Reason]), + Report = io_lib:format("Connection probably terminated:~n~p~n~p~n~p~n", + [ConnectionMsg, Reason, erlang:get_stacktrace()]), error_logger:info_report(Report), {noreply, State}; error:Error -> - Report = io_lib:format("Connection message returned:~n~p~n~p~n", - [ConnectionMsg, Error]), + Report = io_lib:format("Connection message returned:~n~p~n~p~n~p~n", + [ConnectionMsg, Error, erlang:get_stacktrace()]), error_logger:info_report(Report), {noreply, State}; exit:Exit -> - Report = io_lib:format("Connection message returned:~n~p~n~p~n", - [ConnectionMsg, Exit]), + Report = io_lib:format("Connection message returned:~n~p~n~p~n~p~n", + [ConnectionMsg, Exit, erlang:get_stacktrace()]), error_logger:info_report(Report), {noreply, State} end; diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk index bc7bceeb24..074826cafd 100644 --- a/lib/ssh/vsn.mk +++ b/lib/ssh/vsn.mk @@ -1,9 +1,14 @@ #-*-makefile-*- ; force emacs to enter makefile-mode -SSH_VSN = 1.1.8 +SSH_VSN = 1.1.9 APP_VSN = "ssh-$(SSH_VSN)" -TICKETS = OTP-8356 \ +TICKETS = OTP-8524 \ + OTP-8534 \ + OTP-8535 \ + OTP-8550 + +TICKETS_1.1.8 = OTP-8356 \ OTP-8401 TICKETS_1.1.7 = OTP-8121 \ |