Skip to content

Commit

Permalink
Merge pull request #8596 from afbjorklund/password-callback
Browse files Browse the repository at this point in the history
Use PasswordCallback instead of Password for ssh
  • Loading branch information
openshift-merge-robot authored Dec 4, 2020
2 parents c55b831 + aaade40 commit 07af857
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/bindings/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 07af857

Please sign in to comment.