From b1cd29cc2781abfc0297d251ff3519ed692d45a7 Mon Sep 17 00:00:00 2001 From: NI Date: Mon, 2 Sep 2019 12:37:51 +0800 Subject: [PATCH] Close connection when SSH handshake fails. --- application/commands/ssh.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/commands/ssh.go b/application/commands/ssh.go index 2164556..f5a8f06 100644 --- a/application/commands/ssh.go +++ b/application/commands/ssh.go @@ -419,6 +419,8 @@ func (d *sshClient) dialRemote( c, chans, reqs, err := ssh.NewClientConn(&sshConn, addr, config) if err != nil { + sshConn.Close() + return nil, nil, err }