x/crypto/ssh: bail early if a server has no auth methods configured.
Change-Id: I58fdfbe00fcc4ca09da9699edcc181cc512feef7 Reviewed-on: https://go-review.googlesource.com/9807 Reviewed-by: JP Sugarbroad <jpsugar@google.com> Reviewed-by: Adam Langley <agl@golang.org>
This commit is contained in:
committed by
Adam Langley
parent
24ffb5feb3
commit
74f810a015
@@ -168,6 +168,10 @@ func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error)
|
||||
return nil, errors.New("ssh: server has no host keys")
|
||||
}
|
||||
|
||||
if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil {
|
||||
return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
|
||||
}
|
||||
|
||||
if config.ServerVersion != "" {
|
||||
s.serverVersion = []byte(config.ServerVersion)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user