Upgrade to version 17.5.6.
- Use PATCHFILES for revision patches, because upstream basically stopped rolling tarballs for minor updates. - Rebuild local patch files to make portlint happier.
This commit is contained in:
parent
e0471dcdf8
commit
704b15243f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=388324
10 changed files with 37 additions and 5313 deletions
|
@ -2,7 +2,7 @@
|
|||
# $FreeBSD$
|
||||
|
||||
PORTNAME= erlang
|
||||
PORTVERSION= 17.5.4
|
||||
PORTVERSION= 17.5.6
|
||||
CATEGORIES= lang parallel java
|
||||
MASTER_SITES= http://www.erlang.org/download/:erlangorg \
|
||||
http://erlang.stacken.kth.se/download/:erlangorg \
|
||||
|
@ -14,6 +14,11 @@ DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:erlangorg \
|
|||
DIST_SUBDIR= erlang
|
||||
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
|
||||
|
||||
PATCH_SITES= http://olgeni.olgeni.com/~olgeni/distfiles/ \
|
||||
LOCAL/olgeni
|
||||
PATCHFILES= patch-otp-17.5.1 patch-otp-17.5.2 patch-otp-17.5.3 \
|
||||
patch-otp-17.5.4 patch-otp-17.5.5 patch-otp-17.5.6
|
||||
|
||||
MAINTAINER= olgeni@FreeBSD.org
|
||||
COMMENT= Functional programming language from Ericsson
|
||||
|
||||
|
@ -158,7 +163,7 @@ MAKE_ARGS+= ARCH=x86
|
|||
|
||||
.if ${ARCH} == armv6
|
||||
MAKE_ARGS+= ARCH=arm
|
||||
.endif
|
||||
.endif
|
||||
|
||||
# The man-pages are put (in spite of FreeBSD's port convention) in a private
|
||||
# subdir. This is to avoid cluttering up the man page name space. Also the
|
||||
|
@ -199,11 +204,11 @@ post-install:
|
|||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/erts-6.4
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/inets-5.10.6/* \
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/inets-5.10.8
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/inets-5.10.9
|
||||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/inets-5.10.6
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssh-3.2/* \
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssh-3.2.3
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssh-3.2.4
|
||||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssh-3.2
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/common_test-1.10/* \
|
||||
|
@ -211,7 +216,7 @@ post-install:
|
|||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/common_test-1.10
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/diameter-1.9/* \
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/diameter-1.9.1
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/diameter-1.9.2
|
||||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/diameter-1.9
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/snmp-5.1.1/* \
|
||||
|
@ -219,9 +224,13 @@ post-install:
|
|||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/snmp-5.1.1
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/test_server-3.8/* \
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/test_server-3.8.1
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/test_server-3.8.1
|
||||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/test_server-3.8
|
||||
|
||||
${MV} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssl-6.0/* \
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssl-6.0.1
|
||||
${RMDIR} ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/ssl-6.0
|
||||
|
||||
${INSTALL_DATA} ${WRKSRC}/lib/dialyzer/doc/*.txt \
|
||||
${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/lib/dialyzer-*/doc/
|
||||
.endif
|
||||
|
|
|
@ -4,3 +4,15 @@ SHA256 (erlang/otp_doc_man_17.5.tar.gz) = 85b1b2a1011fc01af550f1fe9e5a599a4c5f2a
|
|||
SIZE (erlang/otp_doc_man_17.5.tar.gz) = 1363320
|
||||
SHA256 (erlang/otp_doc_html_17.5.tar.gz) = baba1d373c1faacf4a1a6ec1220d57d0cb2b977edb74f32cd58dc786361c6cf5
|
||||
SIZE (erlang/otp_doc_html_17.5.tar.gz) = 33510258
|
||||
SHA256 (erlang/patch-otp-17.5.1) = e95b17b539b84b2408cbdd8af68ea96ad239a1b38117243d21ebb809ab3ca1c3
|
||||
SIZE (erlang/patch-otp-17.5.1) = 36012
|
||||
SHA256 (erlang/patch-otp-17.5.2) = 9c70e90c3b040ab1e136738f355f0925f64afd5a4b28f1c9a6f4035f2bf03b1b
|
||||
SIZE (erlang/patch-otp-17.5.2) = 17821
|
||||
SHA256 (erlang/patch-otp-17.5.3) = fd2879176733c34c002123da9d9b96ac3cf1857c7422a061711be818aecc9e13
|
||||
SIZE (erlang/patch-otp-17.5.3) = 135959
|
||||
SHA256 (erlang/patch-otp-17.5.4) = dce1130adfabe4fdecd1e5e700bea70a5e9ba7886b51c81a7a2371e204d725ca
|
||||
SIZE (erlang/patch-otp-17.5.4) = 14618
|
||||
SHA256 (erlang/patch-otp-17.5.5) = 78f81dc17c52b73d45819de50fc11df3a19ff0593a6d5c6d105b5875c1e654f6
|
||||
SIZE (erlang/patch-otp-17.5.5) = 44523
|
||||
SHA256 (erlang/patch-otp-17.5.6) = 25461538cf79af56ee64019cfb76764bc5c2ac7cc9d3f9061ef01dd93d46ef36
|
||||
SIZE (erlang/patch-otp-17.5.6) = 57264
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- erts/emulator/drivers/common/efile_drv.c.orig
|
||||
--- erts/emulator/drivers/common/efile_drv.c.orig 2015-03-31 12:32:52 UTC
|
||||
+++ erts/emulator/drivers/common/efile_drv.c
|
||||
@@ -1938,6 +1938,8 @@
|
||||
@@ -1938,6 +1938,8 @@ static void invoke_sendfile(void *data)
|
||||
d->result_ok = 1;
|
||||
if (d->c.sendfile.nbytes != 0)
|
||||
d->c.sendfile.nbytes -= nbytes;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- erts/etc/unix/run_erl.c.orig
|
||||
--- erts/etc/unix/run_erl.c.orig 2015-03-31 12:32:52 UTC
|
||||
+++ erts/etc/unix/run_erl.c
|
||||
@@ -69,9 +69,6 @@
|
||||
@@ -73,9 +73,6 @@
|
||||
#ifdef HAVE_UTMP_H
|
||||
# include <utmp.h>
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- lib/erl_interface/src/connect/ei_resolve.c.orig
|
||||
--- lib/erl_interface/src/connect/ei_resolve.c.orig 2015-03-31 12:32:52 UTC
|
||||
+++ lib/erl_interface/src/connect/ei_resolve.c
|
||||
@@ -621,7 +621,8 @@
|
||||
@@ -649,7 +649,8 @@ struct hostent *ei_gethostbyname_r(const
|
||||
|
||||
return result;
|
||||
#else
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- lib/stdlib/src/calendar.erl.orig
|
||||
--- lib/stdlib/src/calendar.erl.orig 2015-03-31 12:32:52 UTC
|
||||
+++ lib/stdlib/src/calendar.erl
|
||||
@@ -215,11 +215,19 @@
|
||||
|
||||
-spec local_time_to_universal_time_dst(t_datetime1970()) -> [t_datetime1970()].
|
||||
@@ -279,11 +279,19 @@ local_time_to_universal_time(DateTime, I
|
||||
DateTime1 :: datetime1970(),
|
||||
DateTime :: datetime1970().
|
||||
local_time_to_universal_time_dst(DateTime) ->
|
||||
- UtDst = erlang:localtime_to_universaltime(DateTime, true),
|
||||
- Ut = erlang:localtime_to_universaltime(DateTime, false),
|
||||
|
|
|
@ -1,826 +0,0 @@
|
|||
diff --git OTP_VERSION OTP_VERSION
|
||||
index 6060b96..9cbaf23 100644
|
||||
--- OTP_VERSION
|
||||
+++ OTP_VERSION
|
||||
@@ -1 +1 @@
|
||||
-17.5
|
||||
+17.5.1
|
||||
diff --git lib/ssh/doc/src/notes.xml lib/ssh/doc/src/notes.xml
|
||||
index f22bca3..acbf312 100644
|
||||
--- lib/ssh/doc/src/notes.xml
|
||||
+++ lib/ssh/doc/src/notes.xml
|
||||
@@ -29,6 +29,28 @@
|
||||
<file>notes.xml</file>
|
||||
</header>
|
||||
|
||||
+<section><title>Ssh 3.2.1</title>
|
||||
+
|
||||
+ <section><title>Fixed Bugs and Malfunctions</title>
|
||||
+ <list>
|
||||
+ <item>
|
||||
+ <p>
|
||||
+ Ssh crashed if a message was sent on a channel with
|
||||
+ packet_size = 0.</p>
|
||||
+ <p>
|
||||
+ A new option for ssh:daemon is also introduced:
|
||||
+ <c>minimal_remote_max_packet_size</c>. This option sets
|
||||
+ the least max packet size declaration that the daemon
|
||||
+ will accept from a client. The default value is 0 to
|
||||
+ maintain compatibility with OpenSSH and the rfc:s.</p>
|
||||
+ <p>
|
||||
+ Own Id: OTP-12645 Aux Id: seq12816 </p>
|
||||
+ </item>
|
||||
+ </list>
|
||||
+ </section>
|
||||
+
|
||||
+</section>
|
||||
+
|
||||
<section><title>Ssh 3.2</title>
|
||||
|
||||
<section><title>Fixed Bugs and Malfunctions</title>
|
||||
diff --git lib/ssh/doc/src/ssh.xml lib/ssh/doc/src/ssh.xml
|
||||
index d481a75..0e7e384 100644
|
||||
--- lib/ssh/doc/src/ssh.xml
|
||||
+++ lib/ssh/doc/src/ssh.xml
|
||||
@@ -338,6 +338,12 @@
|
||||
</warning>
|
||||
</item>
|
||||
|
||||
+ <tag><c><![CDATA[{minimal_remote_max_packet_size, non_negative_integer()}]]></c></tag>
|
||||
+ <item>
|
||||
+ <p>The least maximum packet size that the daemon will accept in channel open requests from the client. The default value is 0.
|
||||
+ </p>
|
||||
+ </item>
|
||||
+
|
||||
<tag><c><![CDATA[{key_cb, atom()}]]></c></tag>
|
||||
<item>
|
||||
<p>Module implementing the behaviour <seealso marker="ssh_server_key_api">ssh_server_key_api</seealso>.
|
||||
diff --git lib/ssh/src/ssh.appup.src lib/ssh/src/ssh.appup.src
|
||||
index b2b2994..e76c110 100644
|
||||
--- lib/ssh/src/ssh.appup.src
|
||||
+++ lib/ssh/src/ssh.appup.src
|
||||
@@ -1,7 +1,7 @@
|
||||
%% -*- erlang -*-
|
||||
%% %CopyrightBegin%
|
||||
%%
|
||||
-%% Copyright Ericsson AB 2004-2014. All Rights Reserved.
|
||||
+%% Copyright Ericsson AB 2004-2015. 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
|
||||
@@ -19,61 +19,9 @@
|
||||
|
||||
{"%VSN%",
|
||||
[
|
||||
- {"3.0.8", [{load_module, ssh_connection, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_sftp, soft_purge, soft_purge, [ssh_xfer]},
|
||||
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_xfer, soft_purge, soft_purge, []}
|
||||
- ]},
|
||||
- {"3.0.7", [{load_module, ssh_auth, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_acceptor, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_channel, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_info, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_message, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_io, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_sftp, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_xfer, soft_purge, soft_purge, [ssh_connection_handler]}]},
|
||||
- {"3.0.6", [{load_module, ssh_auth, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_acceptor, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_channel, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_info, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_message, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_io, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_sftp, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_xfer, soft_purge, soft_purge, [ssh_connection_handler]}]},
|
||||
{<<".*">>, [{restart_application, ssh}]}
|
||||
],
|
||||
[
|
||||
- {"3.0.8", [{load_module, ssh_connection, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_sftp, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_xfer, soft_purge, soft_purge, []}
|
||||
- ]},
|
||||
- {"3.0.7", [{load_module, ssh_auth, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_acceptor, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_channel, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_info, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_message, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_io, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_sftp, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_xfer, soft_purge, soft_purge, [ssh_connection_handler]}]},
|
||||
- {"3.0.6", [{load_module, ssh_auth, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_acceptor, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_channel, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_info, soft_purge, soft_purge, []},
|
||||
- {load_module, ssh_message, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_io, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_sftp, soft_purge, soft_purge, [ssh_connection_handler]},
|
||||
- {load_module, ssh_xfer, soft_purge, soft_purge, [ssh_connection_handler]}]},
|
||||
{<<".*">>, [{restart_application, ssh}]}
|
||||
]
|
||||
}.
|
||||
diff --git lib/ssh/src/ssh.erl lib/ssh/src/ssh.erl
|
||||
index eae33e3..51ad691 100644
|
||||
--- lib/ssh/src/ssh.erl
|
||||
+++ lib/ssh/src/ssh.erl
|
||||
@@ -345,9 +345,14 @@ handle_option([{parallel_login, _} = Opt|Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
handle_option([parallel_login|Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option({parallel_login,true}) | SshOptions]);
|
||||
+handle_option([{minimal_remote_max_packet_size, _} = Opt|Rest], SocketOptions, SshOptions) ->
|
||||
+ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
handle_option([Opt | Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, [handle_inet_option(Opt) | SocketOptions], SshOptions).
|
||||
|
||||
+
|
||||
+handle_ssh_option({minimal_remote_max_packet_size, Value} = Opt) when is_integer(Value), Value >=0 ->
|
||||
+ Opt;
|
||||
handle_ssh_option({system_dir, Value} = Opt) when is_list(Value) ->
|
||||
Opt;
|
||||
handle_ssh_option({user_dir, Value} = Opt) when is_list(Value) ->
|
||||
diff --git lib/ssh/src/ssh_acceptor.erl lib/ssh/src/ssh_acceptor.erl
|
||||
index 6c443ee..34988f1 100644
|
||||
--- lib/ssh/src/ssh_acceptor.erl
|
||||
+++ lib/ssh/src/ssh_acceptor.erl
|
||||
@@ -1,7 +1,7 @@
|
||||
%%
|
||||
%% %CopyrightBegin%
|
||||
%%
|
||||
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
|
||||
+%% Copyright Ericsson AB 2008-2015. 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
|
||||
@@ -43,7 +43,7 @@ start_link(Port, Address, SockOpts, Opts, AcceptTimeout) ->
|
||||
acceptor_init(Parent, Port, Address, SockOpts, Opts, AcceptTimeout) ->
|
||||
{_, Callback, _} =
|
||||
proplists:get_value(transport, Opts, {tcp, gen_tcp, tcp_closed}),
|
||||
- case (catch do_socket_listen(Callback, Port, SockOpts)) of
|
||||
+ case (catch do_socket_listen(Callback, Port, [{active, false} | SockOpts])) of
|
||||
{ok, ListenSocket} ->
|
||||
proc_lib:init_ack(Parent, {ok, self()}),
|
||||
acceptor_loop(Callback,
|
||||
diff --git lib/ssh/src/ssh_connection.erl lib/ssh/src/ssh_connection.erl
|
||||
index c66f810..654b9d4 100644
|
||||
--- lib/ssh/src/ssh_connection.erl
|
||||
+++ lib/ssh/src/ssh_connection.erl
|
||||
@@ -1,7 +1,7 @@
|
||||
%%
|
||||
%% %CopyrightBegin%
|
||||
%%
|
||||
-%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
|
||||
+%% Copyright Ericsson AB 2008-2015. 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
|
||||
@@ -326,9 +326,7 @@ channel_data(ChannelId, DataType, Data,
|
||||
SendDataType,
|
||||
SendData)}
|
||||
end, SendList),
|
||||
- FlowCtrlMsgs = flow_control(Replies,
|
||||
- Channel,
|
||||
- Cache),
|
||||
+ FlowCtrlMsgs = flow_control(Replies, Channel, Cache),
|
||||
{{replies, Replies ++ FlowCtrlMsgs}, Connection};
|
||||
_ ->
|
||||
gen_fsm:reply(From, {error, closed}),
|
||||
@@ -470,18 +468,31 @@ handle_msg(#ssh_msg_channel_window_adjust{recipient_channel = ChannelId,
|
||||
handle_msg(#ssh_msg_channel_open{channel_type = "session" = Type,
|
||||
sender_channel = RemoteId,
|
||||
initial_window_size = WindowSz,
|
||||
- maximum_packet_size = PacketSz}, Connection0, server) ->
|
||||
-
|
||||
- try setup_session(Connection0, RemoteId,
|
||||
- Type, WindowSz, PacketSz) of
|
||||
- Result ->
|
||||
- Result
|
||||
- catch _:_ ->
|
||||
+ maximum_packet_size = PacketSz},
|
||||
+ #connection{options = SSHopts} = Connection0,
|
||||
+ server) ->
|
||||
+ MinAcceptedPackSz = proplists:get_value(minimal_remote_max_packet_size, SSHopts, 0),
|
||||
+
|
||||
+ if
|
||||
+ MinAcceptedPackSz =< PacketSz ->
|
||||
+ try setup_session(Connection0, RemoteId,
|
||||
+ Type, WindowSz, PacketSz) of
|
||||
+ Result ->
|
||||
+ Result
|
||||
+ catch _:_ ->
|
||||
+ FailMsg = channel_open_failure_msg(RemoteId,
|
||||
+ ?SSH_OPEN_CONNECT_FAILED,
|
||||
+ "Connection refused", "en"),
|
||||
+ {{replies, [{connection_reply, FailMsg}]},
|
||||
+ Connection0}
|
||||
+ end;
|
||||
+
|
||||
+ MinAcceptedPackSz > PacketSz ->
|
||||
FailMsg = channel_open_failure_msg(RemoteId,
|
||||
- ?SSH_OPEN_CONNECT_FAILED,
|
||||
- "Connection refused", "en"),
|
||||
- {{replies, [{connection_reply, FailMsg}]},
|
||||
- Connection0}
|
||||
+ ?SSH_OPEN_ADMINISTRATIVELY_PROHIBITED,
|
||||
+ lists:concat(["Maximum packet size below ",MinAcceptedPackSz,
|
||||
+ " not supported"]), "en"),
|
||||
+ {{replies, [{connection_reply, FailMsg}]}, Connection0}
|
||||
end;
|
||||
|
||||
handle_msg(#ssh_msg_channel_open{channel_type = "session",
|
||||
@@ -501,41 +512,57 @@ handle_msg(#ssh_msg_channel_open{channel_type = "forwarded-tcpip" = Type,
|
||||
initial_window_size = RWindowSz,
|
||||
maximum_packet_size = RPacketSz,
|
||||
data = Data},
|
||||
- #connection{channel_cache = Cache} = Connection0, server) ->
|
||||
+ #connection{channel_cache = Cache,
|
||||
+ options = SSHopts} = Connection0, server) ->
|
||||
<<?UINT32(ALen), Address:ALen/binary, ?UINT32(Port),
|
||||
?UINT32(OLen), Orig:OLen/binary, ?UINT32(OrigPort)>> = Data,
|
||||
|
||||
- case bound_channel(Address, Port, Connection0) of
|
||||
- undefined ->
|
||||
+ MinAcceptedPackSz = proplists:get_value(minimal_remote_max_packet_size, SSHopts, 0),
|
||||
+
|
||||
+ if
|
||||
+ MinAcceptedPackSz =< RPacketSz ->
|
||||
+ case bound_channel(Address, Port, Connection0) of
|
||||
+ undefined ->
|
||||
+ FailMsg = channel_open_failure_msg(RemoteId,
|
||||
+ ?SSH_OPEN_CONNECT_FAILED,
|
||||
+ "Connection refused", "en"),
|
||||
+ {{replies,
|
||||
+ [{connection_reply, FailMsg}]}, Connection0};
|
||||
+ ChannelPid ->
|
||||
+ {ChannelId, Connection1} = new_channel_id(Connection0),
|
||||
+ LWindowSz = ?DEFAULT_WINDOW_SIZE,
|
||||
+ LPacketSz = ?DEFAULT_PACKET_SIZE,
|
||||
+ Channel = #channel{type = Type,
|
||||
+ sys = "none",
|
||||
+ user = ChannelPid,
|
||||
+ local_id = ChannelId,
|
||||
+ recv_window_size = LWindowSz,
|
||||
+ recv_packet_size = LPacketSz,
|
||||
+ send_window_size = RWindowSz,
|
||||
+ send_packet_size = RPacketSz,
|
||||
+ send_buf = queue:new()
|
||||
+ },
|
||||
+ ssh_channel:cache_update(Cache, Channel),
|
||||
+ OpenConfMsg = channel_open_confirmation_msg(RemoteId, ChannelId,
|
||||
+ LWindowSz, LPacketSz),
|
||||
+ {OpenMsg, Connection} =
|
||||
+ reply_msg(Channel, Connection1,
|
||||
+ {open, Channel, {forwarded_tcpip,
|
||||
+ decode_ip(Address), Port,
|
||||
+ decode_ip(Orig), OrigPort}}),
|
||||
+ {{replies, [{connection_reply, OpenConfMsg},
|
||||
+ OpenMsg]}, Connection}
|
||||
+ end;
|
||||
+
|
||||
+ MinAcceptedPackSz > RPacketSz ->
|
||||
FailMsg = channel_open_failure_msg(RemoteId,
|
||||
- ?SSH_OPEN_CONNECT_FAILED,
|
||||
- "Connection refused", "en"),
|
||||
- {{replies,
|
||||
- [{connection_reply, FailMsg}]}, Connection0};
|
||||
- ChannelPid ->
|
||||
- {ChannelId, Connection1} = new_channel_id(Connection0),
|
||||
- LWindowSz = ?DEFAULT_WINDOW_SIZE,
|
||||
- LPacketSz = ?DEFAULT_PACKET_SIZE,
|
||||
- Channel = #channel{type = Type,
|
||||
- sys = "none",
|
||||
- user = ChannelPid,
|
||||
- local_id = ChannelId,
|
||||
- recv_window_size = LWindowSz,
|
||||
- recv_packet_size = LPacketSz,
|
||||
- send_window_size = RWindowSz,
|
||||
- send_packet_size = RPacketSz},
|
||||
- ssh_channel:cache_update(Cache, Channel),
|
||||
- OpenConfMsg = channel_open_confirmation_msg(RemoteId, ChannelId,
|
||||
- LWindowSz, LPacketSz),
|
||||
- {OpenMsg, Connection} =
|
||||
- reply_msg(Channel, Connection1,
|
||||
- {open, Channel, {forwarded_tcpip,
|
||||
- decode_ip(Address), Port,
|
||||
- decode_ip(Orig), OrigPort}}),
|
||||
- {{replies, [{connection_reply, OpenConfMsg},
|
||||
- OpenMsg]}, Connection}
|
||||
+ ?SSH_OPEN_ADMINISTRATIVELY_PROHIBITED,
|
||||
+ lists:concat(["Maximum packet size below ",MinAcceptedPackSz,
|
||||
+ " not supported"]), "en"),
|
||||
+ {{replies, [{connection_reply, FailMsg}]}, Connection0}
|
||||
end;
|
||||
|
||||
+
|
||||
handle_msg(#ssh_msg_channel_open{channel_type = "forwarded-tcpip",
|
||||
sender_channel = RemoteId},
|
||||
Connection, client) ->
|
||||
@@ -917,7 +944,8 @@ start_channel(Cb, Id, Args, SubSysSup, Exec) ->
|
||||
%%--------------------------------------------------------------------
|
||||
%%% Internal functions
|
||||
%%--------------------------------------------------------------------
|
||||
-setup_session(#connection{channel_cache = Cache} = Connection0,
|
||||
+setup_session(#connection{channel_cache = Cache
|
||||
+ } = Connection0,
|
||||
RemoteId,
|
||||
Type, WindowSize, PacketSize) ->
|
||||
{ChannelId, Connection} = new_channel_id(Connection0),
|
||||
@@ -929,6 +957,7 @@ setup_session(#connection{channel_cache = Cache} = Connection0,
|
||||
recv_packet_size = ?DEFAULT_PACKET_SIZE,
|
||||
send_window_size = WindowSize,
|
||||
send_packet_size = PacketSize,
|
||||
+ send_buf = queue:new(),
|
||||
remote_id = RemoteId
|
||||
},
|
||||
ssh_channel:cache_update(Cache, Channel),
|
||||
@@ -1024,63 +1053,74 @@ request_reply_or_data(#channel{local_id = ChannelId, user = ChannelPid},
|
||||
|
||||
update_send_window(Channel, _, undefined,
|
||||
#connection{channel_cache = Cache}) ->
|
||||
- do_update_send_window(Channel, Channel#channel.send_buf, Cache);
|
||||
+ do_update_send_window(Channel, Cache);
|
||||
|
||||
-update_send_window(Channel, DataType, Data,
|
||||
+update_send_window(#channel{send_buf = SendBuffer} = Channel, DataType, Data,
|
||||
#connection{channel_cache = Cache}) ->
|
||||
- do_update_send_window(Channel, Channel#channel.send_buf ++ [{DataType, Data}], Cache).
|
||||
+ do_update_send_window(Channel#channel{send_buf = queue:in({DataType, Data}, SendBuffer)},
|
||||
+ Cache).
|
||||
|
||||
-do_update_send_window(Channel0, Buf0, Cache) ->
|
||||
- {Buf1, NewSz, Buf2} = get_window(Buf0,
|
||||
- Channel0#channel.send_packet_size,
|
||||
- Channel0#channel.send_window_size),
|
||||
-
|
||||
- Channel = Channel0#channel{send_window_size = NewSz, send_buf = Buf2},
|
||||
+do_update_send_window(Channel0, Cache) ->
|
||||
+ {SendMsgs, Channel} = get_window(Channel0, []),
|
||||
ssh_channel:cache_update(Cache, Channel),
|
||||
- {Buf1, Channel}.
|
||||
+ {SendMsgs, Channel}.
|
||||
|
||||
-get_window(Bs, PSz, WSz) ->
|
||||
- get_window(Bs, PSz, WSz, []).
|
||||
-
|
||||
-get_window(Bs, _PSz, 0, Acc) ->
|
||||
- {lists:reverse(Acc), 0, Bs};
|
||||
-get_window([B0 = {DataType, Bin} | Bs], PSz, WSz, Acc) ->
|
||||
- BSz = size(Bin),
|
||||
- if BSz =< WSz -> %% will fit into window
|
||||
- if BSz =< PSz -> %% will fit into a packet
|
||||
- get_window(Bs, PSz, WSz-BSz, [B0|Acc]);
|
||||
- true -> %% split into packet size
|
||||
- <<Bin1:PSz/binary, Bin2/binary>> = Bin,
|
||||
- get_window([setelement(2, B0, Bin2) | Bs],
|
||||
- PSz, WSz-PSz,
|
||||
- [{DataType, Bin1}|Acc])
|
||||
+get_window(#channel{send_window_size = 0
|
||||
+ } = Channel, Acc) ->
|
||||
+ {lists:reverse(Acc), Channel};
|
||||
+get_window(#channel{send_packet_size = 0
|
||||
+ } = Channel, Acc) ->
|
||||
+ {lists:reverse(Acc), Channel};
|
||||
+get_window(#channel{send_buf = Buffer,
|
||||
+ send_packet_size = PacketSize,
|
||||
+ send_window_size = WindowSize0
|
||||
+ } = Channel, Acc0) ->
|
||||
+ case queue:out(Buffer) of
|
||||
+ {{value, {_, Data} = Msg}, NewBuffer} ->
|
||||
+ case handle_send_window(Msg, size(Data), PacketSize, WindowSize0, Acc0) of
|
||||
+ {WindowSize, Acc, {_, <<>>}} ->
|
||||
+ {lists:reverse(Acc), Channel#channel{send_window_size = WindowSize,
|
||||
+ send_buf = NewBuffer}};
|
||||
+ {WindowSize, Acc, Rest} ->
|
||||
+ get_window(Channel#channel{send_window_size = WindowSize,
|
||||
+ send_buf = queue:in_r(Rest, NewBuffer)}, Acc)
|
||||
end;
|
||||
- WSz =< PSz -> %% use rest of window
|
||||
- <<Bin1:WSz/binary, Bin2/binary>> = Bin,
|
||||
- get_window([setelement(2, B0, Bin2) | Bs],
|
||||
- PSz, WSz-WSz,
|
||||
- [{DataType, Bin1}|Acc]);
|
||||
- true -> %% use packet size
|
||||
- <<Bin1:PSz/binary, Bin2/binary>> = Bin,
|
||||
- get_window([setelement(2, B0, Bin2) | Bs],
|
||||
- PSz, WSz-PSz,
|
||||
- [{DataType, Bin1}|Acc])
|
||||
+ {empty, NewBuffer} ->
|
||||
+ {[], Channel#channel{send_buf = NewBuffer}}
|
||||
+ end.
|
||||
+
|
||||
+handle_send_window(Msg = {Type, Data}, Size, PacketSize, WindowSize, Acc) when Size =< WindowSize ->
|
||||
+ case Size =< PacketSize of
|
||||
+ true ->
|
||||
+ {WindowSize - Size, [Msg | Acc], {Type, <<>>}};
|
||||
+ false ->
|
||||
+ <<Msg1:PacketSize/binary, Msg2/binary>> = Data,
|
||||
+ {WindowSize - PacketSize, [{Type, Msg1} | Acc], {Type, Msg2}}
|
||||
end;
|
||||
-get_window([], _PSz, WSz, Acc) ->
|
||||
- {lists:reverse(Acc), WSz, []}.
|
||||
+handle_send_window({Type, Data}, _, PacketSize, WindowSize, Acc) when WindowSize =< PacketSize ->
|
||||
+ <<Msg1:WindowSize/binary, Msg2/binary>> = Data,
|
||||
+ {WindowSize - WindowSize, [{Type, Msg1} | Acc], {Type, Msg2}};
|
||||
+handle_send_window({Type, Data}, _, PacketSize, WindowSize, Acc) ->
|
||||
+ <<Msg1:PacketSize/binary, Msg2/binary>> = Data,
|
||||
+ {WindowSize - PacketSize, [{Type, Msg1} | Acc], {Type, Msg2}}.
|
||||
|
||||
flow_control(Channel, Cache) ->
|
||||
flow_control([window_adjusted], Channel, Cache).
|
||||
-
|
||||
+
|
||||
flow_control([], Channel, Cache) ->
|
||||
ssh_channel:cache_update(Cache, Channel),
|
||||
[];
|
||||
-
|
||||
flow_control([_|_], #channel{flow_control = From,
|
||||
- send_buf = []} = Channel, Cache) when From =/= undefined ->
|
||||
- [{flow_control, Cache, Channel, From, ok}];
|
||||
+ send_buf = Buffer} = Channel, Cache) when From =/= undefined ->
|
||||
+ case queue:is_empty(Buffer) of
|
||||
+ true ->
|
||||
+ ssh_channel:cache_update(Cache, Channel#channel{flow_control = undefined}),
|
||||
+ [{flow_control, Cache, Channel, From, ok}];
|
||||
+ false ->
|
||||
+ []
|
||||
+ end;
|
||||
flow_control(_,_,_) ->
|
||||
- [].
|
||||
+ [].
|
||||
|
||||
pty_req(ConnectionHandler, Channel, Term, Width, Height,
|
||||
PixWidth, PixHeight, PtyOpts, TimeOut) ->
|
||||
diff --git lib/ssh/src/ssh_connection_handler.erl lib/ssh/src/ssh_connection_handler.erl
|
||||
index 68523aa..e1f2e05 100644
|
||||
--- lib/ssh/src/ssh_connection_handler.erl
|
||||
+++ lib/ssh/src/ssh_connection_handler.erl
|
||||
@@ -1,7 +1,7 @@
|
||||
%%
|
||||
%% %CopyrightBegin%
|
||||
%%
|
||||
-%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
|
||||
+%% Copyright Ericsson AB 2008-2015. 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
|
||||
@@ -751,7 +751,9 @@ handle_sync_event({open, ChannelPid, Type, InitialWindowSize, MaxPacketSize, Dat
|
||||
user = ChannelPid,
|
||||
local_id = ChannelId,
|
||||
recv_window_size = InitialWindowSize,
|
||||
- recv_packet_size = MaxPacketSize},
|
||||
+ recv_packet_size = MaxPacketSize,
|
||||
+ send_buf = queue:new()
|
||||
+ },
|
||||
ssh_channel:cache_update(Cache, Channel),
|
||||
State = add_request(true, ChannelId, From, State2),
|
||||
start_timeout(ChannelId, From, Timeout),
|
||||
@@ -1241,10 +1243,9 @@ event(Event, StateName, State) ->
|
||||
handle_disconnect(DisconnectMsg, State);
|
||||
throw:{ErrorToDisplay, #ssh_msg_disconnect{} = DisconnectMsg} ->
|
||||
handle_disconnect(DisconnectMsg, State, ErrorToDisplay);
|
||||
- _:Error ->
|
||||
- log_error(Error),
|
||||
+ _:_ ->
|
||||
handle_disconnect(#ssh_msg_disconnect{code = error_code(StateName),
|
||||
- description = "Internal error",
|
||||
+ description = "Invalid state",
|
||||
language = "en"}, State)
|
||||
end.
|
||||
error_code(key_exchange) ->
|
||||
diff --git lib/ssh/src/ssh_info.erl lib/ssh/src/ssh_info.erl
|
||||
index 9a91875..30df32c 100644
|
||||
--- lib/ssh/src/ssh_info.erl
|
||||
+++ lib/ssh/src/ssh_info.erl
|
||||
@@ -27,18 +27,21 @@
|
||||
-compile(export_all).
|
||||
|
||||
print() ->
|
||||
+ print(user).
|
||||
+
|
||||
+print(D) ->
|
||||
try supervisor:which_children(ssh_sup)
|
||||
of
|
||||
_ ->
|
||||
- io:nl(),
|
||||
- print_general(),
|
||||
- io:nl(),
|
||||
- underline("Client part", $=),
|
||||
- print_clients(),
|
||||
- io:nl(),
|
||||
- underline("Server part", $=),
|
||||
- print_servers(),
|
||||
- io:nl(),
|
||||
+ io:nl(D),
|
||||
+ print_general(D),
|
||||
+ io:nl(D),
|
||||
+ underline(D, "Client part", $=),
|
||||
+ print_clients(D),
|
||||
+ io:nl(D),
|
||||
+ underline(D, "Server part", $=),
|
||||
+ print_servers(D),
|
||||
+ io:nl(D),
|
||||
%% case os:type() of
|
||||
%% {unix,_} ->
|
||||
%% io:nl(),
|
||||
@@ -50,90 +53,95 @@ print() ->
|
||||
%% catch io:format(os:cmd("netstat -tpn"));
|
||||
%% _ -> ok
|
||||
%% end,
|
||||
- underline("Supervisors", $=),
|
||||
- walk_sups(ssh_sup),
|
||||
- io:nl()
|
||||
+ underline(D, "Supervisors", $=),
|
||||
+ walk_sups(D, ssh_sup),
|
||||
+ io:nl(D)
|
||||
catch
|
||||
_:_ ->
|
||||
- io:format("Ssh not found~n",[])
|
||||
+ io:format(D,"Ssh not found~n",[])
|
||||
end.
|
||||
|
||||
%%%================================================================
|
||||
-print_general() ->
|
||||
+print_general(D) ->
|
||||
{_Name, Slogan, Ver} = lists:keyfind(ssh,1,application:which_applications()),
|
||||
- underline(io_lib:format("~s ~s", [Slogan, Ver]), $=),
|
||||
- io:format('This printout is generated ~s. ~n',[datetime()]).
|
||||
+ underline(D, io_lib:format("~s ~s", [Slogan, Ver]), $=),
|
||||
+ io:format(D, 'This printout is generated ~s. ~n',[datetime()]).
|
||||
|
||||
%%%================================================================
|
||||
-print_clients() ->
|
||||
+print_clients(D) ->
|
||||
+ PrintClient = fun(X) -> print_client(D,X) end,
|
||||
try
|
||||
- lists:foreach(fun print_client/1, supervisor:which_children(sshc_sup))
|
||||
+ lists:foreach(PrintClient, supervisor:which_children(sshc_sup))
|
||||
catch
|
||||
C:E ->
|
||||
- io:format('***FAILED: ~p:~p~n',[C,E])
|
||||
+ io:format(D, '***FAILED: ~p:~p~n',[C,E])
|
||||
end.
|
||||
|
||||
-print_client({undefined,Pid,supervisor,[ssh_connection_handler]}) ->
|
||||
+print_client(D, {undefined,Pid,supervisor,[ssh_connection_handler]}) ->
|
||||
{{Local,Remote},_Str} = ssh_connection_handler:get_print_info(Pid),
|
||||
- io:format(" Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]);
|
||||
-print_client(Other) ->
|
||||
- io:format(" [[Other 1: ~p]]~n",[Other]).
|
||||
+ io:format(D, " Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]);
|
||||
+print_client(D, Other) ->
|
||||
+ io:format(D, " [[Other 1: ~p]]~n",[Other]).
|
||||
|
||||
|
||||
%%%================================================================
|
||||
-print_servers() ->
|
||||
+print_servers(D) ->
|
||||
+ PrintServer = fun(X) -> print_server(D,X) end,
|
||||
try
|
||||
- lists:foreach(fun print_server/1, supervisor:which_children(sshd_sup))
|
||||
+ lists:foreach(PrintServer, supervisor:which_children(sshd_sup))
|
||||
catch
|
||||
C:E ->
|
||||
- io:format('***FAILED: ~p:~p~n',[C,E])
|
||||
+ io:format(D, '***FAILED: ~p:~p~n',[C,E])
|
||||
end.
|
||||
|
||||
-print_server({{server,ssh_system_sup,LocalHost,LocalPort},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) ->
|
||||
- io:format('Local=~s (~p children)~n',[fmt_host_port({LocalHost,LocalPort}),
|
||||
- ssh_acceptor:number_of_connections(Pid)]),
|
||||
- lists:foreach(fun print_system_sup/1, supervisor:which_children(Pid));
|
||||
-print_server(Other) ->
|
||||
- io:format(" [[Other 2: ~p]]~n",[Other]).
|
||||
+print_server(D, {{server,ssh_system_sup,LocalHost,LocalPort},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) ->
|
||||
+ io:format(D, 'Local=~s (~p children)~n',[fmt_host_port({LocalHost,LocalPort}),
|
||||
+ ssh_acceptor:number_of_connections(Pid)]),
|
||||
+ PrintSystemSup = fun(X) -> print_system_sup(D,X) end,
|
||||
+ lists:foreach(PrintSystemSup, supervisor:which_children(Pid));
|
||||
+print_server(D, Other) ->
|
||||
+ io:format(D, " [[Other 2: ~p]]~n",[Other]).
|
||||
|
||||
-print_system_sup({Ref,Pid,supervisor,[ssh_subsystem_sup]}) when is_reference(Ref),
|
||||
+print_system_sup(D, {Ref,Pid,supervisor,[ssh_subsystem_sup]}) when is_reference(Ref),
|
||||
is_pid(Pid) ->
|
||||
- lists:foreach(fun print_channels/1, supervisor:which_children(Pid));
|
||||
-print_system_sup({{ssh_acceptor_sup,LocalHost,LocalPort}, Pid,supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) ->
|
||||
- io:format(" [Acceptor for ~s]~n",[fmt_host_port({LocalHost,LocalPort})]);
|
||||
-print_system_sup(Other) ->
|
||||
- io:format(" [[Other 3: ~p]]~n",[Other]).
|
||||
+ PrintChannels = fun(X) -> print_channels(D,X) end,
|
||||
+ lists:foreach(PrintChannels, supervisor:which_children(Pid));
|
||||
+print_system_sup(D, {{ssh_acceptor_sup,LocalHost,LocalPort}, Pid,supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) ->
|
||||
+ io:format(D, " [Acceptor for ~s]~n",[fmt_host_port({LocalHost,LocalPort})]);
|
||||
+print_system_sup(D, Other) ->
|
||||
+ io:format(D, " [[Other 3: ~p]]~n",[Other]).
|
||||
|
||||
-print_channels({{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) ->
|
||||
- lists:foreach(fun print_channel/1, supervisor:which_children(Pid));
|
||||
-print_channels(Other) ->
|
||||
- io:format(" [[Other 4: ~p]]~n",[Other]).
|
||||
+print_channels(D, {{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) ->
|
||||
+ PrintChannel = fun(X) -> print_channel(D,X) end,
|
||||
+ lists:foreach(PrintChannel, supervisor:which_children(Pid));
|
||||
+print_channels(D, Other) ->
|
||||
+ io:format(D, " [[Other 4: ~p]]~n",[Other]).
|
||||
|
||||
|
||||
-print_channel({Ref,Pid,worker,[ssh_channel]}) when is_reference(Ref),
|
||||
- is_pid(Pid) ->
|
||||
+print_channel(D, {Ref,Pid,worker,[ssh_channel]}) when is_reference(Ref),
|
||||
+ is_pid(Pid) ->
|
||||
{{ConnManager,ChannelID}, Str} = ssh_channel:get_print_info(Pid),
|
||||
{{Local,Remote},StrM} = ssh_connection_handler:get_print_info(ConnManager),
|
||||
- io:format(' ch ~p: ~s ~s',[ChannelID, StrM, Str]),
|
||||
- io:format(" Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]);
|
||||
-print_channel(Other) ->
|
||||
- io:format(" [[Other 5: ~p]]~n",[Other]).
|
||||
+ io:format(D, ' ch ~p: ~s ~s',[ChannelID, StrM, Str]),
|
||||
+ io:format(D, " Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]);
|
||||
+print_channel(D, Other) ->
|
||||
+ io:format(D, " [[Other 5: ~p]]~n",[Other]).
|
||||
|
||||
%%%================================================================
|
||||
-define(inc(N), (N+4)).
|
||||
|
||||
-walk_sups(StartPid) ->
|
||||
- io:format("Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]),
|
||||
- walk_sups(children(StartPid), _Indent=?inc(0)).
|
||||
+walk_sups(D, StartPid) ->
|
||||
+ io:format(D, "Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]),
|
||||
+ walk_sups(D, children(StartPid), _Indent=?inc(0)).
|
||||
|
||||
-walk_sups([H={_,Pid,SupOrWorker,_}|T], Indent) ->
|
||||
- indent(Indent), io:format('~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]),
|
||||
+walk_sups(D, [H={_,Pid,SupOrWorker,_}|T], Indent) ->
|
||||
+ indent(D, Indent), io:format(D, '~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]),
|
||||
case SupOrWorker of
|
||||
- supervisor -> walk_sups(children(Pid), ?inc(Indent));
|
||||
+ supervisor -> walk_sups(D, children(Pid), ?inc(Indent));
|
||||
_ -> ok
|
||||
end,
|
||||
- walk_sups(T, Indent);
|
||||
-walk_sups([], _) ->
|
||||
+ walk_sups(D, T, Indent);
|
||||
+walk_sups(_D, [], _) ->
|
||||
ok.
|
||||
|
||||
dead_or_alive(Name) when is_atom(Name) ->
|
||||
@@ -149,7 +157,7 @@ dead_or_alive(Pid) when is_pid(Pid) ->
|
||||
_ -> "alive"
|
||||
end.
|
||||
|
||||
-indent(I) -> io:format('~*c',[I,$ ]).
|
||||
+indent(D, I) -> io:format(D,'~*c',[I,$ ]).
|
||||
|
||||
children(Pid) ->
|
||||
Parent = self(),
|
||||
@@ -166,16 +174,16 @@ children(Pid) ->
|
||||
end.
|
||||
|
||||
%%%================================================================
|
||||
-underline(Str) ->
|
||||
- underline(Str, $-).
|
||||
+underline(D, Str) ->
|
||||
+ underline(D, Str, $-).
|
||||
|
||||
-underline(Str, LineChar) ->
|
||||
+underline(D, Str, LineChar) ->
|
||||
Len = lists:flatlength(Str),
|
||||
- io:format('~s~n',[Str]),
|
||||
- line(Len,LineChar).
|
||||
+ io:format(D, '~s~n',[Str]),
|
||||
+ line(D,Len,LineChar).
|
||||
|
||||
-line(Len, Char) ->
|
||||
- io:format('~*c~n', [Len,Char]).
|
||||
+line(D, Len, Char) ->
|
||||
+ io:format(D, '~*c~n', [Len,Char]).
|
||||
|
||||
|
||||
datetime() ->
|
||||
@@ -188,6 +196,6 @@ fmt_host_port({Host,Port}) -> io_lib:format('~s:~p',[Host,Port]).
|
||||
|
||||
|
||||
|
||||
-nyi() ->
|
||||
- io:format('Not yet implemented~n',[]),
|
||||
+nyi(D) ->
|
||||
+ io:format(D,'Not yet implemented~n',[]),
|
||||
nyi.
|
||||
diff --git lib/ssh/test/ssh_basic_SUITE.erl lib/ssh/test/ssh_basic_SUITE.erl
|
||||
index 45c0303..81c7b5c 100644
|
||||
--- lib/ssh/test/ssh_basic_SUITE.erl
|
||||
+++ lib/ssh/test/ssh_basic_SUITE.erl
|
||||
@@ -50,6 +50,8 @@ all() ->
|
||||
double_close,
|
||||
ssh_connect_timeout,
|
||||
ssh_connect_arg4_timeout,
|
||||
+ packet_size_zero,
|
||||
+ ssh_daemon_minimal_remote_max_packet_size_option,
|
||||
{group, hardening_tests}
|
||||
].
|
||||
|
||||
@@ -757,6 +759,64 @@ ms_passed(N1={_,_,M1}, N2={_,_,M2}) ->
|
||||
1000 * (Min*60 + Sec + (M2-M1)/1000000).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
+packet_size_zero(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),
|
||||
+
|
||||
+ {Server, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
|
||||
+ {user_dir, UserDir},
|
||||
+ {user_passwords, [{"vego", "morot"}]}]),
|
||||
+ Conn =
|
||||
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
|
||||
+ {user_dir, UserDir},
|
||||
+ {user_interaction, false},
|
||||
+ {user, "vego"},
|
||||
+ {password, "morot"}]),
|
||||
+
|
||||
+ {ok,Chan} = ssh_connection:session_channel(Conn, 1000, _MaxPacketSize=0, 60000),
|
||||
+ ok = ssh_connection:shell(Conn, Chan),
|
||||
+
|
||||
+ ssh:close(Conn),
|
||||
+ ssh:stop_daemon(Server),
|
||||
+
|
||||
+ receive
|
||||
+ {ssh_cm,Conn,{data,Chan,_Type,_Msg1}} = M ->
|
||||
+ ct:pal("Got ~p",[M]),
|
||||
+ ct:fail(doesnt_obey_max_packet_size_0)
|
||||
+ after 5000 ->
|
||||
+ ok
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+ssh_daemon_minimal_remote_max_packet_size_option(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),
|
||||
+
|
||||
+ {Server, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
|
||||
+ {user_dir, UserDir},
|
||||
+ {user_passwords, [{"vego", "morot"}]},
|
||||
+ {failfun, fun ssh_test_lib:failfun/2},
|
||||
+ {minimal_remote_max_packet_size, 14}]),
|
||||
+ Conn =
|
||||
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
|
||||
+ {user_dir, UserDir},
|
||||
+ {user_interaction, false},
|
||||
+ {user, "vego"},
|
||||
+ {password, "morot"}]),
|
||||
+
|
||||
+ %% Try the limits of the minimal_remote_max_packet_size:
|
||||
+ {ok, _ChannelId} = ssh_connection:session_channel(Conn, 100, 14, infinity),
|
||||
+ {open_error,_,"Maximum packet size below 14 not supported",_} =
|
||||
+ ssh_connection:session_channel(Conn, 100, 13, infinity),
|
||||
+
|
||||
+ ssh:close(Conn),
|
||||
+ ssh:stop_daemon(Server).
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
ssh_connect_negtimeout_parallel(Config) -> ssh_connect_negtimeout(Config,true).
|
||||
ssh_connect_negtimeout_sequential(Config) -> ssh_connect_negtimeout(Config,false).
|
||||
|
||||
@@ -970,7 +1030,7 @@ max_sessions(Config, ParallelLogin, Connect0) when is_function(Connect0,2) ->
|
||||
|
||||
%% Due to timing the error message may or may not be delivered to
|
||||
%% the "tcp-application" before the socket closed message is recived
|
||||
-check_error("Internal error") ->
|
||||
+check_error("Invalid state") ->
|
||||
ok;
|
||||
check_error("Connection closed") ->
|
||||
ok;
|
||||
diff --git lib/ssh/vsn.mk lib/ssh/vsn.mk
|
||||
index 0d90278..fec8dac 100644
|
||||
--- lib/ssh/vsn.mk
|
||||
+++ lib/ssh/vsn.mk
|
||||
@@ -1,5 +1,4 @@
|
||||
#-*-makefile-*- ; force emacs to enter makefile-mode
|
||||
|
||||
-SSH_VSN = 3.2
|
||||
+SSH_VSN = 3.2.1
|
||||
APP_VSN = "ssh-$(SSH_VSN)"
|
||||
-
|
||||
diff --git otp_versions.table otp_versions.table
|
||||
index 64ffd82..a82f535 100644
|
||||
--- otp_versions.table
|
||||
+++ otp_versions.table
|
||||
@@ -1,3 +1,4 @@
|
||||
+OTP-17.5.1 : ssh-3.2.1 # asn1-3.0.4 common_test-1.10 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.6 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.1 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
||||
OTP-17.5 : asn1-3.0.4 common_test-1.10 compiler-5.0.4 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 eldap-1.1.1 erts-6.4 hipe-3.11.3 inets-5.10.6 kernel-3.2 mnesia-4.12.5 observer-2.0.4 os_mon-2.3.1 public_key-0.23 runtime_tools-1.8.16 ssh-3.2 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 wx-1.3.3 # cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 edoc-0.7.16 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 ic-4.3.6 jinterface-1.5.12 megaco-3.17.3 odbc-2.10.22 orber-3.7.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 reltool-0.6.6 sasl-2.4.1 snmp-5.1.1 typer-0.9.8 webtool-0.8.10 xmerl-1.3.7 :
|
||||
OTP-17.4.1 : erts-6.3.1 inets-5.10.5 # asn1-3.0.3 common_test-1.9 compiler-5.0.3 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.4.2 debugger-4.0.2 dialyzer-2.7.3 diameter-1.8 edoc-0.7.16 eldap-1.1 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.2 ic-4.3.6 jinterface-1.5.12 kernel-3.1 megaco-3.17.3 mnesia-4.12.4 observer-2.0.3 odbc-2.10.22 orber-3.7.1 os_mon-2.3 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.22.1 reltool-0.6.6 runtime_tools-1.8.15 sasl-2.4.1 snmp-5.1.1 ssh-3.1 ssl-5.3.8 stdlib-2.3 syntax_tools-1.6.17 test_server-3.7.2 tools-2.7.1 typer-0.9.8 webtool-0.8.10 wx-1.3.2 xmerl-1.3.7 :
|
||||
OTP-17.4 : asn1-3.0.3 common_test-1.9 compiler-5.0.3 crypto-3.4.2 debugger-4.0.2 dialyzer-2.7.3 diameter-1.8 edoc-0.7.16 eldap-1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.3 eunit-2.2.9 hipe-3.11.2 inets-5.10.4 jinterface-1.5.12 kernel-3.1 megaco-3.17.3 mnesia-4.12.4 observer-2.0.3 odbc-2.10.22 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 runtime_tools-1.8.15 snmp-5.1.1 ssh-3.1 ssl-5.3.8 stdlib-2.3 syntax_tools-1.6.17 test_server-3.7.2 tools-2.7.1 wx-1.3.2 # cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 et-1.5 gs-1.5.16 ic-4.3.6 orber-3.7.1 os_mon-2.3 ose-1.0.2 public_key-0.22.1 reltool-0.6.6 sasl-2.4.1 typer-0.9.8 webtool-0.8.10 xmerl-1.3.7 :
|
|
@ -1,427 +0,0 @@
|
|||
diff --git OTP_VERSION OTP_VERSION
|
||||
index 9cbaf23..808ab16 100644
|
||||
--- OTP_VERSION
|
||||
+++ OTP_VERSION
|
||||
@@ -1 +1 @@
|
||||
-17.5.1
|
||||
+17.5.2
|
||||
diff --git lib/inets/doc/src/httpd.xml lib/inets/doc/src/httpd.xml
|
||||
index 20c8a6b..e40660a 100644
|
||||
--- lib/inets/doc/src/httpd.xml
|
||||
+++ lib/inets/doc/src/httpd.xml
|
||||
@@ -315,7 +315,7 @@ text/plain asc txt
|
||||
</item>
|
||||
|
||||
<marker id="prop_server_tokens"></marker>
|
||||
- <tag>{server_tokens, prod|major|minor|minimal|os|full|{private, string()}}</tag>
|
||||
+ <tag>{server_tokens, none|prod|major|minor|minimal|os|full|{private, string()}}</tag>
|
||||
<item>
|
||||
<p>ServerTokens defines how the value of the server header
|
||||
should look. </p>
|
||||
@@ -323,6 +323,7 @@ text/plain asc txt
|
||||
here is what the server header string could look like for
|
||||
the different values of server-tokens: </p>
|
||||
<pre>
|
||||
+none "" % A Server: header will not be generated
|
||||
prod "inets"
|
||||
major "inets/5"
|
||||
minor "inets/5.8"
|
||||
diff --git lib/inets/doc/src/notes.xml lib/inets/doc/src/notes.xml
|
||||
index 2c3ee79..12bbc2b 100644
|
||||
--- lib/inets/doc/src/notes.xml
|
||||
+++ lib/inets/doc/src/notes.xml
|
||||
@@ -32,7 +32,28 @@
|
||||
<file>notes.xml</file>
|
||||
</header>
|
||||
|
||||
- <section><title>Inets 5.10.6</title>
|
||||
+ <section><title>Inets 5.10.7</title>
|
||||
+
|
||||
+ <section><title>Improvements and New Features</title>
|
||||
+ <list>
|
||||
+ <item>
|
||||
+ <p>
|
||||
+ New value in <c>server_tokens</c> config for limiting
|
||||
+ banner grabbing attempts. </p>
|
||||
+ <p>
|
||||
+ By setting <c>{server_tokens, none}</c> in
|
||||
+ <c>ServiceConfig</c> for <c>inets:start(httpd,
|
||||
+ ServiceConfig)</c>, the "Server:" header will not be set
|
||||
+ in messages from the server.</p>
|
||||
+ <p>
|
||||
+ Own Id: OTP-12661 Aux Id: seq12840 </p>
|
||||
+ </item>
|
||||
+ </list>
|
||||
+ </section>
|
||||
+
|
||||
+</section>
|
||||
+
|
||||
+<section><title>Inets 5.10.6</title>
|
||||
|
||||
<section><title>Fixed Bugs and Malfunctions</title>
|
||||
<list>
|
||||
diff --git lib/inets/src/http_server/httpd_conf.erl lib/inets/src/http_server/httpd_conf.erl
|
||||
index 78dda79..dbdc1be 100644
|
||||
--- lib/inets/src/http_server/httpd_conf.erl
|
||||
+++ lib/inets/src/http_server/httpd_conf.erl
|
||||
@@ -219,14 +219,14 @@ load("ServerName " ++ ServerName, []) ->
|
||||
|
||||
load("ServerTokens " ++ ServerTokens, []) ->
|
||||
%% These are the valid *plain* server tokens:
|
||||
- %% sprod, major, minor, minimum, os, full
|
||||
+ %% none, prod, major, minor, minimum, os, full
|
||||
%% It can also be a "private" server token: private:<any string>
|
||||
case string:tokens(ServerTokens, [$:]) of
|
||||
["private", Private] ->
|
||||
{ok,[], {server_tokens, clean(Private)}};
|
||||
[TokStr] ->
|
||||
Tok = list_to_atom(clean(TokStr)),
|
||||
- case lists:member(Tok, [prod, major, minor, minimum, os, full]) of
|
||||
+ case lists:member(Tok, [none, prod, major, minor, minimum, os, full]) of
|
||||
true ->
|
||||
{ok,[], {server_tokens, Tok}};
|
||||
false ->
|
||||
@@ -850,6 +850,8 @@ server(full = _ServerTokens) ->
|
||||
OS = os_info(full),
|
||||
lists:flatten(
|
||||
io_lib:format("~s ~s OTP/~s", [?SERVER_SOFTWARE, OS, OTPRelease]));
|
||||
+server(none = _ServerTokens) ->
|
||||
+ "";
|
||||
server({private, Server} = _ServerTokens) when is_list(Server) ->
|
||||
%% The user provide its own
|
||||
Server;
|
||||
@@ -1299,7 +1301,7 @@ ssl_ca_certificate_file(ConfigDB) ->
|
||||
end.
|
||||
|
||||
plain_server_tokens() ->
|
||||
- [prod, major, minor, minimum, os, full].
|
||||
+ [none, prod, major, minor, minimum, os, full].
|
||||
|
||||
error_report(Where,M,F,Error) ->
|
||||
error_logger:error_report([{?MODULE, Where},
|
||||
diff --git lib/inets/src/http_server/httpd_response.erl lib/inets/src/http_server/httpd_response.erl
|
||||
index 0895729..2fa91d4 100644
|
||||
--- lib/inets/src/http_server/httpd_response.erl
|
||||
+++ lib/inets/src/http_server/httpd_response.erl
|
||||
@@ -287,8 +287,11 @@ create_header(ConfigDb, KeyValueTupleHeaders) ->
|
||||
ContentType = "text/html",
|
||||
Server = server(ConfigDb),
|
||||
NewHeaders = add_default_headers([{"date", Date},
|
||||
- {"content-type", ContentType},
|
||||
- {"server", Server}],
|
||||
+ {"content-type", ContentType}
|
||||
+ | if Server=="" -> [];
|
||||
+ true -> [{"server", Server}]
|
||||
+ end
|
||||
+ ],
|
||||
KeyValueTupleHeaders),
|
||||
lists:map(fun fix_header/1, NewHeaders).
|
||||
|
||||
diff --git lib/inets/vsn.mk lib/inets/vsn.mk
|
||||
index e5b63a6..e9ecb26 100644
|
||||
--- lib/inets/vsn.mk
|
||||
+++ lib/inets/vsn.mk
|
||||
@@ -18,6 +18,6 @@
|
||||
# %CopyrightEnd%
|
||||
|
||||
APPLICATION = inets
|
||||
-INETS_VSN = 5.10.6
|
||||
+INETS_VSN = 5.10.7
|
||||
PRE_VSN =
|
||||
APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)"
|
||||
diff --git lib/ssh/doc/src/notes.xml lib/ssh/doc/src/notes.xml
|
||||
index acbf312..41885c6 100644
|
||||
--- lib/ssh/doc/src/notes.xml
|
||||
+++ lib/ssh/doc/src/notes.xml
|
||||
@@ -29,6 +29,27 @@
|
||||
<file>notes.xml</file>
|
||||
</header>
|
||||
|
||||
+<section><title>Ssh 3.2.2</title>
|
||||
+
|
||||
+ <section><title>Improvements and New Features</title>
|
||||
+ <list>
|
||||
+ <item>
|
||||
+ <p>
|
||||
+ New option <c>id_string</c> for <c>ssh:daemon</c> and
|
||||
+ <c>ssh:connect</c> for limiting banner grabbing attempts.</p>
|
||||
+ <p>
|
||||
+ The possible values are: <c>{id_string,string()}</c> and
|
||||
+ <c>{id_string,random}</c>. The latter will make ssh
|
||||
+ generate a random nonsence id-string for each new
|
||||
+ connection.</p>
|
||||
+ <p>
|
||||
+ Own Id: OTP-12659</p>
|
||||
+ </item>
|
||||
+ </list>
|
||||
+ </section>
|
||||
+
|
||||
+</section>
|
||||
+
|
||||
<section><title>Ssh 3.2.1</title>
|
||||
|
||||
<section><title>Fixed Bugs and Malfunctions</title>
|
||||
diff --git lib/ssh/doc/src/ssh.xml lib/ssh/doc/src/ssh.xml
|
||||
index 0e7e384..72dafc0 100644
|
||||
--- lib/ssh/doc/src/ssh.xml
|
||||
+++ lib/ssh/doc/src/ssh.xml
|
||||
@@ -180,6 +180,15 @@
|
||||
<item>
|
||||
<p>If true, the client will not print out anything on authorization.</p>
|
||||
</item>
|
||||
+
|
||||
+ <tag><c><![CDATA[{id_string, random | string()}]]></c></tag>
|
||||
+ <item>
|
||||
+ <p>The string that the client presents to a connected server initially. The default value is "Erlang/VSN" where VSN is the ssh application version number.
|
||||
+ </p>
|
||||
+ <p>The value <c>random</c> will cause a random string to be created at each connection attempt. This is to make it a bit more difficult for a malicious peer to find the ssh software brand and version.
|
||||
+ </p>
|
||||
+ </item>
|
||||
+
|
||||
<tag><c><![CDATA[{fd, file_descriptor()}]]></c></tag>
|
||||
<item>
|
||||
<p>Allow an existing file descriptor to be used
|
||||
@@ -344,6 +353,14 @@
|
||||
</p>
|
||||
</item>
|
||||
|
||||
+ <tag><c><![CDATA[{id_string, random | string()}]]></c></tag>
|
||||
+ <item>
|
||||
+ <p>The string the daemon will present to a connecting peer initially. The default value is "Erlang/VSN" where VSN is the ssh application version number.
|
||||
+ </p>
|
||||
+ <p>The value <c>random</c> will cause a random string to be created at each connection attempt. This is to make it a bit more difficult for a malicious peer to find the ssh software brand and version.
|
||||
+ </p>
|
||||
+ </item>
|
||||
+
|
||||
<tag><c><![CDATA[{key_cb, atom()}]]></c></tag>
|
||||
<item>
|
||||
<p>Module implementing the behaviour <seealso marker="ssh_server_key_api">ssh_server_key_api</seealso>.
|
||||
diff --git lib/ssh/src/ssh.erl lib/ssh/src/ssh.erl
|
||||
index 51ad691..d4b02a0 100644
|
||||
--- lib/ssh/src/ssh.erl
|
||||
+++ lib/ssh/src/ssh.erl
|
||||
@@ -347,6 +347,8 @@ handle_option([parallel_login|Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option({parallel_login,true}) | SshOptions]);
|
||||
handle_option([{minimal_remote_max_packet_size, _} = Opt|Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
+handle_option([{id_string, _ID} = Opt|Rest], SocketOptions, SshOptions) ->
|
||||
+ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
handle_option([Opt | Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, [handle_inet_option(Opt) | SocketOptions], SshOptions).
|
||||
|
||||
@@ -439,6 +441,10 @@ handle_ssh_option({idle_time, Value} = Opt) when is_integer(Value), Value > 0 ->
|
||||
Opt;
|
||||
handle_ssh_option({rekey_limit, Value} = Opt) when is_integer(Value) ->
|
||||
Opt;
|
||||
+handle_ssh_option({id_string, random}) ->
|
||||
+ {id_string, {random,2,5}}; %% 2 - 5 random characters
|
||||
+handle_ssh_option({id_string, ID} = Opt) when is_list(ID) ->
|
||||
+ Opt;
|
||||
handle_ssh_option(Opt) ->
|
||||
throw({error, {eoptions, Opt}}).
|
||||
|
||||
diff --git lib/ssh/src/ssh_transport.erl lib/ssh/src/ssh_transport.erl
|
||||
index 76fa776..8669be5 100644
|
||||
--- lib/ssh/src/ssh_transport.erl
|
||||
+++ lib/ssh/src/ssh_transport.erl
|
||||
@@ -44,12 +44,34 @@
|
||||
|
||||
versions(client, Options)->
|
||||
Vsn = proplists:get_value(vsn, Options, ?DEFAULT_CLIENT_VERSION),
|
||||
- Version = format_version(Vsn),
|
||||
- {Vsn, Version};
|
||||
+ {Vsn, format_version(Vsn, software_version(Options))};
|
||||
versions(server, Options) ->
|
||||
Vsn = proplists:get_value(vsn, Options, ?DEFAULT_SERVER_VERSION),
|
||||
- Version = format_version(Vsn),
|
||||
- {Vsn, Version}.
|
||||
+ {Vsn, format_version(Vsn, software_version(Options))}.
|
||||
+
|
||||
+software_version(Options) ->
|
||||
+ case proplists:get_value(id_string, Options) of
|
||||
+ undefined ->
|
||||
+ "Erlang"++ssh_vsn();
|
||||
+ {random,Nlo,Nup} ->
|
||||
+ random_id(Nlo,Nup);
|
||||
+ ID ->
|
||||
+ ID
|
||||
+ end.
|
||||
+
|
||||
+ssh_vsn() ->
|
||||
+ try {ok,L} = application:get_all_key(ssh),
|
||||
+ proplists:get_value(vsn,L,"")
|
||||
+ of
|
||||
+ "" -> "";
|
||||
+ VSN when is_list(VSN) -> "/" ++ VSN;
|
||||
+ _ -> ""
|
||||
+ catch
|
||||
+ _:_ -> ""
|
||||
+ end.
|
||||
+
|
||||
+random_id(Nlo, Nup) ->
|
||||
+ [crypto:rand_uniform($a,$z+1) || _<- lists:duplicate(crypto:rand_uniform(Nlo,Nup+1),x) ].
|
||||
|
||||
hello_version_msg(Data) ->
|
||||
[Data,"\r\n"].
|
||||
@@ -77,9 +99,9 @@ is_valid_mac(Mac, Data, #ssh{recv_mac = Algorithm,
|
||||
yes_no(Ssh, Prompt) ->
|
||||
(Ssh#ssh.io_cb):yes_no(Prompt, Ssh).
|
||||
|
||||
-format_version({Major,Minor}) ->
|
||||
+format_version({Major,Minor}, SoftwareVersion) ->
|
||||
"SSH-" ++ integer_to_list(Major) ++ "." ++
|
||||
- integer_to_list(Minor) ++ "-Erlang".
|
||||
+ integer_to_list(Minor) ++ "-" ++ SoftwareVersion.
|
||||
|
||||
handle_hello_version(Version) ->
|
||||
try
|
||||
diff --git lib/ssh/test/ssh_basic_SUITE.erl lib/ssh/test/ssh_basic_SUITE.erl
|
||||
index 81c7b5c..f5f8991 100644
|
||||
--- lib/ssh/test/ssh_basic_SUITE.erl
|
||||
+++ lib/ssh/test/ssh_basic_SUITE.erl
|
||||
@@ -52,6 +52,12 @@ all() ->
|
||||
ssh_connect_arg4_timeout,
|
||||
packet_size_zero,
|
||||
ssh_daemon_minimal_remote_max_packet_size_option,
|
||||
+ id_string_no_opt_client,
|
||||
+ id_string_own_string_client,
|
||||
+ id_string_random_client,
|
||||
+ id_string_no_opt_server,
|
||||
+ id_string_own_string_server,
|
||||
+ id_string_random_server,
|
||||
{group, hardening_tests}
|
||||
].
|
||||
|
||||
@@ -817,6 +823,66 @@ ssh_daemon_minimal_remote_max_packet_size_option(Config) ->
|
||||
ssh:stop_daemon(Server).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
+id_string_no_opt_client(Config) ->
|
||||
+ {Server, Host, Port} = fake_daemon(Config),
|
||||
+ {error,_} = ssh:connect(Host, Port, []),
|
||||
+ receive
|
||||
+ {id,Server,"SSH-2.0-Erlang/"++Vsn} ->
|
||||
+ true = expected_ssh_vsn(Vsn);
|
||||
+ {id,Server,Other} ->
|
||||
+ ct:fail("Unexpected id: ~s.",[Other])
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+id_string_own_string_client(Config) ->
|
||||
+ {Server, Host, Port} = fake_daemon(Config),
|
||||
+ {error,_} = ssh:connect(Host, Port, [{id_string,"Pelle"}]),
|
||||
+ receive
|
||||
+ {id,Server,"SSH-2.0-Pelle\r\n"} ->
|
||||
+ ok;
|
||||
+ {id,Server,Other} ->
|
||||
+ ct:fail("Unexpected id: ~s.",[Other])
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+id_string_random_client(Config) ->
|
||||
+ {Server, Host, Port} = fake_daemon(Config),
|
||||
+ {error,_} = ssh:connect(Host, Port, [{id_string,random}]),
|
||||
+ receive
|
||||
+ {id,Server,Id="SSH-2.0-Erlang"++_} ->
|
||||
+ ct:fail("Unexpected id: ~s.",[Id]);
|
||||
+ {id,Server,Rnd="SSH-2.0-"++_} ->
|
||||
+ ct:log("Got ~s.",[Rnd]);
|
||||
+ {id,Server,Id} ->
|
||||
+ ct:fail("Unexpected id: ~s.",[Id])
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+id_string_no_opt_server(Config) ->
|
||||
+ {_Server, Host, Port} = std_daemon(Config, []),
|
||||
+ {ok,S1}=gen_tcp:connect(Host,Port,[{active,false}]),
|
||||
+ {ok,"SSH-2.0-Erlang/"++Vsn} = gen_tcp:recv(S1, 0, 2000),
|
||||
+ true = expected_ssh_vsn(Vsn).
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+id_string_own_string_server(Config) ->
|
||||
+ {_Server, Host, Port} = std_daemon(Config, [{id_string,"Olle"}]),
|
||||
+ {ok,S1}=gen_tcp:connect(Host,Port,[{active,false}]),
|
||||
+ {ok,"SSH-2.0-Olle\r\n"} = gen_tcp:recv(S1, 0, 2000).
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+id_string_random_server(Config) ->
|
||||
+ {_Server, Host, Port} = std_daemon(Config, [{id_string,random}]),
|
||||
+ {ok,S1}=gen_tcp:connect(Host,Port,[{active,false}]),
|
||||
+ {ok,"SSH-2.0-"++Rnd} = gen_tcp:recv(S1, 0, 2000),
|
||||
+ case Rnd of
|
||||
+ "Erlang"++_ -> ct:log("Id=~p",[Rnd]),
|
||||
+ {fail,got_default_id};
|
||||
+ "Olle\r\n" -> {fail,got_previous_tests_value};
|
||||
+ _ -> ct:log("Got ~s.",[Rnd])
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
ssh_connect_negtimeout_parallel(Config) -> ssh_connect_negtimeout(Config,true).
|
||||
ssh_connect_negtimeout_sequential(Config) -> ssh_connect_negtimeout(Config,false).
|
||||
|
||||
@@ -1095,3 +1161,46 @@ do_shell(IO, Shell) ->
|
||||
%% {'EXIT', Shell, killed} ->
|
||||
%% ok
|
||||
%% end.
|
||||
+
|
||||
+
|
||||
+std_daemon(Config, ExtraOpts) ->
|
||||
+ 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),
|
||||
+ {_Server, _Host, _Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
|
||||
+ {user_dir, UserDir},
|
||||
+ {failfun, fun ssh_test_lib:failfun/2} | ExtraOpts]).
|
||||
+
|
||||
+expected_ssh_vsn(Str) ->
|
||||
+ try
|
||||
+ {ok,L} = application:get_all_key(ssh),
|
||||
+ proplists:get_value(vsn,L,"")++"\r\n"
|
||||
+ of
|
||||
+ Str -> true;
|
||||
+ "\r\n" -> true;
|
||||
+ _ -> false
|
||||
+ catch
|
||||
+ _:_ -> true %% ssh not started so we dont't know
|
||||
+ end.
|
||||
+
|
||||
+
|
||||
+fake_daemon(_Config) ->
|
||||
+ Parent = self(),
|
||||
+ %% start the server
|
||||
+ Server = spawn(fun() ->
|
||||
+ {ok,Sl} = gen_tcp:listen(0,[]),
|
||||
+ {ok,{Host,Port}} = inet:sockname(Sl),
|
||||
+ Parent ! {sockname,self(),Host,Port},
|
||||
+ Rsa = gen_tcp:accept(Sl),
|
||||
+ ct:log("Server gen_tcp:accept got ~p",[Rsa]),
|
||||
+ {ok,S} = Rsa,
|
||||
+ receive
|
||||
+ {tcp, S, Id} -> Parent ! {id,self(),Id}
|
||||
+ end
|
||||
+ end),
|
||||
+ %% Get listening host and port
|
||||
+ receive
|
||||
+ {sockname,Server,ServerHost,ServerPort} -> {Server, ServerHost, ServerPort}
|
||||
+ end.
|
||||
+
|
||||
diff --git lib/ssh/vsn.mk lib/ssh/vsn.mk
|
||||
index fec8dac..b2b85a7 100644
|
||||
--- lib/ssh/vsn.mk
|
||||
+++ lib/ssh/vsn.mk
|
||||
@@ -1,4 +1,4 @@
|
||||
#-*-makefile-*- ; force emacs to enter makefile-mode
|
||||
|
||||
-SSH_VSN = 3.2.1
|
||||
+SSH_VSN = 3.2.2
|
||||
APP_VSN = "ssh-$(SSH_VSN)"
|
||||
diff --git otp_versions.table otp_versions.table
|
||||
index a82f535..4bf6cb9 100644
|
||||
--- otp_versions.table
|
||||
+++ otp_versions.table
|
||||
@@ -1,3 +1,4 @@
|
||||
+OTP-17.5.2 : inets-5.10.7 ssh-3.2.2 # asn1-3.0.4 common_test-1.10 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.1 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
||||
OTP-17.5.1 : ssh-3.2.1 # asn1-3.0.4 common_test-1.10 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.6 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.1 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
||||
OTP-17.5 : asn1-3.0.4 common_test-1.10 compiler-5.0.4 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 eldap-1.1.1 erts-6.4 hipe-3.11.3 inets-5.10.6 kernel-3.2 mnesia-4.12.5 observer-2.0.4 os_mon-2.3.1 public_key-0.23 runtime_tools-1.8.16 ssh-3.2 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 wx-1.3.3 # cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 edoc-0.7.16 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 ic-4.3.6 jinterface-1.5.12 megaco-3.17.3 odbc-2.10.22 orber-3.7.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 reltool-0.6.6 sasl-2.4.1 snmp-5.1.1 typer-0.9.8 webtool-0.8.10 xmerl-1.3.7 :
|
||||
OTP-17.4.1 : erts-6.3.1 inets-5.10.5 # asn1-3.0.3 common_test-1.9 compiler-5.0.3 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.4.2 debugger-4.0.2 dialyzer-2.7.3 diameter-1.8 edoc-0.7.16 eldap-1.1 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.2 ic-4.3.6 jinterface-1.5.12 kernel-3.1 megaco-3.17.3 mnesia-4.12.4 observer-2.0.3 odbc-2.10.22 orber-3.7.1 os_mon-2.3 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.22.1 reltool-0.6.6 runtime_tools-1.8.15 sasl-2.4.1 snmp-5.1.1 ssh-3.1 ssl-5.3.8 stdlib-2.3 syntax_tools-1.6.17 test_server-3.7.2 tools-2.7.1 typer-0.9.8 webtool-0.8.10 wx-1.3.2 xmerl-1.3.7 :
|
File diff suppressed because it is too large
Load diff
|
@ -1,306 +0,0 @@
|
|||
diff --git OTP_VERSION OTP_VERSION
|
||||
index f32d20d..64b493c 100644
|
||||
--- OTP_VERSION
|
||||
+++ OTP_VERSION
|
||||
@@ -1 +1 @@
|
||||
-17.5.3
|
||||
+17.5.4
|
||||
diff --git lib/inets/doc/src/notes.xml lib/inets/doc/src/notes.xml
|
||||
index 12bbc2b..bae8e32 100644
|
||||
--- lib/inets/doc/src/notes.xml
|
||||
+++ lib/inets/doc/src/notes.xml
|
||||
@@ -32,7 +32,22 @@
|
||||
<file>notes.xml</file>
|
||||
</header>
|
||||
|
||||
- <section><title>Inets 5.10.7</title>
|
||||
+ <section><title>Inets 5.10.8</title>
|
||||
+
|
||||
+ <section><title>Fixed Bugs and Malfunctions</title>
|
||||
+ <list>
|
||||
+ <item>
|
||||
+ <p>
|
||||
+ Reject messages with a Content-Length less than 0</p>
|
||||
+ <p>
|
||||
+ Own Id: OTP-12739 Aux Id: seq12860 </p>
|
||||
+ </item>
|
||||
+ </list>
|
||||
+ </section>
|
||||
+
|
||||
+</section>
|
||||
+
|
||||
+<section><title>Inets 5.10.7</title>
|
||||
|
||||
<section><title>Improvements and New Features</title>
|
||||
<list>
|
||||
diff --git lib/inets/src/http_server/httpd_request.erl lib/inets/src/http_server/httpd_request.erl
|
||||
index 6985065..3ff0761 100644
|
||||
--- lib/inets/src/http_server/httpd_request.erl
|
||||
+++ lib/inets/src/http_server/httpd_request.erl
|
||||
@@ -417,8 +417,12 @@ check_header({"content-length", Value}, Maxsizes) ->
|
||||
case length(Value) =< MaxLen of
|
||||
true ->
|
||||
try
|
||||
- _ = list_to_integer(Value),
|
||||
- ok
|
||||
+ list_to_integer(Value)
|
||||
+ of
|
||||
+ I when I>= 0 ->
|
||||
+ ok;
|
||||
+ _ ->
|
||||
+ {error, {size_error, Max, 411, "negative content-length"}}
|
||||
catch _:_ ->
|
||||
{error, {size_error, Max, 411, "content-length not an integer"}}
|
||||
end;
|
||||
diff --git lib/inets/vsn.mk lib/inets/vsn.mk
|
||||
index e9ecb26..ecb84e4 100644
|
||||
--- lib/inets/vsn.mk
|
||||
+++ lib/inets/vsn.mk
|
||||
@@ -18,6 +18,6 @@
|
||||
# %CopyrightEnd%
|
||||
|
||||
APPLICATION = inets
|
||||
-INETS_VSN = 5.10.7
|
||||
+INETS_VSN = 5.10.8
|
||||
PRE_VSN =
|
||||
APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)"
|
||||
diff --git lib/ssh/doc/src/notes.xml lib/ssh/doc/src/notes.xml
|
||||
index 41885c6..579a3ae 100644
|
||||
--- lib/ssh/doc/src/notes.xml
|
||||
+++ lib/ssh/doc/src/notes.xml
|
||||
@@ -29,6 +29,25 @@
|
||||
<file>notes.xml</file>
|
||||
</header>
|
||||
|
||||
+<section><title>Ssh 3.2.3</title>
|
||||
+
|
||||
+ <section><title>Fixed Bugs and Malfunctions</title>
|
||||
+ <list>
|
||||
+ <item>
|
||||
+ <p>
|
||||
+ A new option for handling the SSH_MSG_DEBUG message's
|
||||
+ printouts. A fun could be given in the options that will
|
||||
+ be called whenever the SSH_MSG_DEBUG message arrives.
|
||||
+ This enables the user to format the printout or just
|
||||
+ discard it.</p>
|
||||
+ <p>
|
||||
+ Own Id: OTP-12738 Aux Id: seq12860 </p>
|
||||
+ </item>
|
||||
+ </list>
|
||||
+ </section>
|
||||
+
|
||||
+</section>
|
||||
+
|
||||
<section><title>Ssh 3.2.2</title>
|
||||
|
||||
<section><title>Improvements and New Features</title>
|
||||
diff --git lib/ssh/doc/src/ssh.xml lib/ssh/doc/src/ssh.xml
|
||||
index 72dafc0..501668c 100644
|
||||
--- lib/ssh/doc/src/ssh.xml
|
||||
+++ lib/ssh/doc/src/ssh.xml
|
||||
@@ -201,6 +201,14 @@
|
||||
<tag><c><![CDATA[{idle_time, integer()}]]></c></tag>
|
||||
<item>
|
||||
<p>Sets a timeout on connection when no channels are active, default is infinity</p></item>
|
||||
+
|
||||
+ <tag><c><![CDATA[{ssh_msg_debug_fun, fun(ConnectionRef::ssh_connection_ref(), AlwaysDisplay::boolean(), Msg::binary(), LanguageTag::binary()) -> _}]]></c></tag>
|
||||
+ <item>
|
||||
+ <p>Provide a fun to implement your own logging of the SSH message SSH_MSG_DEBUG. The last three parameters are from the message, see RFC4253, section 11.3. The <c>ConnectionRef</c> is the reference to the connection on which the message arrived. The return value from the fun is not checked.</p>
|
||||
+ <p>The default behaviour is ignore the message.
|
||||
+ To get a printout for each message with <c>AlwaysDisplay = true</c>, use for example <c>{ssh_msg_debug_fun, fun(_,true,M,_)-> io:format("DEBUG: ~p~n", [M]) end}</c></p>
|
||||
+ </item>
|
||||
+
|
||||
</taglist>
|
||||
</desc>
|
||||
</func>
|
||||
@@ -383,8 +391,16 @@
|
||||
<item>
|
||||
<p>Provide a fun to implement your own logging when a user disconnects from the server.</p>
|
||||
</item>
|
||||
- </taglist>
|
||||
- </desc>
|
||||
+
|
||||
+ <tag><c><![CDATA[{ssh_msg_debug_fun, fun(ConnectionRef::ssh_connection_ref(), AlwaysDisplay::boolean(), Msg::binary(), LanguageTag::binary()) -> _}]]></c></tag>
|
||||
+ <item>
|
||||
+ <p>Provide a fun to implement your own logging of the SSH message SSH_MSG_DEBUG. The last three parameters are from the message, see RFC4253, section 11.3. The <c>ConnectionRef</c> is the reference to the connection on which the message arrived. The return value from the fun is not checked.</p>
|
||||
+ <p>The default behaviour is ignore the message.
|
||||
+ To get a printout for each message with <c>AlwaysDisplay = true</c>, use for example <c>{ssh_msg_debug_fun, fun(_,true,M,_)-> io:format("DEBUG: ~p~n", [M]) end}</c></p>
|
||||
+ </item>
|
||||
+
|
||||
+ </taglist>
|
||||
+ </desc>
|
||||
</func>
|
||||
|
||||
|
||||
diff --git lib/ssh/src/ssh.erl lib/ssh/src/ssh.erl
|
||||
index d4b02a0..71e7d77 100644
|
||||
--- lib/ssh/src/ssh.erl
|
||||
+++ lib/ssh/src/ssh.erl
|
||||
@@ -312,6 +312,8 @@ handle_option([{disconnectfun, _} = Opt | Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
handle_option([{failfun, _} = Opt | Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
+handle_option([{ssh_msg_debug_fun, _} = Opt | Rest], SocketOptions, SshOptions) ->
|
||||
+ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
|
||||
%%Backwards compatibility should not be underscore between ip and v6 in API
|
||||
handle_option([{ip_v6_disabled, Value} | Rest], SocketOptions, SshOptions) ->
|
||||
handle_option(Rest, SocketOptions, [handle_ssh_option({ipv6_disabled, Value}) | SshOptions]);
|
||||
@@ -417,6 +419,8 @@ handle_ssh_option({disconnectfun , Value} = Opt) when is_function(Value) ->
|
||||
Opt;
|
||||
handle_ssh_option({failfun, Value} = Opt) when is_function(Value) ->
|
||||
Opt;
|
||||
+handle_ssh_option({ssh_msg_debug_fun, Value} = Opt) when is_function(Value,4) ->
|
||||
+ Opt;
|
||||
|
||||
handle_ssh_option({ipv6_disabled, Value} = Opt) when is_boolean(Value) ->
|
||||
throw({error, {{ipv6_disabled, Opt}, option_no_longer_valid_use_inet_option_instead}});
|
||||
diff --git lib/ssh/src/ssh_connection_handler.erl lib/ssh/src/ssh_connection_handler.erl
|
||||
index e1f2e05..0f6162d 100644
|
||||
--- lib/ssh/src/ssh_connection_handler.erl
|
||||
+++ lib/ssh/src/ssh_connection_handler.erl
|
||||
@@ -580,12 +580,12 @@ handle_event(#ssh_msg_disconnect{description = Desc} = DisconnectMsg, _StateName
|
||||
handle_event(#ssh_msg_ignore{}, StateName, State) ->
|
||||
{next_state, StateName, next_packet(State)};
|
||||
|
||||
-handle_event(#ssh_msg_debug{always_display = true, message = DbgMsg},
|
||||
- StateName, State) ->
|
||||
- io:format("DEBUG: ~p\n", [DbgMsg]),
|
||||
- {next_state, StateName, next_packet(State)};
|
||||
-
|
||||
-handle_event(#ssh_msg_debug{}, StateName, State) ->
|
||||
+handle_event(#ssh_msg_debug{always_display = Display, message = DbgMsg, language=Lang},
|
||||
+ StateName, #state{opts = Opts} = State) ->
|
||||
+ F = proplists:get_value(ssh_msg_debug_fun, Opts,
|
||||
+ fun(_ConnRef, _AlwaysDisplay, _Msg, _Language) -> ok end
|
||||
+ ),
|
||||
+ catch F(self(), Display, DbgMsg, Lang),
|
||||
{next_state, StateName, next_packet(State)};
|
||||
|
||||
handle_event(#ssh_msg_unimplemented{}, StateName, State) ->
|
||||
diff --git lib/ssh/test/ssh_basic_SUITE.erl lib/ssh/test/ssh_basic_SUITE.erl
|
||||
index f5f8991..fa7b426 100644
|
||||
--- lib/ssh/test/ssh_basic_SUITE.erl
|
||||
+++ lib/ssh/test/ssh_basic_SUITE.erl
|
||||
@@ -52,6 +52,8 @@ all() ->
|
||||
ssh_connect_arg4_timeout,
|
||||
packet_size_zero,
|
||||
ssh_daemon_minimal_remote_max_packet_size_option,
|
||||
+ ssh_msg_debug_fun_option_client,
|
||||
+ ssh_msg_debug_fun_option_server,
|
||||
id_string_no_opt_client,
|
||||
id_string_own_string_client,
|
||||
id_string_random_client,
|
||||
@@ -494,6 +496,94 @@ server_userpassword_option(Config) when is_list(Config) ->
|
||||
ssh:stop_daemon(Pid).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
+ssh_msg_debug_fun_option_client() ->
|
||||
+ [{doc, "validate client that uses the 'ssh_msg_debug_fun' option"}].
|
||||
+ssh_msg_debug_fun_option_client(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),
|
||||
+ SysDir = ?config(data_dir, Config),
|
||||
+
|
||||
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir},
|
||||
+ {user_dir, UserDir},
|
||||
+ {password, "morot"},
|
||||
+ {failfun, fun ssh_test_lib:failfun/2}]),
|
||||
+ Parent = self(),
|
||||
+ DbgFun = fun(ConnRef,Displ,Msg,Lang) -> Parent ! {msg_dbg,{ConnRef,Displ,Msg,Lang}} end,
|
||||
+
|
||||
+ ConnectionRef =
|
||||
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
|
||||
+ {user, "foo"},
|
||||
+ {password, "morot"},
|
||||
+ {user_dir, UserDir},
|
||||
+ {user_interaction, false},
|
||||
+ {ssh_msg_debug_fun,DbgFun}]),
|
||||
+ %% Beware, implementation knowledge:
|
||||
+ gen_fsm:send_all_state_event(ConnectionRef,{ssh_msg_debug,false,<<"Hello">>,<<>>}),
|
||||
+ receive
|
||||
+ {msg_dbg,X={ConnectionRef,false,<<"Hello">>,<<>>}} ->
|
||||
+ ct:log("Got expected dbg msg ~p",[X]),
|
||||
+ ssh:stop_daemon(Pid);
|
||||
+ {msg_dbg,X={_,false,<<"Hello">>,<<>>}} ->
|
||||
+ ct:log("Got dbg msg but bad ConnectionRef (~p expected) ~p",[ConnectionRef,X]),
|
||||
+ ssh:stop_daemon(Pid),
|
||||
+ {fail, "Bad ConnectionRef received"};
|
||||
+ {msg_dbg,X} ->
|
||||
+ ct:log("Got bad dbg msg ~p",[X]),
|
||||
+ ssh:stop_daemon(Pid),
|
||||
+ {fail,"Bad msg received"}
|
||||
+ after 1000 ->
|
||||
+ ssh:stop_daemon(Pid),
|
||||
+ {fail,timeout}
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
+ssh_msg_debug_fun_option_server() ->
|
||||
+ [{doc, "validate client that uses the 'ssh_msg_debug_fun' option"}].
|
||||
+ssh_msg_debug_fun_option_server(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),
|
||||
+ SysDir = ?config(data_dir, Config),
|
||||
+
|
||||
+ Parent = self(),
|
||||
+ DbgFun = fun(ConnRef,Displ,Msg,Lang) -> Parent ! {msg_dbg,{ConnRef,Displ,Msg,Lang}} end,
|
||||
+ ConnFun = fun(_,_,_) -> Parent ! {connection_pid,self()} end,
|
||||
+
|
||||
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir},
|
||||
+ {user_dir, UserDir},
|
||||
+ {password, "morot"},
|
||||
+ {failfun, fun ssh_test_lib:failfun/2},
|
||||
+ {connectfun, ConnFun},
|
||||
+ {ssh_msg_debug_fun, DbgFun}]),
|
||||
+ _ConnectionRef =
|
||||
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
|
||||
+ {user, "foo"},
|
||||
+ {password, "morot"},
|
||||
+ {user_dir, UserDir},
|
||||
+ {user_interaction, false}]),
|
||||
+ receive
|
||||
+ {connection_pid,Server} ->
|
||||
+ %% Beware, implementation knowledge:
|
||||
+ gen_fsm:send_all_state_event(Server,{ssh_msg_debug,false,<<"Hello">>,<<>>}),
|
||||
+ receive
|
||||
+ {msg_dbg,X={_,false,<<"Hello">>,<<>>}} ->
|
||||
+ ct:log("Got expected dbg msg ~p",[X]),
|
||||
+ ssh:stop_daemon(Pid);
|
||||
+ {msg_dbg,X} ->
|
||||
+ ct:log("Got bad dbg msg ~p",[X]),
|
||||
+ ssh:stop_daemon(Pid),
|
||||
+ {fail,"Bad msg received"}
|
||||
+ after 3000 ->
|
||||
+ ssh:stop_daemon(Pid),
|
||||
+ {fail,timeout2}
|
||||
+ end
|
||||
+ after 3000 ->
|
||||
+ ssh:stop_daemon(Pid),
|
||||
+ {fail,timeout1}
|
||||
+ end.
|
||||
+
|
||||
+%%--------------------------------------------------------------------
|
||||
known_hosts() ->
|
||||
[{doc, "check that known_hosts is updated correctly"}].
|
||||
known_hosts(Config) when is_list(Config) ->
|
||||
diff --git lib/ssh/vsn.mk lib/ssh/vsn.mk
|
||||
index b2b85a7..40bda0c 100644
|
||||
--- lib/ssh/vsn.mk
|
||||
+++ lib/ssh/vsn.mk
|
||||
@@ -1,4 +1,4 @@
|
||||
#-*-makefile-*- ; force emacs to enter makefile-mode
|
||||
|
||||
-SSH_VSN = 3.2.2
|
||||
+SSH_VSN = 3.2.3
|
||||
APP_VSN = "ssh-$(SSH_VSN)"
|
||||
diff --git otp_versions.table otp_versions.table
|
||||
index 12790c8..fbed2ce 100644
|
||||
--- otp_versions.table
|
||||
+++ otp_versions.table
|
||||
@@ -1,3 +1,4 @@
|
||||
+OTP-17.5.4 : inets-5.10.8 ssh-3.2.3 # asn1-3.0.4 common_test-1.10.1 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9.1 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4.1 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.2 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8.1 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
||||
OTP-17.5.3 : common_test-1.10.1 diameter-1.9.1 erts-6.4.1 snmp-5.1.2 test_server-3.8.1 # asn1-3.0.4 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.7 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 ssh-3.2.2 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
||||
OTP-17.5.2 : inets-5.10.7 ssh-3.2.2 # asn1-3.0.4 common_test-1.10 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.1 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
||||
OTP-17.5.1 : ssh-3.2.1 # asn1-3.0.4 common_test-1.10 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.6 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.1 ssl-6.0 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
|
Loading…
Reference in a new issue