aboutsummaryrefslogtreecommitdiff
path: root/ssh/client_auth.go
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2014-05-12 11:16:49 -0700
committerAdam Langley <agl@golang.org>2014-05-12 11:16:49 -0700
commit6f0540ef5e740839c84c8a89ac9cd1c72a3bdacd (patch)
tree684115228511470246c3d2b4f6c07be5a140c87f /ssh/client_auth.go
parentf8eacb97ce7be6eed2ec9f3c07ee2ea1b73db629 (diff)
downloadgo-x-crypto-6f0540ef5e740839c84c8a89ac9cd1c72a3bdacd.tar.xz
go.crypto/ssh: try authentication methods in ClientConfig order.
LGTM=jpsugar, agl R=agl, jpsugar CC=golang-codereviews https://golang.org/cl/92240045
Diffstat (limited to 'ssh/client_auth.go')
-rw-r--r--ssh/client_auth.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/ssh/client_auth.go b/ssh/client_auth.go
index 5b7aa30..c41e163 100644
--- a/ssh/client_auth.go
+++ b/ssh/client_auth.go
@@ -41,15 +41,17 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
tried[auth.method()] = true
auth = nil
+
+ findNext:
for _, a := range config.Auth {
candidateMethod := a.method()
+ if tried[candidateMethod] {
+ continue
+ }
for _, meth := range methods {
- if meth != candidateMethod {
- continue
- }
- if !tried[meth] {
+ if meth == candidateMethod {
auth = a
- break
+ break findNext
}
}
}