[erlang-bugs] SSH undef using with no user interaction and missing authorized key
Ingela Anderton Andin
Ingela.Anderton.Andin@REDACTED
Mon Nov 25 10:26:41 CET 2013
Hi!
Yes it looks like ssh_no_io.erl have several arity problems.
Following patch should solve the problem!
diff --git a/lib/ssh/src/ssh_no_io.erl b/lib/ssh/src/ssh_no_io.erl
index 9f83506..825a0d4 100644
--- a/lib/ssh/src/ssh_no_io.erl
+++ b/lib/ssh/src/ssh_no_io.erl
@@ -24,27 +24,27 @@
-module(ssh_no_io).
-include("ssh_transport.hrl").
--export([yes_no/1, read_password/1, read_line/1, format/2]).
+-export([yes_no/2, read_password/2, read_line/2, format/2]).
-yes_no(_Prompt) ->
+yes_no(_, _) ->
throw({{no_io_allowed, yes_no},
#ssh_msg_disconnect{code =
?SSH_DISCONNECT_SERVICE_NOT_AVAILABLE,
description = "User interaction is not
allowed",
language = "en"}}).
-read_password(_Prompt) ->
+read_password(_, _) ->
throw({{no_io_allowed, read_password},
#ssh_msg_disconnect{code = ?SSH_DISCONNECT_SERVICE_NOT_AVAILABLE,
description = "User interaction is not
allowed",
language = "en"}}).
-read_line(_Prompt) ->
+read_line(_, _) ->
throw({{no_io_allowed, read_line},
#ssh_msg_disconnect{code = ?SSH_DISCONNECT_SERVICE_NOT_AVAILABLE,
description = "User interaction is not
allowed",
language = "en"}} ).
Regards Ingela Erlang/OTP Team - Ericsson AB
On 11/24/2013 01:51 PM, Adam Lindberg wrote:
> Hi!
>
> Using SSH in Erlang R16B02, trying to connect to localhost on OS X 10.9,
> using [{user_dir, ...}, {user_interaction, false}] produces an undef
> error because ssh_no_io does not have the function yes_no/2. The error
> cannot be produced by using only {user_interaction, false}.
> authorized_keys are not set up on this machine, so the login (without
> {user_dir, ...} is of course unsuccessful.
>
> Cheers,
> Adam
>
>
> Full output:
>
> Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4]
> [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
>
> Eshell V5.10.3 (abort with ^G)
> 1> ssh:start().
> ok
> 2> {ok, Conn} = ssh:connect("localhost", 22, [{user_interaction,
> false}]).
> ** exception error: no match of right hand side value {error,
> "Unable to
> connect using the
> available
> authentication
> methods"}
> 3> {ok, Conn} = ssh:connect("localhost", 22, [{user_dir,
> "/Users/username"}, {user_interaction, false}]).
> ** exception error: no match of right hand side value {error,"Internal
> error"}
> 4>
> =ERROR REPORT==== 24-Nov-2013::13:09:17 ===
> Erlang ssh connection handler failed with reason: undef
> , Stacktace: [{ssh_no_io,yes_no,
> ["New host localhost accept",
> {ssh,client,
> {"localhost",{{0,0,0,0,0,0,0,1},22}},
> {2,0},
> {2,0},
> "SSH-2.0-Erlang","SSH-2.0-OpenSSH_6.2",
> <<...big binary...>>,
> <<...big binary...>>,
> {alg,'diffie-hellman-group1-sha1','ssh-rsa',
> 'hmac-sha1','hmac-sha1','aes128-cbc',
> 'aes128-cbc',none,none,none,none},
> undefined,undefined,ssh_file,ssh_no_io,none,
> undefined,0,none,undefined,0,none,undefined,8,
> undefined,none,undefined,8,undefined,none,
> undefined,none,undefined,none,none,true,
> infinity,undefined,undefined,undefined,
> [{address,"localhost"},
> {port,22},
> {user_pid,<0.57.0>},
> {host,"localhost"},
> {idle_time,infinity},
> {user_interaction,false},
> {user_dir,"/Users/alind"}],
> 2,2,
> {{...big integer...,
> ...big integer...},
> {2,
> ...big integer...}},
> undefined,undefined,undefined,false,
> "publickey,keyboard-interactive,password",
> undefined,undefined,
> ["ssh-rsa","ssh-dss"],
> false}],
> []},
> {ssh_transport,known_host_key,3,
> [{file,"ssh_transport.erl"},{line,489}]},
> {ssh_transport,handle_kexdh_reply,2,
> [{file,"ssh_transport.erl"},{line,354}]},
> {ssh_connection_handler,key_exchange,2,
> [{file,"ssh_connection_handler.erl"},
> {line,242}]},
> {gen_fsm,handle_msg,7,[{file,"gen_fsm.erl"},{line,505}]},
> {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]
> please report this to erlang-bugs@REDACTED
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
More information about the erlang-bugs
mailing list