mirror of https://gogs.blitter.com/RLabs/xs
Comment cleanup
This commit is contained in:
parent
119c039b91
commit
74be6173b6
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION := 0.9.5.4
|
VERSION := 0.9.5.5
|
||||||
.PHONY: lint vis clean common client server passwd\
|
.PHONY: lint vis clean common client server passwd\
|
||||||
subpkgs install uninstall reinstall scc
|
subpkgs install uninstall reinstall scc
|
||||||
|
|
||||||
|
|
2
xs/xs.go
2
xs/xs.go
|
@ -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) {
|
_, outerr := func(conn *xsnet.Conn, r io.Reader) (w int64, e error) {
|
||||||
// Copy() expects EOF so this will
|
// Copy() expects EOF so this will
|
||||||
// exit with outerr == nil
|
// 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)
|
w, e = Copy(conn, r)
|
||||||
return w, e
|
return w, e
|
||||||
}(conn, os.Stdin)
|
}(conn, os.Stdin)
|
||||||
|
|
42
xsd/xsd.go
42
xsd/xsd.go
|
@ -77,12 +77,7 @@ func runClientToServerCopyAs(who, ttype string, conn *xsnet.Conn, fpath string,
|
||||||
log.Println("uid:", uid, "gid:", gid)
|
log.Println("uid:", uid, "gid:", gid)
|
||||||
|
|
||||||
// Need to clear server's env and set key vars of the
|
// Need to clear server's env and set key vars of the
|
||||||
// target user. This isn't perfect (TERM doesn't seem to
|
// target user.
|
||||||
// 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)
|
|
||||||
os.Clearenv()
|
os.Clearenv()
|
||||||
os.Setenv("HOME", u.HomeDir)
|
os.Setenv("HOME", u.HomeDir)
|
||||||
os.Setenv("TERM", ttype)
|
os.Setenv("TERM", ttype)
|
||||||
|
@ -109,9 +104,10 @@ func runClientToServerCopyAs(who, ttype string, conn *xsnet.Conn, fpath string,
|
||||||
|
|
||||||
c.Dir = destDir
|
c.Dir = destDir
|
||||||
|
|
||||||
//If os.Clearenv() isn't called by server above these will be seen in the
|
//If os.Clearenv() isn't called by server above these will be seen
|
||||||
//client's session env.
|
//in the client's session env.
|
||||||
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
|
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=",
|
||||||
|
// "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
|
||||||
//c.Dir = u.HomeDir
|
//c.Dir = u.HomeDir
|
||||||
c.SysProcAttr = &syscall.SysProcAttr{}
|
c.SysProcAttr = &syscall.SysProcAttr{}
|
||||||
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
|
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)
|
log.Println("uid:", uid, "gid:", gid)
|
||||||
|
|
||||||
// Need to clear server's env and set key vars of the
|
// Need to clear server's env and set key vars of the
|
||||||
// target user. This isn't perfect (TERM doesn't seem to
|
// target user.
|
||||||
// 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)
|
|
||||||
os.Clearenv()
|
os.Clearenv()
|
||||||
_ = os.Setenv("HOME", u.HomeDir)
|
_ = os.Setenv("HOME", u.HomeDir)
|
||||||
_ = os.Setenv("TERM", ttype)
|
_ = os.Setenv("TERM", ttype)
|
||||||
|
@ -204,9 +195,10 @@ func runServerToClientCopyAs(who, ttype string, conn *xsnet.Conn, srcPath string
|
||||||
|
|
||||||
c = exec.Command(cmdName, cmdArgs...)
|
c = exec.Command(cmdName, cmdArgs...)
|
||||||
|
|
||||||
//If os.Clearenv() isn't called by server above these will be seen in the
|
//If os.Clearenv() isn't called by server above these will be seen
|
||||||
//client's session env.
|
//in the client's session env.
|
||||||
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
|
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=",
|
||||||
|
// "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
|
||||||
c.Dir = u.HomeDir
|
c.Dir = u.HomeDir
|
||||||
c.SysProcAttr = &syscall.SysProcAttr{}
|
c.SysProcAttr = &syscall.SysProcAttr{}
|
||||||
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
|
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)
|
log.Println("uid:", uid, "gid:", gid)
|
||||||
|
|
||||||
// Need to clear server's env and set key vars of the
|
// Need to clear server's env and set key vars of the
|
||||||
// target user. This isn't perfect (TERM doesn't seem to
|
// target user.
|
||||||
// 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)
|
|
||||||
os.Clearenv()
|
os.Clearenv()
|
||||||
_ = os.Setenv("HOME", u.HomeDir)
|
_ = os.Setenv("HOME", u.HomeDir)
|
||||||
_ = os.Setenv("TERM", ttype)
|
_ = 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 = &syscall.SysProcAttr{}
|
||||||
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
|
c.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
|
||||||
}
|
}
|
||||||
//If os.Clearenv() isn't called by server above these will be seen in the
|
//If os.Clearenv() isn't called by server above these will be seen
|
||||||
//client's session env.
|
//in the client's session env.
|
||||||
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=", "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
|
//c.Env = []string{"HOME=" + u.HomeDir, "SUDO_GID=", "SUDO_UID=",
|
||||||
|
// "SUDO_USER=", "SUDO_COMMAND=", "MAIL=", "LOGNAME="+who}
|
||||||
c.Dir = u.HomeDir
|
c.Dir = u.HomeDir
|
||||||
|
|
||||||
// Start the command with a pty.
|
// Start the command with a pty.
|
||||||
|
|
19
xsnet/net.go
19
xsnet/net.go
|
@ -308,9 +308,9 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
|
||||||
// applyConnExtensions processes optional Dial() negotiation
|
// applyConnExtensions processes optional Dial() negotiation
|
||||||
// parameters. See also getkexalgnum().
|
// parameters. See also getkexalgnum().
|
||||||
//
|
//
|
||||||
// Currently defined extension values
|
// # Currently defined extension values
|
||||||
//
|
//
|
||||||
// KEx algs
|
// # KEx algs
|
||||||
//
|
//
|
||||||
// KEX_HERRADURA256 KEX_HERRADURA512 KEX_HERRADURA1024 KEX_HERRADURA2048
|
// 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
|
// 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
|
// C_AES_256 C_TWOFISH_128 C_BLOWFISH_128 C_CRYPTMT1 C_CHACHA20_12 C_HOPSCOTCH
|
||||||
//
|
//
|
||||||
// Session HMACs
|
// # Session HMACs
|
||||||
//
|
//
|
||||||
// H_SHA256 H_SHA512
|
// H_SHA256 H_SHA512
|
||||||
func (hc *Conn) applyConnExtensions(extensions ...string) {
|
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
|
// Dial as net.Dial(), but with implicit key exchange to set up secure
|
||||||
// channel on connect
|
// channel on connect
|
||||||
//
|
//
|
||||||
// Can be called like net.Dial(), defaulting to C_AES_256/H_SHA256,
|
// Can be called like net.Dial(), defaulting to C_AES_256/H_SHA256,
|
||||||
// or additional extensions can be passed amongst the following:
|
// 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
|
// See go doc -u xsnet.applyConnExtensions
|
||||||
func Dial(protocol string, ipport string, extensions ...string) (hc Conn, err error) {
|
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.
|
// 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"))
|
||||||
|
// 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 {
|
for _, t := range *hc.tuns {
|
||||||
hc.Lock()
|
hc.Lock()
|
||||||
t.KeepAlive = 0
|
t.KeepAlive = 0
|
||||||
|
|
|
@ -37,6 +37,8 @@ type (
|
||||||
// client starts worker to receive/send data using lport
|
// client starts worker to receive/send data using lport
|
||||||
// ... client disconnects: sends remhost [CSOTunClose:rport]
|
// ... client disconnects: sends remhost [CSOTunClose:rport]
|
||||||
// ... or server disconnects: sends client [CSOTunClose:lport]
|
// ... 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
|
// server at any time sends [CSOTunRefused:rport] if daemon died
|
||||||
// --
|
// --
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue