aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar alecdwm 2016-04-08 12:59:31 +0200
committerGravatar alecdwm 2016-04-08 12:59:31 +0200
commit72cddce6da75b3ed90f51d646d61dc74c578c746 (patch)
tree75891f28cd73749d8f1b4687a11d92a31bd90835
parent571bf6d5d1adc02ea9205f21f1e20f9ce2c6c8b4 (diff)
protect against username-less conns
-rw-r--r--rsham.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/rsham.go b/rsham.go
index e1224a9..e2c4de2 100644
--- a/rsham.go
+++ b/rsham.go
@@ -83,7 +83,11 @@ func sshHandleConnection(nConn net.Conn, config *ssh.ServerConfig) {
sshLog.Warn("incoming connection failed handshake", "error", err)
}
- sshLog.Info("Client Connected", "User", conn.User(), "RemoteAddr", nConn.RemoteAddr())
+ if conn != nil {
+ sshLog.Info("Client Connected", "User", conn.User(), "RemoteAddr", nConn.RemoteAddr())
+ } else {
+ sshLog.Info("Client Connected", "RemoteAddr", nConn.RemoteAddr())
+ }
go ssh.DiscardRequests(reqs)