go.crypto/ssh: improve error message when no authentication methods remain

R=golang-dev
CC=golang-dev
https://golang.org/cl/5960044
This commit is contained in:
Dave Cheney
2012-04-01 10:50:09 -04:00
committed by Adam Langley
parent 521edf84a0
commit 15577f9df4
+9 -2
View File
@@ -5,7 +5,7 @@
package ssh
import (
"errors"
"fmt"
"io"
)
@@ -52,7 +52,14 @@ func (c *ClientConn) authenticate(session []byte) error {
}
}
}
return errors.New("ssh: unable to authenticate, no supported methods remain")
return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", keys(tried))
}
func keys(m map[string]bool) (s []string) {
for k, _ := range m {
s = append(s, k)
}
return
}
// A ClientAuth represents an instance of an RFC 4252 authentication method.