Commits

jtdreisb committed 52a7fa2

No more fileTCPSockDial()

Comments (0)

Files changed (5)

fileset/bproc_darwin_amd64.go

  * the U.S. Government retains certain rights in this software.
  */
 
-package main
+package fileset
 
-import (
-	"os"
-	"net"
-	"fmt"
-	"syscall"
-	"unsafe"
-)
-
-func tcpSockDial(Lserver string) int {
-	/* try your best ... */
-	a, err := net.ResolveTCPAddr(Lserver)
-	if err != nil {
-		if *DebugLevel > 2 {
-			fmt.Fprintf(os.Stderr, "%s\n", err)
-		}
-		return -1
-	}
-	sock, e := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
-	if sock < 0 {
-		if *DebugLevel > 2 {
-			fmt.Printf("%v %v\n", sock, e)
-		}
-		return -1
-	}
-	/* format: BE short family, short port, long addr */
-	/* I'll do this bit stuffing until Go gets fixed and we can use a Conn for exec */
-	addr := make([]byte, 16)
-	addrlen := 16
-	rawaddr := []byte(a.IP)
-	addr[1] = syscall.AF_INET >> 8
-	addr[0] = syscall.AF_INET
-	addr[2] = uint8(a.Port >> 8)
-	addr[3] = uint8(a.Port)
-
-	addr[4] = uint8(rawaddr[12])
-	addr[5] = uint8(rawaddr[13])
-	addr[6] = uint8(rawaddr[14])
-	addr[7] = uint8(rawaddr[15])
-	//e = syscall.Connect(sock, a)
-	_, _, e1 := syscall.Syscall(syscall.SYS_CONNECT, uintptr(sock), uintptr(unsafe.Pointer(&addr[0])), uintptr(addrlen))
-	if e1 < 0 {
-		if *DebugLevel > 2 {
-			fmt.Printf("%v %v\n", sock, e)
-		}
-		return -1
-	}
-	return int(e1)
-
-}
+import ()
 
 
 func getIfc() int {

fileset/bproc_linux.go

  * the U.S. Government retains certain rights in this software.
  */
 
-package main
+package fileset
 
 import (
 	"syscall"

fileset/bproc_linux_386.go

  * the U.S. Government retains certain rights in this software.
  */
 
-package main
+package fileset
 
 import (
 	"os"
 	"log"
 )
 
-func tcpSockDial(Lserver string) int {
-	/* try your best ... */
-	a, err := net.ResolveTCPAddr(Lserver)
-	if err != nil {
-		if *DebugLevel > 2 {
-			fmt.Fprintf(os.Stderr, "%s\n", err)
-		}
-		return -1
-	}
-	sock, e := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
-	if sock < 0 {
-		if *DebugLevel > 2 {
-			log.Printf("%v %v\n", sock, e)
-		}
-		return -1
-	}
-	/* format: BE short family, short port, long addr */
-	/* I'll do this bit stuffing until Go gets fixed and we can use a Conn for exec */
-	connargs := make([]uintptr, 6)
-	addr := make([]byte, 16)
-	addrlen := 16
-	rawaddr := []byte(a.IP)
-	addr[1] = syscall.AF_INET >> 8
-	addr[0] = syscall.AF_INET
-	addr[2] = uint8(a.Port >> 8)
-	addr[3] = uint8(a.Port)
-
-	addr[4] = uint8(rawaddr[12])
-	addr[5] = uint8(rawaddr[13])
-	addr[6] = uint8(rawaddr[14])
-	addr[7] = uint8(rawaddr[15])
-	//e = syscall.Connect(sock, a)
-	//connargs[0] = uintptr(3)
-	connargs[0] = uintptr(sock)
-	connargs[1] = uintptr(unsafe.Pointer(&addr[0]))
-	connargs[2] = uintptr(addrlen)
-	_, _, e1 := syscall.Syscall(102, 3, uintptr(unsafe.Pointer(&connargs[0])), 0)
-	if e1 < 0 {
-		if *DebugLevel > 2 {
-			log.Printf("%v %v\n", sock, e)
-		}
-		return -1
-	}
-	return int(sock)
-
-}
-
 
 func ucred(fd int) (pid, uid, gid int) {
 	var length [1]int

fileset/bproc_linux_amd64.go

  * the U.S. Government retains certain rights in this software.
  */
 
-package main
+package fileset
 
 import (
 	"net"
 	"log"
 )
 
-func tcpSockDial(Lserver string) int {
-	/* try your best ... */
-	a, err := net.ResolveTCPAddr(Lserver)
-	if err != nil {
-		if *DebugLevel > 2 {
-			log.Printf("%s", err)
-		}
-		return -1
-	}
-	sock, e := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
-	if sock < 0 {
-		if *DebugLevel > 2 {
-			log.Printf("%v %v", sock, e)
-		}
-		return -1
-	}
-	/* format: BE short family, short port, long addr */
-	/* I'll do this bit stuffing until Go gets fixed and we can use a Conn for exec */
-	addr := make([]byte, 16)
-	addrlen := 16
-	rawaddr := []byte(a.IP)
-	addr[1] = syscall.AF_INET >> 8
-	addr[0] = syscall.AF_INET
-	addr[2] = uint8(a.Port >> 8)
-	addr[3] = uint8(a.Port)
-
-	addr[4] = uint8(rawaddr[12])
-	addr[5] = uint8(rawaddr[13])
-	addr[6] = uint8(rawaddr[14])
-	addr[7] = uint8(rawaddr[15])
-	_, _, e1 := syscall.Syscall(syscall.SYS_CONNECT, uintptr(sock), uintptr(unsafe.Pointer(&addr[0])), uintptr(addrlen))
-	if e1 < 0 {
-		if *DebugLevel > 2 {
-			log.Printf("%v %v", sock, e)
-		}
-		return -1
-	}
-	return int(sock)
-
-}
-
 
 func ucred(fd int) (pid, uid, gid int) {
 	var length [1]int

fileset/bproc_linux_arm.go

  * the U.S. Government retains certain rights in this software.
  */
 
-package main
+package fileset
 
 import (
 	"net"