go.crypto/ssh: try authentication methods in ClientConfig order.

LGTM=jpsugar, agl
R=agl, jpsugar
CC=golang-codereviews
https://golang.org/cl/92240045
This commit is contained in:
Han-Wen Nienhuys
2014-05-12 11:16:49 -07:00
committed by Adam Langley
parent f8eacb97ce
commit 6f0540ef5e
2 changed files with 30 additions and 5 deletions
+7 -5
View File
@@ -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
}
}
}