From b6a22ce64a04688e0351b04311f74f70f43650db Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Wed, 28 Nov 2018 21:03:20 -0800 Subject: [PATCH] gofmt cleanup --- hkexnet/consts.go | 2 +- hkexnet/hkexnet.go | 10 +++++----- hkexshd/hkexshd.go | 11 +++++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hkexnet/consts.go b/hkexnet/consts.go index 3411ef5..38b67e8 100644 --- a/hkexnet/consts.go +++ b/hkexnet/consts.go @@ -33,7 +33,7 @@ type KEXAlg uint8 // Extended exit status codes - indicate comm/pty issues // rather than remote end normal UNIX exit codes const ( - CSENone = 1024 + iota + CSENone = 1024 + iota CSETruncCSO // No CSOExitStatus in payload CSEStillOpen // Channel closed unexpectedly CSEExecFail // cmd.Start() (exec) failed diff --git a/hkexnet/hkexnet.go b/hkexnet/hkexnet.go index 21e6fda..b58297a 100644 --- a/hkexnet/hkexnet.go +++ b/hkexnet/hkexnet.go @@ -79,8 +79,8 @@ type ( m *sync.Mutex // (internal) c *net.Conn // which also implements io.Reader, io.Writer, ... immClose bool - cipheropts uint32 // post-KEx cipher/hmac options - opts uint32 // post-KEx protocol options (caller-defined) + cipheropts uint32 // post-KEx cipher/hmac options + opts uint32 // post-KEx protocol options (caller-defined) WinCh chan WinSize Rows uint16 Cols uint16 @@ -891,9 +891,9 @@ func (hc Conn) Read(b []byte) (n int, err error) { logger.LogDebug(fmt.Sprintf("[Attempt to write data to closed tun [%d:%d]", lport, rport)) } } else if ctrlStatOp == CSOTunKeepAlive { - // client side has sent keepalive for tunnels -- if client - // dies or exits unexpectedly the absence of this will - // let the server know to hang up on Dial()ed server rports. + // client side has sent keepalive for tunnels -- if client + // dies or exits unexpectedly the absence of this will + // let the server know to hang up on Dial()ed server rports. _ = binary.BigEndian.Uint16(payloadBytes[0:2]) //logger.LogDebug(fmt.Sprintf("[Server] Got CSOTunKeepAlive")) for _, t := range *hc.tuns { diff --git a/hkexshd/hkexshd.go b/hkexshd/hkexshd.go index b7dfdd6..473aab7 100755 --- a/hkexshd/hkexshd.go +++ b/hkexshd/hkexshd.go @@ -56,8 +56,8 @@ func runClientToServerCopyAs(who, ttype string, conn *hkexnet.Conn, fpath string // Investigate -- rlm 2018-01-26) os.Clearenv() os.Setenv("HOME", u.HomeDir) // nolint: gosec,errcheck - os.Setenv("TERM", ttype) // nolint: gosec,errcheck - os.Setenv("HKEXSH", "1") // nolint: gosec,errcheck + os.Setenv("TERM", ttype) // nolint: gosec,errcheck + os.Setenv("HKEXSH", "1") // nolint: gosec,errcheck var c *exec.Cmd cmdName := "/bin/tar" @@ -309,10 +309,9 @@ func runShellAs(who, ttype string, cmd string, interactive bool, conn *hkexnet.C } // #gv:s/label=\"runShellAs\$4\"/label=\"deferChaffShutdown\"/ defer func() { - conn.DisableChaff() - conn.ShutdownChaff() + conn.DisableChaff() + conn.ShutdownChaff() }() - // ..and the pty to stdout. // This may take some time exceeding that of the @@ -548,7 +547,7 @@ func main() { hc.Write([]byte{1}) // nolint: gosec,errcheck } else { logger.LogNotice(fmt.Sprintln("Invalid user", string(rec.Who()))) // nolint: errcheck,gosec - hc.Write([]byte{0}) // nolint: gosec,errcheck + hc.Write([]byte{0}) // nolint: gosec,errcheck return }