From chris@tisdec.tis.tandy.com Mon Dec 20 15:27:35 1993
Received: by florida.syl.dl.nec.com (4.1/YDL1.9-920708.13)
	id AA11983(florida.syl.dl.nec.com); Mon, 20 Dec 93 15:27:33 CST
Received: by texas.syl.dl.nec.com (4.1/YDL1.9-930614.17)
	id AA20049(texas.syl.dl.nec.com); Mon, 20 Dec 93 15:27:23 CST
Received: from tcgw.tandy.com by relay.tandy.com (5.65/3.1.090690)
	id AA21990; Mon, 20 Dec 93 15:24:39 -0600
Received: from tisdec.tis.tandy.com by tcgw.tandy.com (5.65/3.1.090690)
	id AA04573; Mon, 20 Dec 93 15:14:14 -0600
Received: by tisdec.tis.tandy.com (5.65/DEC-Ultrix/4.3)
	id AA19850; Mon, 20 Dec 1993 15:13:57 -0600
From: chris@tisdec.tis.tandy.com (Chris Riney)
Message-Id: <9312202113.AA19850@tisdec.tis.tandy.com>
Subject: socks 4.1 patches for SCO/ODT & BSDi
To: ylee@syl.dl.nec.com
Date: Mon, 20 Dec 1993 15:13:53 -0600 (CST)
Cc: chris@tisdec.tis.tandy.com (Chris Riney)
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 14329     
Status: RO

Greetings and Happy Holidays,

I have finally had a chance to get the socks 4.1 code ported to SCO/ODT 2.x
and BSDi v1.0.  Sorry I did not make it in time for the final 4.1 release,
as I had 90% of it working under 4.1pre-release.  I have set the release
string to 4.1d so as to distinguish the changes that I have made, but you
can (probably will) set it to something else.

The utilities have been built (and work fine) on BSD/386, SCO/ODT 2.x,
and ULTRIX 4.3A.

With 4.1 it was an easy task (nothing like the nightmare 4.0 was looking
like). 90% of it was adding '#if defined(SCO)' statements.  There were a
few instances where I had to include some new or/different headers, and
one instance where the order had to be changed.
(Sorry, I got a few local changes in the include/socks.h diff)


We are running the server on a SCO/ODT 2.x system that has been stripped
down to the equivelant of 'SCO UNIX System V/386  Release 3.2'

The next target is Novell with it's TCP/IP drivers/API.

==========================================================================
Chris Riney                     E-mail: chris@sasoom.tis.tandy.com
Tandy Information Services              chris.riney@tandy.com
Tandy Technology Sqr, Suite 200
Fort Worth, TX 76102             Phone: 817/878-0308; 8:00am-5:00pm CST,Mo-Fr

### Beinging of patch file
## you need to be in ..../socks.cstc.4.1
*** ./rtelnet/telnet/sys_bsd.c.dist	Fri Dec 17 11:16:54 1993
--- ./rtelnet/telnet/sys_bsd.c	Mon Dec 20 12:58:33 1993
***************
*** 26,32 ****
   * (at least between 4.x and dos) which is used in telnet.c.
   */
  
! #if !defined(hpux) && !defined(AIX) && !defined(SVR3) && !defined(ultrix) && !defined(LINUX)
  #include <sys/filio.h>
  #endif
  #include <fcntl.h>
--- 26,32 ----
   * (at least between 4.x and dos) which is used in telnet.c.
   */
  
! #if !defined(hpux) && !defined(AIX) && !defined(SVR3) && !defined(ultrix) && !defined(LINUX) && !defined(__bsdi__)
  #include <sys/filio.h>
  #endif
  #include <fcntl.h>
***************
*** 45,50 ****
--- 45,55 ----
  #include "externs.h"
  #include "types.h"
  
+ #ifdef SCO
+ #include <sys/stream.h>
+ #include <sys/ptem.h>
+ #endif
+ 
  #if	defined(CRAY) || (defined(USE_TERMIO) && !defined(SYSV_TERMIO))
  #define	SIG_FUNC_RET	void
  #else
***************
*** 606,612 ****
  #endif	/* SIGTSTP */
  #ifdef	SIGINFO
  	static SIG_FUNC_RET ayt();
