diff options
author | Anders F Björklund <anders.f.bjorklund@gmail.com> | 2020-12-04 17:08:39 +0100 |
---|---|---|
committer | Anders F Björklund <anders.f.bjorklund@gmail.com> | 2020-12-04 17:09:49 +0100 |
commit | aaade40780406dd1de4907497d7e0301b053cbc5 (patch) | |
tree | 8a896f09a90587be55422aa3bad71374bf7c32e2 | |
parent | 70284b18cc7d4dc478c439cdda60ba64cfec060b (diff) | |
download | podman-aaade40780406dd1de4907497d7e0301b053cbc5.tar.gz podman-aaade40780406dd1de4907497d7e0301b053cbc5.tar.bz2 podman-aaade40780406dd1de4907497d7e0301b053cbc5.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 a5683796a..f2cb3147c 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() |