diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-28 08:23:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 08:23:59 -0400 |
commit | 74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3 (patch) | |
tree | af0904e9ec643dea2caa8d39a55764adc38c069f /vendor/golang.org/x/crypto/ssh/client_auth.go | |
parent | 061c93f70101026d79cca6e75ac0c565e1fa99ec (diff) | |
parent | 90a86cad3a6f007c6708406d8a78528fbb302a0a (diff) | |
download | podman-74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3.tar.gz podman-74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3.tar.bz2 podman-74bdf52c401dd1c9cd3c636d4fa8ea94e7c88ef3.zip |
Merge pull request #7472 from containers/dependabot/go_modules/k8s.io/apimachinery-0.19.0
Bump k8s.io/apimachinery from 0.18.8 to 0.19.0
Diffstat (limited to 'vendor/golang.org/x/crypto/ssh/client_auth.go')
-rw-r--r-- | vendor/golang.org/x/crypto/ssh/client_auth.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go index 0590070e2..f3265655e 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -36,7 +36,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { // during the authentication phase the client first attempts the "none" method // then any untried methods suggested by the server. - tried := make(map[string]bool) + var tried []string var lastMethods []string sessionID := c.transport.getSessionID() @@ -49,7 +49,9 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { // success return nil } else if ok == authFailure { - tried[auth.method()] = true + if m := auth.method(); !contains(tried, m) { + tried = append(tried, m) + } } if methods == nil { methods = lastMethods @@ -61,7 +63,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { findNext: for _, a := range config.Auth { candidateMethod := a.method() - if tried[candidateMethod] { + if contains(tried, candidateMethod) { continue } for _, meth := range methods { @@ -72,16 +74,16 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { } } } - return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", keys(tried)) + return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", tried) } -func keys(m map[string]bool) []string { - s := make([]string, 0, len(m)) - - for key := range m { - s = append(s, key) +func contains(list []string, e string) bool { + for _, s := range list { + if s == e { + return true + } } - return s + return false } // An AuthMethod represents an instance of an RFC 4252 authentication method. |