From 15577f9df470bf5e9292240050c4c84d210732d7 Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Sun, 1 Apr 2012 10:50:09 -0400 Subject: [PATCH] go.crypto/ssh: improve error message when no authentication methods remain R=golang-dev CC=golang-dev https://golang.org/cl/5960044 --- ssh/client_auth.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ssh/client_auth.go b/ssh/client_auth.go index 721a21f..7ae670f 100644 --- a/ssh/client_auth.go +++ b/ssh/client_auth.go @@ -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.