gofmt cleanup

This commit is contained in:
Russ Magee 2018-11-28 21:03:20 -08:00
parent 103d76989e
commit b6a22ce64a
3 changed files with 11 additions and 12 deletions

View file

@ -33,7 +33,7 @@ type KEXAlg uint8
// Extended exit status codes - indicate comm/pty issues // Extended exit status codes - indicate comm/pty issues
// rather than remote end normal UNIX exit codes // rather than remote end normal UNIX exit codes
const ( const (
CSENone = 1024 + iota CSENone = 1024 + iota
CSETruncCSO // No CSOExitStatus in payload CSETruncCSO // No CSOExitStatus in payload
CSEStillOpen // Channel closed unexpectedly CSEStillOpen // Channel closed unexpectedly
CSEExecFail // cmd.Start() (exec) failed CSEExecFail // cmd.Start() (exec) failed

View file

@ -79,8 +79,8 @@ type (
m *sync.Mutex // (internal) m *sync.Mutex // (internal)
c *net.Conn // which also implements io.Reader, io.Writer, ... c *net.Conn // which also implements io.Reader, io.Writer, ...
immClose bool immClose bool
cipheropts uint32 // post-KEx cipher/hmac options cipheropts uint32 // post-KEx cipher/hmac options
opts uint32 // post-KEx protocol options (caller-defined) opts uint32 // post-KEx protocol options (caller-defined)
WinCh chan WinSize WinCh chan WinSize
Rows uint16 Rows uint16
Cols 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)) logger.LogDebug(fmt.Sprintf("[Attempt to write data to closed tun [%d:%d]", lport, rport))
} }
} else if ctrlStatOp == CSOTunKeepAlive { } else if ctrlStatOp == CSOTunKeepAlive {
// client side has sent keepalive for tunnels -- if client // client side has sent keepalive for tunnels -- if client
// dies or exits unexpectedly the absence of this will // dies or exits unexpectedly the absence of this will
// let the server know to hang up on Dial()ed server rports. // let the server know to hang up on Dial()ed server rports.
_ = binary.BigEndian.Uint16(payloadBytes[0:2]) _ = binary.BigEndian.Uint16(payloadBytes[0:2])
//logger.LogDebug(fmt.Sprintf("[Server] Got CSOTunKeepAlive")) //logger.LogDebug(fmt.Sprintf("[Server] Got CSOTunKeepAlive"))
for _, t := range *hc.tuns { for _, t := range *hc.tuns {

View file

@ -56,8 +56,8 @@ func runClientToServerCopyAs(who, ttype string, conn *hkexnet.Conn, fpath string
// Investigate -- rlm 2018-01-26) // Investigate -- rlm 2018-01-26)
os.Clearenv() os.Clearenv()
os.Setenv("HOME", u.HomeDir) // nolint: gosec,errcheck os.Setenv("HOME", u.HomeDir) // nolint: gosec,errcheck
os.Setenv("TERM", ttype) // nolint: gosec,errcheck os.Setenv("TERM", ttype) // nolint: gosec,errcheck
os.Setenv("HKEXSH", "1") // nolint: gosec,errcheck os.Setenv("HKEXSH", "1") // nolint: gosec,errcheck
var c *exec.Cmd var c *exec.Cmd
cmdName := "/bin/tar" cmdName := "/bin/tar"
@ -309,11 +309,10 @@ func runShellAs(who, ttype string, cmd string, interactive bool, conn *hkexnet.C
} }
// #gv:s/label=\"runShellAs\$4\"/label=\"deferChaffShutdown\"/ // #gv:s/label=\"runShellAs\$4\"/label=\"deferChaffShutdown\"/
defer func() { defer func() {
conn.DisableChaff() conn.DisableChaff()
conn.ShutdownChaff() conn.ShutdownChaff()
}() }()
// ..and the pty to stdout. // ..and the pty to stdout.
// This may take some time exceeding that of the // This may take some time exceeding that of the
// actual command's lifetime, so the c.Wait() below // actual command's lifetime, so the c.Wait() below
@ -548,7 +547,7 @@ func main() {
hc.Write([]byte{1}) // nolint: gosec,errcheck hc.Write([]byte{1}) // nolint: gosec,errcheck
} else { } else {
logger.LogNotice(fmt.Sprintln("Invalid user", string(rec.Who()))) // nolint: errcheck,gosec 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 return
} }