Comment cleanup

This commit is contained in:
Russ Magee 2023-11-03 23:57:55 -07:00
parent 119c039b91
commit 74be6173b6
5 changed files with 31 additions and 36 deletions

View File

@ -1,4 +1,4 @@
VERSION := 0.9.5.4
VERSION := 0.9.5.5
.PHONY: lint vis clean common client server passwd\
subpkgs install uninstall reinstall scc

View File

@ -544,6 +544,8 @@ func doShellMode(isInteractive bool, conn *xsnet.Conn, oldState *xs.State, rec *
_, outerr := func(conn *xsnet.Conn, r io.Reader) (w int64, e error) {
// Copy() expects EOF so this will
// exit with outerr == nil
// NOTE we use a local implementation of Copy() to allow
// for custom key sequences to trigger local actions
w, e = Copy(conn, r)
return w, e
}(conn, os.Stdin)

View File

@ -77,12 +77,7 @@ func runClientToServerCopyAs(who, ttype string, conn *xsnet.Conn, fpath string,
log.Println("uid:", uid, "gid:", gid)
// Need to clear server's env and set key vars of the
// target user. This isn't perfect (TERM doesn't seem to
// work 100%; ANSI/xterm colour isn't working even
// if we set "xterm" or "ansi" here; and line count
// reported by 'stty -a' defaults to 24 regardless
// of client shell window used to run client.
// Investigate -- rlm 2018-01-26)
// target user.
os.Clearenv()
os.Setenv("HOME", u.HomeDir)
os.Setenv("TERM", ttype)
@ -109,9 +104,10 @@ func runClientToServerCopyAs(who, ttype string, conn *xsnet.Conn, fpath string,
c.Dir = destDir
//If os.Clearenv() isn't called by server above these will be seen in the
//client's session env.
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
//If os.Clearenv() isn't called by server above these will be seen
//in the client's session env.
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=",
// "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
//c.Dir = u.HomeDir
c.SysProcAttr = &syscall.SysProcAttr{}
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
@ -182,12 +178,7 @@ func runServerToClientCopyAs(who, ttype string, conn *xsnet.Conn, srcPath string
log.Println("uid:", uid, "gid:", gid)
// Need to clear server's env and set key vars of the
// target user. This isn't perfect (TERM doesn't seem to
// work 100%; ANSI/xterm colour isn't working even
// if we set "xterm" or "ansi" here; and line count
// reported by 'stty -a' defaults to 24 regardless
// of client shell window used to run client.
// Investigate -- rlm 2018-01-26)
// target user.
os.Clearenv()
_ = os.Setenv("HOME", u.HomeDir)
_ = os.Setenv("TERM", ttype)
@ -204,9 +195,10 @@ func runServerToClientCopyAs(who, ttype string, conn *xsnet.Conn, srcPath string
c = exec.Command(cmdName, cmdArgs...)
//If os.Clearenv() isn't called by server above these will be seen in the
//client's session env.
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
//If os.Clearenv() isn't called by server above these will be seen
//in the client's session env.
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=",
// "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
c.Dir = u.HomeDir
c.SysProcAttr = &syscall.SysProcAttr{}
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
@ -272,12 +264,7 @@ func runShellAs(who, hname, ttype, cmd string, interactive bool, //nolint:funlen
log.Println("uid:", uid, "gid:", gid)
// Need to clear server's env and set key vars of the
// target user. This isn't perfect (TERM doesn't seem to
// work 100%; ANSI/xterm colour isn't working even
// if we set "xterm" or "ansi" here; and line count
// reported by 'stty -a' defaults to 24 regardless
// of client shell window used to run client.
// Investigate -- rlm 2018-01-26)
// target user.
os.Clearenv()
_ = os.Setenv("HOME", u.HomeDir)
_ = os.Setenv("TERM", ttype)
@ -312,9 +299,10 @@ func runShellAs(who, hname, ttype, cmd string, interactive bool, //nolint:funlen
c.SysProcAttr = &syscall.SysProcAttr{}
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
}
//If os.Clearenv() isn't called by server above these will be seen in the
//client's session env.
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
//If os.Clearenv() isn't called by server above these will be seen
//in the client's session env.
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=",
// "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
c.Dir = u.HomeDir
// Start the command with a pty.

View File

@ -308,9 +308,9 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
// applyConnExtensions processes optional Dial() negotiation
// parameters. See also getkexalgnum().
//
// Currently defined extension values
// # Currently defined extension values
//
// KEx algs
// # KEx algs
//
// KEX_HERRADURA256 KEX_HERRADURA512 KEX_HERRADURA1024 KEX_HERRADURA2048
//
@ -318,11 +318,11 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
//
// KEX_NEWHOPE KEX_NEWHOPE_SIMPLE
//
// Session (symmetric) crypto
// # Session (symmetric) crypto
//
// C_AES_256 C_TWOFISH_128 C_BLOWFISH_128 C_CRYPTMT1 C_CHACHA20_12 C_HOPSCOTCH
//
// Session HMACs
// # Session HMACs
//
// H_SHA256 H_SHA512
func (hc *Conn) applyConnExtensions(extensions ...string) {
@ -882,12 +882,12 @@ func HKExAcceptSetup(c *net.Conn, hc *Conn) (err error) {
// Dial as net.Dial(), but with implicit key exchange to set up secure
// channel on connect
//
// Can be called like net.Dial(), defaulting to C_AES_256/H_SHA256,
// or additional extensions can be passed amongst the following:
// Can be called like net.Dial(), defaulting to C_AES_256/H_SHA256,
// or additional extensions can be passed amongst the following:
//
// "C_AES_256" | "C_TWOFISH_128" | ...
// "C_AES_256" | "C_TWOFISH_128" | ...
//
// "H_SHA256" | "H_SHA512" | ...
// "H_SHA256" | "H_SHA512" | ...
//
// See go doc -u xsnet.applyConnExtensions
func Dial(protocol string, ipport string, extensions ...string) (hc Conn, err error) {
@ -1423,6 +1423,9 @@ func (hc Conn) Read(b []byte) (n int, err error) {
// 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"))
// though CSOTunKeepAlive sends an endp (uint16), we don't use it,
// preferring to refresh *all* tunnels on the message.
// (?rlm 2023-11-04 -- TODO: verify this, it's been a while.)
for _, t := range *hc.tuns {
hc.Lock()
t.KeepAlive = 0

View File

@ -37,6 +37,8 @@ type (
// client starts worker to receive/send data using lport
// ... client disconnects: sends remhost [CSOTunClose:rport]
// ... or server disconnects: sends client [CSOTunClose:lport]
// ... or server disconnects: due to client failing to send TunKeepAlive
// events for too long
// server at any time sends [CSOTunRefused:rport] if daemon died
// --