mirror of https://gogs.blitter.com/RLabs/xs
Fixed syntax errors from re-org
This commit is contained in:
parent
bd261a32e9
commit
9edcc5110c
|
@ -159,7 +159,7 @@ func (h HerraduraKEx) PeerD() *big.Int {
|
||||||
|
|
||||||
// SetPeerD stores the received peer's D value (contents, not ptr)
|
// SetPeerD stores the received peer's D value (contents, not ptr)
|
||||||
func (h *HerraduraKEx) SetPeerD(pd *big.Int) {
|
func (h *HerraduraKEx) SetPeerD(pd *big.Int) {
|
||||||
*h.peerD = *pd
|
h.peerD = new(big.Int).Set(pd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComputeFA computes the FA value, which must be sent to peer for KEx.
|
// ComputeFA computes the FA value, which must be sent to peer for KEx.
|
||||||
|
|
|
@ -327,7 +327,7 @@ func (hl HKExListener) Accept() (hc Conn, err error) {
|
||||||
hc.h.SetPeerD(d)
|
hc.h.SetPeerD(d)
|
||||||
log.Printf("** D:%s\n", hc.h.D().Text(16))
|
log.Printf("** D:%s\n", hc.h.D().Text(16))
|
||||||
log.Printf("**(s)** peerD:%s\n", hc.h.PeerD().Text(16))
|
log.Printf("**(s)** peerD:%s\n", hc.h.PeerD().Text(16))
|
||||||
hc.h.FA()
|
hc.h.ComputeFA()
|
||||||
log.Printf("**(s)** FA:%s\n", hc.h.FA())
|
log.Printf("**(s)** FA:%s\n", hc.h.FA())
|
||||||
|
|
||||||
// Send D and cipheropts/conn_opts to peer
|
// Send D and cipheropts/conn_opts to peer
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
hkexsh "blitter.com/go/hkexsh"
|
hkexsh "blitter.com/go/hkexsh"
|
||||||
|
"blitter.com/go/hkexsh/hkexnet"
|
||||||
isatty "github.com/mattn/go-isatty"
|
isatty "github.com/mattn/go-isatty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ func main() {
|
||||||
log.SetOutput(ioutil.Discard)
|
log.SetOutput(ioutil.Discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := hkexsh.Dial("tcp", server, cAlg, hAlg)
|
conn, err := hkexnet.Dial("tcp", server, cAlg, hAlg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Err!")
|
fmt.Println("Err!")
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -237,7 +238,7 @@ func main() {
|
||||||
// Copy() expects EOF so this will
|
// Copy() expects EOF so this will
|
||||||
// exit with outerr == nil
|
// exit with outerr == nil
|
||||||
//!_, outerr := io.Copy(conn, os.Stdin)
|
//!_, outerr := io.Copy(conn, os.Stdin)
|
||||||
_, outerr := func(conn *hkexsh.Conn, r io.Reader) (w int64, e error) {
|
_, outerr := func(conn *hkexnet.Conn, r io.Reader) (w int64, e error) {
|
||||||
return io.Copy(conn, r)
|
return io.Copy(conn, r)
|
||||||
}(conn, os.Stdin)
|
}(conn, os.Stdin)
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
hkexsh "blitter.com/go/hkexsh"
|
"blitter.com/go/hkexsh/hkexnet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handle pty resizes (notify server side)
|
// Handle pty resizes (notify server side)
|
||||||
func handleTermResizes(conn *hkexsh.Conn) {
|
func handleTermResizes(conn *hkexnet.Conn) {
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, syscall.SIGWINCH)
|
signal.Notify(ch, syscall.SIGWINCH)
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
@ -28,7 +28,7 @@ func handleTermResizes(conn *hkexsh.Conn) {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
termSzPacket := fmt.Sprintf("%d %d", rows, cols)
|
termSzPacket := fmt.Sprintf("%d %d", rows, cols)
|
||||||
conn.WritePacket([]byte(termSzPacket), hkexsh.CSOTermSize)
|
conn.WritePacket([]byte(termSzPacket), hkexnet.CSOTermSize)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
ch <- syscall.SIGWINCH // Initial resize.
|
ch <- syscall.SIGWINCH // Initial resize.
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
|
|
||||||
"blitter.com/go/goutmp"
|
"blitter.com/go/goutmp"
|
||||||
hkexsh "blitter.com/go/hkexsh"
|
hkexsh "blitter.com/go/hkexsh"
|
||||||
|
"blitter.com/go/hkexsh/hkexnet"
|
||||||
"blitter.com/go/hkexsh/spinsult"
|
"blitter.com/go/hkexsh/spinsult"
|
||||||
"github.com/kr/pty"
|
"github.com/kr/pty"
|
||||||
)
|
)
|
||||||
|
@ -80,7 +81,7 @@ func runCmdAs(who string, cmd string, conn hkex.Conn) (err error) {
|
||||||
// Run a command (via default shell) as a specific user
|
// Run a command (via default shell) as a specific user
|
||||||
//
|
//
|
||||||
// Uses ptys to support commands which expect a terminal.
|
// Uses ptys to support commands which expect a terminal.
|
||||||
func runShellAs(who string, cmd string, interactive bool, conn hkexsh.Conn, chaffing bool) (err error, exitStatus int) {
|
func runShellAs(who string, cmd string, interactive bool, conn hkexnet.Conn, chaffing bool) (err error, exitStatus int) {
|
||||||
u, _ := user.Lookup(who)
|
u, _ := user.Lookup(who)
|
||||||
var uid, gid uint32
|
var uid, gid uint32
|
||||||
fmt.Sscanf(u.Uid, "%d", &uid)
|
fmt.Sscanf(u.Uid, "%d", &uid)
|
||||||
|
@ -227,7 +228,7 @@ func main() {
|
||||||
|
|
||||||
// Listen on TCP port 2000 on all available unicast and
|
// Listen on TCP port 2000 on all available unicast and
|
||||||
// anycast IP addresses of the local system.
|
// anycast IP addresses of the local system.
|
||||||
l, err := hkexsh.Listen("tcp", laddr)
|
l, err := hkexnet.Listen("tcp", laddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -252,7 +253,7 @@ func main() {
|
||||||
// Handle the connection in a new goroutine.
|
// Handle the connection in a new goroutine.
|
||||||
// The loop then returns to accepting, so that
|
// The loop then returns to accepting, so that
|
||||||
// multiple connections may be served concurrently.
|
// multiple connections may be served concurrently.
|
||||||
go func(hc hkexsh.Conn) (e error) {
|
go func(hc hkexnet.Conn) (e error) {
|
||||||
defer hc.Close()
|
defer hc.Close()
|
||||||
|
|
||||||
//We use io.ReadFull() here to guarantee we consume
|
//We use io.ReadFull() here to guarantee we consume
|
||||||
|
|
Loading…
Reference in New Issue