! #endif	SIGINFO
  
  #ifdef	SIGTSTP
  	(void) signal(SIGTSTP, susp);
--- 611,617 ----
  #endif	/* SIGTSTP */
  #ifdef	SIGINFO
  	static SIG_FUNC_RET ayt();
! #endif	/* SIGINFO */
  
  #ifdef	SIGTSTP
  	(void) signal(SIGTSTP, susp);
***************
*** 613,619 ****
  #endif	/* SIGTSTP */
  #ifdef	SIGINFO
  	(void) signal(SIGINFO, ayt);
! #endif	SIGINFO
  #if	defined(USE_TERMIO) && defined(NOKERNINFO)
  	tmp_tc.c_lflag |= NOKERNINFO;
  #endif
--- 618,624 ----
  #endif	/* SIGTSTP */
  #ifdef	SIGINFO
  	(void) signal(SIGINFO, ayt);
! #endif	/* SIGINFO */
  #if	defined(USE_TERMIO) && defined(NOKERNINFO)
  	tmp_tc.c_lflag |= NOKERNINFO;
  #endif
***************
*** 657,663 ****
  	SIG_FUNC_RET ayt_status();
  
  	(void) signal(SIGINFO, ayt_status);
! #endif	SIGINFO
  
  #ifdef	SIGTSTP
  	(void) signal(SIGTSTP, SIG_DFL);
--- 662,668 ----
  	SIG_FUNC_RET ayt_status();
  
  	(void) signal(SIGINFO, ayt_status);
! #endif	/* SIGINFO */
  
  #ifdef	SIGTSTP
  	(void) signal(SIGTSTP, SIG_DFL);
***************
*** 664,670 ****
  #if defined(SOLARIS)
  	sigrelse(SIGTSTP);
  # else
! #  ifndef LINUX
  	(void) sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
  #  endif /* LINUX */
  # endif
--- 669,675 ----
  #if defined(SOLARIS)
  	sigrelse(SIGTSTP);
  # else
! #  if !defined(LINUX) && !defined(SCO)
  	(void) sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
  #  endif /* LINUX */
  # endif
*** ./rtelnet/telnet/commands.c.dist	Fri Dec 17 13:28:58 1993
--- ./rtelnet/telnet/commands.c	Mon Dec 20 12:36:13 1993
***************
*** 22,28 ****
  
  #if	defined(unix)
  #include <sys/param.h>
! #ifdef	CRAY
  #include <sys/types.h>
  #endif
  #include <sys/file.h>
--- 22,28 ----
  
  #if	defined(unix)
  #include <sys/param.h>
! #if defined(CRAY) || defined(SCO)
  #include <sys/types.h>
  #endif
  #include <sys/file.h>
