diff options
author | Ingela Anderton Andin <[email protected]> | 2013-11-13 10:56:13 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-11-13 14:27:35 +0100 |
commit | 7efe1b6dd3215261777b5f335b4f92dfca7cea42 (patch) | |
tree | 29ded555655000c441f4a40d3c34bf2d103cd0fb /lib/ssh/src/ssh_connection_handler.erl | |
parent | fe6ddb300dbf092b02260a06baf6238f4d81eb14 (diff) | |
download | otp-7efe1b6dd3215261777b5f335b4f92dfca7cea42.tar.gz otp-7efe1b6dd3215261777b5f335b4f92dfca7cea42.tar.bz2 otp-7efe1b6dd3215261777b5f335b4f92dfca7cea42.zip |
ssh: Logging fun and document enhancement
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index 753569e442..7ba2179a76 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -429,7 +429,7 @@ userauth(#ssh_msg_userauth_request{service = "ssh-connection", {next_state, connected, next_packet(State#state{auth_user = User, ssh_params = Ssh})}; {not_authorized, {User, Reason}, {Reply, Ssh}} -> - retry_fun(User, Reason, Opts), + retry_fun(User, Address, Reason, Opts), send_msg(Reply, State), {next_state, userauth, next_packet(State#state{ssh_params = Ssh})} end; @@ -1399,23 +1399,31 @@ connected_fun(User, PeerAddr, Method, Opts) -> catch Fun(User, PeerAddr, Method) end. -retry_fun(_, undefined, _) -> +retry_fun(_, _, undefined, _) -> ok; -retry_fun(User, {error, Reason}, Opts) -> +retry_fun(User, PeerAddr, {error, Reason}, Opts) -> case proplists:get_value(failfun, Opts) of undefined -> ok; Fun -> - catch Fun(User, Reason) + do_retry_fun(Fun, User, PeerAddr, Reason) end; -retry_fun(User, Reason, Opts) -> +retry_fun(User, PeerAddr, Reason, Opts) -> case proplists:get_value(infofun, Opts) of undefined -> ok; - Fun -> - catch Fun(User, Reason) + Fun -> + do_retry_fun(Fun, User, PeerAddr, Reason) + end. + +do_retry_fun(Fun, User, PeerAddr, Reason) -> + case erlang:fun_info(Fun, arity) of + 2 -> %% Backwards compatible + catch Fun(User, Reason); + 3 -> + catch Fun(User, PeerAddr, Reason) end. ssh_info([], _State, Acc) -> |