aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2012-08-30 09:38:13 +0200
committerIngela Anderton Andin <[email protected]>2012-08-30 09:38:13 +0200
commit9f69634d0ca0a21b0c8bc9ad1ab4d836db652170 (patch)
treeddb8ed247bf9778e9d30a73175139caa434035a1
parent44b5b4f81398a0d0f2fc190fd5a77be3c594c6a8 (diff)
parent94f6c68ff4a46c69be0030aff553d6db92f29a35 (diff)
downloadotp-9f69634d0ca0a21b0c8bc9ad1ab4d836db652170.tar.gz
otp-9f69634d0ca0a21b0c8bc9ad1ab4d836db652170.tar.bz2
otp-9f69634d0ca0a21b0c8bc9ad1ab4d836db652170.zip
Merge remote branch 'upstream/maint'
* upstream/maint: ssh: Increase robustness inets: Dialyzer spec fixes
-rw-r--r--lib/inets/src/http_server/httpd_log.erl12
-rw-r--r--lib/ssh/src/ssh.appup.src2
-rw-r--r--lib/ssh/src/ssh_file.erl11
3 files changed, 17 insertions, 8 deletions
diff --git a/lib/inets/src/http_server/httpd_log.erl b/lib/inets/src/http_server/httpd_log.erl
index 60ab326a20..a34435e0e8 100644
--- a/lib/inets/src/http_server/httpd_log.erl
+++ b/lib/inets/src/http_server/httpd_log.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -36,8 +36,8 @@
AuthUser :: string(),
Date :: string(),
StatusCode :: pos_integer(),
- Size :: pos_integer() | string()) ->
- {Log :: atom() | pid(), Entry :: string()}.
+ Size :: 0 | pos_integer() | string()) ->
+ {Log :: atom() | pid(), Entry :: string()} | term() .
access_entry(Log, NoLog, Info, RFC931, AuthUser, Date, StatusCode, SizeStr)
when is_list(SizeStr) ->
@@ -69,7 +69,7 @@ access_entry(Log, NoLog,
Info :: #mod{},
Date :: string(),
Reason :: term()) ->
- {Log :: atom() | pid(), Entry :: string()}.
+ {Log :: atom() | pid(), Entry :: string()} | term().
error_entry(Log, NoLog,
#mod{config_db = ConfigDB,
@@ -87,7 +87,7 @@ error_entry(Log, NoLog,
ConfigDB :: term(),
Date :: string(),
ErrroStr :: string()) ->
- {Log :: atom() | pid(), Entry :: string()}.
+ {Log :: atom() | pid(), Entry :: string()} | term().
error_report_entry(Log, NoLog, ConfigDb, Date, ErrorStr) ->
MakeEntry = fun() -> io_lib:format("[~s], ~s~n", [Date, ErrorStr]) end,
@@ -99,7 +99,7 @@ error_report_entry(Log, NoLog, ConfigDb, Date, ErrorStr) ->
ConfigDB :: term(),
Date :: string(),
Reason :: term()) ->
- {Log :: atom() | pid(), Entry :: string()}.
+ {Log :: atom() | pid(), Entry :: string()} | term().
security_entry(Log, NoLog, #mod{config_db = ConfigDB}, Date, Reason) ->
MakeEntry = fun() -> io_lib:format("[~s] ~s~n", [Date, Reason]) end,
diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src
index 6967a0f464..d08dbafc32 100644
--- a/lib/ssh/src/ssh.appup.src
+++ b/lib/ssh/src/ssh.appup.src
@@ -24,6 +24,7 @@
{load_module, ssh_connection_manager, soft_purge, soft_purge, []},
{load_module, ssh_auth, soft_purge, soft_purge, []},
{load_module, ssh_channel, soft_purge, soft_purge, []},
+ {load_module, ssh_file, soft_purge, soft_purge, []}]},
{load_module, ssh, soft_purge, soft_purge, []}]},
{<<"2.0\\.*">>, [{restart_application, ssh}]},
{<<"1\\.*">>, [{restart_application, ssh}]}
@@ -34,6 +35,7 @@
{load_module, ssh_connection_manager, soft_purge, soft_purge, []},
{load_module, ssh_auth, soft_purge, soft_purge, []},
{load_module, ssh_channel, soft_purge, soft_purge, []},
+ {load_module, ssh_file, soft_purge, soft_purge, []}]},
{load_module, ssh, soft_purge, soft_purge, []}]},
{<<"2.0\\.*">>, [{restart_application, ssh}]},
{<<"1\\.*">>, [{restart_application, ssh}]}
diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl
index d05fa8e09a..a6b82a7a13 100644
--- a/lib/ssh/src/ssh_file.erl
+++ b/lib/ssh/src/ssh_file.erl
@@ -232,7 +232,7 @@ lookup_host_key_fd(Fd, Host, KeyType) ->
eof ->
{error, not_found};
Line ->
- case public_key:ssh_decode(Line, known_hosts) of
+ case ssh_decode_line(Line, known_hosts) of
[{Key, Attributes}] ->
handle_host(Fd, Host, proplists:get_value(hostnames, Attributes), Key, KeyType);
[] ->
@@ -240,6 +240,13 @@ lookup_host_key_fd(Fd, Host, KeyType) ->
end
end.
+ssh_decode_line(Line, Type) ->
+ try
+ public_key:ssh_decode(Line, Type)
+ catch _:_ ->
+ []
+ end.
+
handle_host(Fd, Host, HostList, Key, KeyType) ->
Host1 = host_name(Host),
case lists:member(Host1, HostList) and key_match(Key, KeyType) of
@@ -285,7 +292,7 @@ lookup_user_key_fd(Fd, Key) ->
eof ->
{error, not_found};
Line ->
- case public_key:ssh_decode(Line, auth_keys) of
+ case ssh_decode_line(Line, auth_keys) of
[{AuthKey, _}] ->
case is_auth_key(Key, AuthKey) of
true ->