***************
*** 1386,1392 ****
--- 1386,1396 ----
      char *argv[];
  {
      setcommandmode();
+ #ifdef SCO
+     switch(fork()) {
+ #else
      switch(vfork()) {
+ #endif
      case -1:
  	perror("Fork failed\n");
  	break;
*** ./rtelnet/Config.local.dist	Fri Dec 17 11:15:35 1993
--- ./rtelnet/Config.local	Fri Dec 17 11:13:49 1993
***************
*** 650,654 ****
--- 650,688 ----
  		CC="${CC}" LCCFLAGS="-O"
  # <<< Pax@metrolink.com
  
+ # >>> chris.riney@tandy.com
+ sco:
+ 	make -f Makefile.generic ${WHAT} \
+ 		LIBS="${SOCKS_LIB} -L../libtelnet -ltelnet ${RESOLV_LIB} -ltermlib" \
+ 		LIBPATH="/lib/libc.a \
+ 				../libtelnet/libtelnet.a" \
+ 		DEST=${DESTDIR}/usr/ucb \
+ 		DEFINES="-DSCO -DSVR3 -DTERMCAP -DUSE_TERMIO \
+ 			-DKLUDGELINEMODE -DSTREAMS \
+ 			-DAUTHENTICATE -DENCRYPT \
+ 			-DDIAGNOSTICS " \
+ 		INCLUDES="-I.." \
+ 		LIB_OBJ="" \
+ 		LIB_SRC="" \
+ 		AR=ar ARFLAGS=rc RANLIB=echo \
+ 		LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \
+ 		CC="${CC}" LCCFLAGS="-O"
+ 
+ bsdi:
+ 	${MAKE} -f Makefile.generic ${WHAT} \
+ 		LIBS="${SOCKS_LIB} -ltermcap ../libtelnet/libtelnet.a \
+ 			${RESOLV_LV_LIB}" \
+ 		LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \
+ 			../libtelnet/libtelnet.a" \
+ 		DEST=${DESTDIR}/usr/bin \
+ 		DEFINES="-DTERMCAP -DKLUDGELINEMODE \
+ 			-DUSE_TERMIO -DDIAGNOSTICS" \
+ 		INCLUDES="-I.." \
+ 		AR=ar ARFLAGS=cq RANLIB=ranlib \
+ 		LIBEXEC=${DESTDIR}/etc \
+ 		CC="${CC}" LCCFLAGS="-O"
+ 
+ # <<< chris.riney@tandy.com
+ 
  clean cleandir:
  	make -f Makefile.generic $@
*** ./include/socks.h.dist	Fri Dec 17 10:46:08 1993
--- ./include/socks.h	Mon Dec 20 11:42:44 1993
***************
*** 106,112 ****
  /* Current SOCKS protocol version */
  #define SOCKS_VERSION	4
  
! #define CSTC_RELEASE	"4.1"
  
  /*
  **  Response commands/codes
--- 106,112 ----
  /* Current SOCKS protocol version */
  #define SOCKS_VERSION	4
  
! #define CSTC_RELEASE	"4.1d"
  
  /*
  **  Response commands/codes
*** ./lib/Rconnect.c.dist	Thu Dec 16 17:00:49 1993
--- ./lib/Rconnect.c	Thu Dec 16 17:02:08 1993
***************
*** 19,25 ****
  #endif
  
  /* >>> K. Shackelford */
! #if defined(hpux) || defined(ultrix) || defined (__NetBSD__) || defined(AIX)
  extern int h_errno;
  #endif
  /* <<< K.Shackelford */
--- 19,25 ----
  #endif
  
  /* >>> K. Shackelford */
! #if defined(hpux) || defined(ultrix) || defined (__NetBSD__) || defined(AIX) || defined(__bsdi__) || defined (SCO)
  extern int h_errno;
  #endif
  /* <<< K.Shackelford */
*** ./libident/id_open.c.dist	Fri Dec 17 11:23:32 1993
--- ./libident/id_open.c	Fri Dec 17 11:24:00 1993
***************
*** 19,25 ****
  #include <arpa/inet.h>
  
  /* SOLARIS */
! #if defined(__svr4__) || defined (SOLARIS)
  #include <fcntl.h>
  #endif
  
--- 19,25 ----
  #include <arpa/inet.h>
  
  /* SOLARIS */
! #if defined(__svr4__) || defined (SOLARIS) || defined(SCO)
  #include <fcntl.h>
  #endif
  
*** ./rftp/ftp.c.dist	Fri Dec 17 11:27:10 1993
--- ./rftp/ftp.c	Fri Dec 17 11:33:37 1993
***************
*** 211,217 ****
  		perror("ftp: setsockopt TOS (ignored)");
  #endif
  	cin = fdopen(s, "r");
! #if defined(ISC) || defined(__alpha)
  	cout = fdopen(dup(s), "w");
  #else
  	cout = fdopen(s, "w");
--- 211,217 ----
  		perror("ftp: setsockopt TOS (ignored)");
  #endif
  	cin = fdopen(s, "r");
! #if defined(ISC) || defined(__alpha) || defined(SCO)
  	cout = fdopen(dup(s), "w");
  #else
  	cout = fdopen(s, "w");
***************
*** 939,945 ****
--- 939,949 ----
  	case TYPE_I:
  	case TYPE_L:
  		if (restart_point &&
+ #if defined (SCO)
+ 		    lseek(fileno(fout), (long) restart_point, SEEK_SET) < 0) {
+ #else
  		    lseek(fileno(fout), (long) restart_point, L_SET) < 0) {
+ #endif
  			fprintf(stderr, "local: %s: %s\n", local,
  				strerror(errno));
  			if (closefunc != NULL)
***************
*** 983,989 ****
--- 987,997 ----
  		if (restart_point) {
  			register int i, n, ch;
  
+ #if defined (SCO)
+ 			if (fseek(fout, 0L, SEEK_SET) < 0)
+ #else
  			if (fseek(fout, 0L, L_SET) < 0)
+ #endif
  				goto done;
  			n = restart_point;
  			for (i = 0; i++ < n;) {
***************
*** 992,1001 ****
  				if (ch == '\n')
  					i++;
  			}
! #ifndef SOLARIS
! 			if (fseek(fout, 0L, L_INCR) < 0) {
! #else
  			if (fseek(fout, 0L, SEEK_CUR) < 0) {
  #endif
  done:
  				fprintf(stderr, "local: %s: %s\n", local,
--- 1000,1009 ----
  				if (ch == '\n')
  					i++;
  			}
! #if defined( SOLARIS ) || defined (SCO)
  			if (fseek(fout, 0L, SEEK_CUR) < 0) {
+ #else
+ 			if (fseek(fout, 0L, L_INCR) < 0) {
  #endif
  done:
  				fprintf(stderr, "local: %s: %s\n", local,
*** ./rftp/ftp_var.h.dist	Fri Dec 17 11:34:30 1993
--- ./rftp/ftp_var.h	Mon Dec 20 12:30:49 1993
***************
*** 65,70 ****
--- 65,73 ----
  char	ntin[17];		/* input translation table */
  char	ntout[17];		/* output translation table */
  #include <sys/param.h>
+ #ifdef SCO
+ #include <arpa/ftp.h> /* Must be a #*%$ SCO system */
+ #endif
  char	mapin[MAXPATHLEN];	/* input map template */
  char	mapout[MAXPATHLEN];	/* output map template */
  char	typename[32];		/* name of file transfer type */
***************
*** 136,142 ****
  extern	char *strcat();
  extern	char *strcpy();
  
! #if defined (COMPAT) || defined (ultrix)
  typedef void	(*sig_t)();
  
  static char *strerror(errnum) {
--- 139,145 ----
  extern	char *strcat();
  extern	char *strcpy();
  
! #if defined (COMPAT) || defined (ultrix) || defined (SCO)
  typedef void	(*sig_t)();
  
  static char *strerror(errnum) {
*** ./rftp/cmds.c.dist	Fri Dec 17 12:43:26 1993
--- ./rftp/cmds.c	Fri Dec 17 12:43:30 1993
***************
*** 46,52 ****
  #include <arpa/ftp.h>
  
  /* >>> Anthony Shipman, als@cpsg.com.au */
! #if defined(hpux) || defined(SOLARIS)
  #  include <unistd.h>
  #  define GETCWD
  #else
--- 46,52 ----
  #include <arpa/ftp.h>
  
  /* >>> Anthony Shipman, als@cpsg.com.au */
! #if defined(hpux) || defined(SOLARIS) || defined(SCO)
  #  include <unistd.h>
  #  define GETCWD
  #else
***************
*** 1256,1262 ****
  	int pid;
  	sig_t old1, old2;
  	char shellnam[40], *shell, *namep; 
! #if defined(SOLARIS) || defined(__alpha)
          int     status;
  #else
          union wait status;
--- 1256,1262 ----
  	int pid;
  	sig_t old1, old2;
  	char shellnam[40], *shell, *namep; 
! #if defined(SOLARIS) || defined(__alpha) || defined(SCO)
          int     status;
  #else
          union wait status;
*** ./rftp/domacro.c.dist	Fri Dec 17 12:45:29 1993
--- ./rftp/domacro.c	Fri Dec 17 12:47:02 1993
***************
*** 44,50 ****
  #ifdef LINUX
  #include <bsd/sys/ttychars.h>
  #else
! #include <sys/ttychars.h>
  #endif
  
  domacro(argc, argv)
--- 44,52 ----
  #ifdef LINUX
  #include <bsd/sys/ttychars.h>
  #else
! # ifndef SCO
! #  include <sys/ttychars.h>
! # endif
  #endif
  
  domacro(argc, argv)
*** ./rftp/glob.c.dist	Fri Dec 17 12:47:11 1993
--- ./rftp/glob.c	Fri Dec 17 12:48:33 1993
***************
*** 38,44 ****
  /*
   * C-shell glob for random programs.
   */
! #if defined(hpux) || defined(SOLARIS)
  #undef COMPAT
  #endif
  
--- 38,44 ----
  /*
   * C-shell glob for random programs.
   */
! #if defined(hpux) || defined(SOLARIS) ||defined(SCO)
  #undef COMPAT
  #endif
  
*** ./rftp/main.c.dist	Fri Dec 17 12:48:40 1993
--- ./rftp/main.c	Fri Dec 17 13:26:44 1993
***************
*** 45,53 ****
   * FTP User Program -- Command Interface.
   */
  #include "ftp_var.h"
  #include <sys/socket.h>
  #include <sys/ioctl.h>
- #include <sys/types.h>
  
  #include <arpa/ftp.h>
  
--- 45,54 ----
   * FTP User Program -- Command Interface.
   */
  #include "ftp_var.h"
+ #include <sys/types.h>		/* socket.h and/or ioctl.h require this */
+ 				/* FIRST, on some systems.  */
  #include <sys/socket.h>
  #include <sys/ioctl.h>
  
  #include <arpa/ftp.h>
  
*** ./Makefile.dist	Thu Dec 16 16:44:29 1993
--- ./Makefile	Mon Dec 20 11:50:38 1993
***************
*** 5,34 ****
  # It should be this current directory.
  
  # If your system has getcwd() but no getwd(), uncomment the next line:
! #GETCWD=-DGETCWD
  
  # Define FASCIST if you want ftp (rftp) to log names of all files transferred
! #FASCIST=-DFASCIST
  
  # Directory into which to install the man pages
  MAN_DEST_DIR = /usr/local/man
  
  # Directory into which the SOCKS server should be installed
! SERVER_BIN_DIR = /usr/etc
  
  # Directory into the client programs should be installed
  CLIENTS_BIN_DIR = /usr/local/bin
  
  # SunOS 4.1.x should use
! CC=cc
! OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT
! RANLIB=ranlib
! OS=sun4.1
! INSTALL=install
! GETPASS=getpass.o
  #RESOLV_LIB=-lresolv
  # ... or 
! RESOLV_LIB=
  
  # IRIX should use
  #CC=cc
--- 5,34 ----
  # It should be this current directory.
  
  # If your system has getcwd() but no getwd(), uncomment the next line:
! GETCWD=-DGETCWD
  
  # Define FASCIST if you want ftp (rftp) to log names of all files transferred
! FASCIST=-DFASCIST
  
  # Directory into which to install the man pages
  MAN_DEST_DIR = /usr/local/man
  
  # Directory into which the SOCKS server should be installed
! SERVER_BIN_DIR = /usr/local/etc
  
  # Directory into the client programs should be installed
  CLIENTS_BIN_DIR = /usr/local/bin
  
  # SunOS 4.1.x should use
! #CC=cc
! #OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT
! #RANLIB=ranlib
! #OS=sun4.1
! #INSTALL=install
! #GETPASS=getpass.o
  #RESOLV_LIB=-lresolv
  # ... or 
! #RESOLV_LIB=
  
  # IRIX should use
  #CC=cc
***************
*** 119,124 ****
--- 119,141 ----
  #INSTALL=install
  #GETPASS=
  
+ # SCO UNIX/ODT should use:
+ #CC=cc
+ #OS=sco
+ #RESOLV_LIB=-lsocket
+ #OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DSCO -DSVR3 -Dindex=strchr -Drindex=strrchr -DUSE_DIRENT
+ #RANLIB=/bin/true
+ #GETPASS=
+ #PWD=/test/chris/socks.cstc.4.1
+ 
+ # BSD/386 should use:
+ CC=cc
+ OS=bsdi
+ RESOLV_LIB=
+ OTHER_CFLAGS= $(GETCWD) $(FASCIST)
+ RANLIB=ranlib
+ GETPASS=
+ 
  # >>>---------------- Others:
  
  # Define RESOLV_LIB if your system doesn't search resolver
***************
*** 160,165 ****
--- 177,183 ----
  
  SOCKS_LIB=$(PWD)/lib/libsocks.a
  IDENT_LIB=$(PWD)/libident/libident.a
+ #IDENT_LIB=
  
  #==============================================================================
  

