From 122d919ec1efcfb58483215da23f815853e24b81 Mon Sep 17 00:00:00 2001 From: Catalin Nicutar Date: Mon, 8 May 2017 13:54:44 +0100 Subject: [PATCH] ssh: change the local copy of the ServerConfig passed to NewServerConn Otherwise callers are forced to serialize access to the ServerConfig. Change-Id: Id36f4d2877ea28b18447ef777d3839b21136c22f Reviewed-on: https://go-review.googlesource.com/42821 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- ssh/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ssh/server.go b/ssh/server.go index 8e95acc..23b41d9 100644 --- a/ssh/server.go +++ b/ssh/server.go @@ -147,12 +147,12 @@ type ServerConn struct { // Request and NewChannel channels must be serviced, or the connection // will hang. func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) { - if config.MaxAuthTries == 0 { - config.MaxAuthTries = 6 - } - fullConf := *config fullConf.SetDefaults() + if fullConf.MaxAuthTries == 0 { + fullConf.MaxAuthTries = 6 + } + s := &connection{ sshConn: sshConn{conn: c}, }