diff options
author | Anders F Björklund <anders.f.bjorklund@gmail.com> | 2020-12-04 17:08:39 +0100 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-12-07 14:48:03 -0500 |
commit | a680958de0b56ce2d681a8b1cc14692f578c74a4 (patch) | |
tree | c9521d2f1d84c7887a11f6ca39beb85560716e2f | |
parent | 34eac83371210e8fd445244fcf91599580edf39e (diff) | |
download | podman-a680958de0b56ce2d681a8b1cc14692f578c74a4.tar.gz podman-a680958de0b56ce2d681a8b1cc14692f578c74a4.tar.bz2 podman-a680958de0b56ce2d681a8b1cc14692f578c74a4.zip |
Use PasswordCallback instead of Password for ssh
Currently asking for login password, even if not supported by
the ssh server. So wait with prompt until actually requested.
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
-rw-r--r-- | pkg/bindings/connection.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go index 31435ae91..b0e3ceb9b 100644 --- a/pkg/bindings/connection.go +++ b/pkg/bindings/connection.go @@ -207,11 +207,11 @@ func sshClient(_url *url.URL, secure bool, passPhrase string, identity string) ( authMethods = append(authMethods, ssh.Password(pw)) } if len(authMethods) == 0 { - pass, err := terminal.ReadPassword("Login password:") - if err != nil { - return Connection{}, err + callback := func() (string, error) { + pass, err := terminal.ReadPassword("Login password:") + return string(pass), err } - authMethods = append(authMethods, ssh.Password(string(pass))) + authMethods = append(authMethods, ssh.PasswordCallback(callback)) } port := _url.Port() |