sshd: Close connection on failed handshake

Hopefully fixed #315
This commit is contained in:
Andrey Petrov 2019-04-17 16:57:30 -04:00
parent 67163a93a8
commit 5949f9792f

View File

@ -59,6 +59,7 @@ func (l *SSHListener) Serve() {
term, err := l.handleConn(conn)
if err != nil {
logger.Printf("[%s] Failed to handshake: %s", conn.RemoteAddr(), err)
conn.Close() // Must be closed to avoid a leak
return
}
l.HandlerFunc(term)