--- socks4-server-4.3.beta2.orig/Makefile +++ socks4-server-4.3.beta2/Makefile @@ -23,6 +23,8 @@ # If your system doesn't have PWD defined, define it here: #PWD=/disk2/socks.4.3 +pwd := $(shell pwd) +PWD=${pwd} # It should be this current directory. # If your system has getcwd() but no getwd(), uncomment the next line: @@ -64,16 +66,16 @@ #BIND_RESOLVER=-DBIND_RESOLVER # Directory into which to install the man pages -MAN_DEST_DIR = /usr/local/man +MAN_DEST_DIR = $(DESTDIR)/usr/share/man # Directory into which the SOCKS server should be installed -SERVER_BIN_DIR = /usr/etc +SERVER_BIN_DIR = $(DESTDIR)/usr/sbin # Directory into the client programs should be installed -CLIENTS_BIN_DIR = /usr/local/bin +CLIENTS_BIN_DIR = $(DESTDIR)/usr/bin # Directory into which the socks library (libsocks.a) should be installed -LIB_DEST_DIR = /usr/local/lib +LIB_DEST_DIR = $(DESTDIR)/usr/lib # SunOS 4.1.x should use #CC=cc @@ -97,13 +99,13 @@ #GETPASS=getpass.o # IRIX 5 should use -CC=cc -RESOLV_LIB= -OTHER_CFLAGS=-cckr $(GETCWD) $(FASCIST) -DCOMPAT -DSVR3 -DNCARGS=`sysconf ARG_MAX` -D_BSD_SIGNALS $(NO_RBIND) -RANLIB=/bin/true -OS=irix5 -INSTALL=$(PWD)/bsdinstall -GETPASS=getpass.o +#CC=cc +#RESOLV_LIB= +#OTHER_CFLAGS=-cckr $(GETCWD) $(FASCIST) -DCOMPAT -DSVR3 -DNCARGS=`sysconf ARG_MAX` -D_BSD_SIGNALS $(NO_RBIND) +#RANLIB=/bin/true +#OS=irix5 +#INSTALL=$(PWD)/bsdinstall +#GETPASS=getpass.o # Ultrix 4.0 should use #CC=cc @@ -186,16 +188,16 @@ #INSTALL=install # LINUX should use -#CC=gcc -#RANLIB=ranlib -#RESOLV_LIB= +CC=gcc +RANLIB=ranlib +RESOLV_LIB= # NOTE: Older versions of Linux may need to define the following variable, # as their files do not define "struct linger". #NEED_STRUCT_LINGER = -DNEED_STRUCT_LINGER -#OTHER_CFLAGS=-traditional -DLINUX $(GETCWD) $(FASCIST) -DCOMPAT $(NEED_STRUCT_LINGER) -DCONST="" $(NO_RBIND) -DDIRENT_ILLEGAL_ACCESS -#OS=linux -#INSTALL=install -#GETPASS=getpass.o +OTHER_CFLAGS= -DLINUX $(GETCWD) $(FASCIST) $(NEED_STRUCT_LINGER) $(NO_RBIND) +OS=linux +INSTALL=install +GETPASS=getpass.o # Additional notes for Linux: # 1) There is a bug in getsockname() which returns address 127.0.0.1 when # the result should be 0.0.0.0. Because of this, the non multi-homed @@ -331,21 +333,23 @@ # The Internet Whois server; used to be nic.ddn.mil. WHOIS_SERVER= WHOIS_SERVER=-DWHOIS_SERVER\'=\"rs.internic.net\"\' -SOCKS_LIB=$(PWD)/lib/libsocks.a -IDENT_LIB=$(PWD)/libident/libident.a +SOCKS_LIB_DEP=$(PWD)/lib/libsocks.a +SOCKS_LIB=-L$(PWD)/lib/ -lsocks +IDENT_LIB=-lident #============================================================================== -all: LIB LIBIDENT MKFC server clients +all: LIB MKFC server clients -server: LIB LIBIDENT +server: LIB (cd sockd; $(MAKE) CC="$(CC)" RESOLV_LIB="$(RESOLV_LIB)" \ OPTIMIZE="$(OPTIMIZE)" RANLIB="$(RANLIB)" \ SOCKS_LIB="$(SOCKS_LIB)" \ + SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \ IDENT_LIB="$(IDENT_LIB)" \ OTHER_CFLAGS="$(OTHER_CFLAGS) $(FOR_PS) $(NO_WAITPID) $(NO_RBIND)") -clients: RFINGER RFTP RTELNET +clients: RFINGER RFTP RTELNET RUNSOCKS LIB: (cd lib; $(MAKE) CC="$(CC)" GETPASS="$(GETPASS)" \ @@ -362,22 +366,33 @@ (cd rfinger; $(MAKE) CC="$(CC)" $(WHOIS_SERVER) \ OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \ RESOLV_LIB="$(RESOLV_LIB)" SOCKS_LIB="$(SOCKS_LIB)" \ + SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \ OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(NO_WAITPID) $(NO_RBIND)") RTELNET: LIB (cd rtelnet; $(MAKE) CC="$(CC)" OS="$(OS)" SOCKS_LIB="$(SOCKS_LIB)" \ + SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \ OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \ RESOLV_LIB="$(RESOLV_LIB)" \ OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(NO_WAITPID) $(NO_RBIND)") RFTP: LIB (cd rftp; $(MAKE) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" \ + SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \ + OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \ + RESOLV_LIB="$(RESOLV_LIB)" \ + OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(BIND_RESOLVER) $(NO_WAITPID) $(NO_RBIND)") + +RUNSOCKS: LIB + (cd runsocks; $(MAKE) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" \ + SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \ OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \ RESOLV_LIB="$(RESOLV_LIB)" \ OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(BIND_RESOLVER) $(NO_WAITPID) $(NO_RBIND)") MKFC: LIB (cd mkfc; $(MAKE) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" \ + SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \ RESOLV_LIB="$(RESOLV_LIB)" \ OPTIMIZE="$(OPTIMIZE)" OTHER_CFLAGS="$(OTHER_CFLAGS)" ) @@ -385,11 +400,12 @@ (cd sockd; $(MAKE) INSTALL="$(INSTALL)" MAN_DEST_DIR="$(MAN_DEST_DIR)" \ SERVER_BIN_DIR="$(SERVER_BIN_DIR)" install install.man) -install.clients: RFINGER RFTP RTELNET install.man - for i in rfinger rftp rtelnet; do \ +install.clients: RFINGER RFTP RTELNET RUNSOCKS install.man + for i in rfinger rftp rtelnet runsocks; do \ (cd $$i ; $(MAKE) INSTALL="$(INSTALL)" \ CLIENTS_BIN_DIR="$(CLIENTS_BIN_DIR)" \ - install) done + LIB_DEST_DIR="$(LIB_DEST_DIR)" \ + install); done install.mkfc: MKFC (cd mkfc; $(MAKE) INSTALL="$(INSTALL)" \ MKFC_DIR="$(SERVER_BIN_DIR)" install) @@ -402,7 +418,7 @@ install) clean: - for i in lib libident sockd rfinger rftp rtelnet mkfc; do \ - ( cd $$i ; $(MAKE) clean) done + for i in lib libident sockd rfinger rftp rtelnet runsocks mkfc; do \ + ( cd $$i ; $(MAKE) clean); done --- socks4-server-4.3.beta2.orig/mkfc/Makefile +++ socks4-server-4.3.beta2/mkfc/Makefile @@ -8,22 +8,22 @@ all: echocwd $(PROGS) -make_socksfc: make_socksfc.o $(SOCKS_LIB) +make_socksfc: make_socksfc.o $(SOCKS_LIB_DEP) $(CC) $(CFLAGS) -o $@ make_socksfc.o $(SOCKS_LIB) $(RESOLV_LIB) -make_sockdfc: make_sockdfc.o $(SOCKS_LIB) +make_sockdfc: make_sockdfc.o $(SOCKS_LIB_DEP) $(CC) $(CFLAGS) -o $@ make_sockdfc.o $(SOCKS_LIB) $(RESOLV_LIB) -make_sockdfr: make_sockdfr.o $(SOCKS_LIB) +make_sockdfr: make_sockdfr.o $(SOCKS_LIB_DEP) $(CC) $(CFLAGS) -o $@ make_sockdfr.o $(SOCKS_LIB) $(RESOLV_LIB) -dump_socksfc: dump_socksfc.o $(SOCKS_LIB) +dump_socksfc: dump_socksfc.o $(SOCKS_LIB_DEP) $(CC) $(CFLAGS) -o $@ dump_socksfc.o $(SOCKS_LIB) $(RESOLV_LIB) -dump_sockdfc: dump_sockdfc.o $(SOCKS_LIB) +dump_sockdfc: dump_sockdfc.o $(SOCKS_LIB_DEP) $(CC) $(CFLAGS) -o $@ dump_sockdfc.o $(SOCKS_LIB) $(RESOLV_LIB) -dump_sockdfr: dump_sockdfr.o $(SOCKS_LIB) +dump_sockdfr: dump_sockdfr.o $(SOCKS_LIB_DEP) $(CC) $(CFLAGS) -o $@ dump_sockdfr.o $(SOCKS_LIB) $(RESOLV_LIB) install: echocwd $(PROGS) --- socks4-server-4.3.beta2.orig/rtelnet/Makefile +++ socks4-server-4.3.beta2/rtelnet/Makefile @@ -3,8 +3,8 @@ #======================================================= all: echocwd - cd libtelnet; $(MAKE) $(OS) CC="$(CC)" OTHER_CFLAGS="$(OTHER_CFLAGS)" SOCKS="$(SOCKS)" SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB="$(RESOLV_LIB)" OPTIMIZE="$(OPTIMIZE)" - cd telnet; $(MAKE) $(OS) CC="$(CC)" OTHER_CFLAGS="$(OTHER_CFLAGS)" SOCKS="$(SOCKS)" SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB="$(RESOLV_LIB)" OPTIMIZE="$(OPTIMIZE)" + cd libtelnet; $(MAKE) $(OS) CC="$(CC)" OTHER_CFLAGS="$(OTHER_CFLAGS)" SOCKS="$(SOCKS)" SOCKS_LIB="$(SOCKS_LIB)" SOCKS_LIB_DEP=$(SOCKS_LIB_DEP) RESOLV_LIB="$(RESOLV_LIB)" OPTIMIZE="$(OPTIMIZE)" + cd telnet; $(MAKE) $(OS) CC="$(CC)" OTHER_CFLAGS="$(OTHER_CFLAGS)" SOCKS="$(SOCKS)" SOCKS_LIB="$(SOCKS_LIB)" SOCKS_LIB_DEP=$(SOCKS_LIB_DEP) RESOLV_LIB="$(RESOLV_LIB)" OPTIMIZE="$(OPTIMIZE)" install: echocwd rtelnet $(INSTALL) -s -o bin -g bin -m 111 rtelnet $(CLIENTS_BIN_DIR) @@ -24,5 +24,5 @@ @pwd .DEFAULT: - cd libtelnet; $(MAKE) $(OS) WHAT=$(WHAT) CC="$(CC)" SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB="$(RESOLV_LIB)" - cd telnet; $(MAKE) $(OS) WHAT=$(WHAT) CC="$(CC)" SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB="$(RESOLV_LIB)" + cd libtelnet; $(MAKE) $(OS) WHAT=$(WHAT) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" SOCKS_LIB_DEP=$(SOCKS_LIB_DEP) RESOLV_LIB="$(RESOLV_LIB)" + cd telnet; $(MAKE) $(OS) WHAT=$(WHAT) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" SOCKS_LIB_DEP=$(SOCKS_LIB_DEP) RESOLV_LIB="$(RESOLV_LIB)" --- socks4-server-4.3.beta2.orig/rtelnet/Config.local +++ socks4-server-4.3.beta2/rtelnet/Config.local @@ -728,14 +728,12 @@ linux: ${MAKE} -f Makefile.generic ${WHAT} \ LIBS="${SOCKS_LIB} ../libtelnet/libtelnet.a ${RESOLV_LIB} \ - -ltermcap -lbsd" \ - LIBPATH="/usr/lib/libc.a /usr/lib/libtermcap.a \ - ../libtelnet/libtelnet.a /usr/lib/libbsd.a" \ + -lncurses" \ DEST=${DESTDIR}/usr/ucb \ DEFINES="-DLINUX \ - -DTERMCAP -DUSE_TERMIO $(SOCKS) \ + -DUSE_TERMIO $(SOCKS) \ -DDIAGNOSTICS -DKLUDGELINEMODE" \ - INCLUDES="-include /usr/include/bsd/bsd.h -I.. -I../../include -I/usr/include/bsd" \ + INCLUDES="-I.. -I../../include" \ LIB_OBJ="getent.o" \ LIB_SRC="getent.c" \ AR=ar ARFLAGS=rc RANLIB=ranlib \ --- socks4-server-4.3.beta2.orig/rtelnet/telnet/externs.h +++ socks4-server-4.3.beta2/rtelnet/telnet/externs.h @@ -29,6 +29,7 @@ #include #include +#include #ifndef FILIO_H #include #else @@ -73,8 +74,6 @@ #define SUBBUFSIZE 256 -extern int errno; /* outside this world */ - #if !defined(P) # ifdef __STDC__ # define P(x) x @@ -228,7 +227,13 @@ tninit P((void)), upcase P((char *)), willoption P((int)), - wontoption P((int)); + wontoption P((int)), + send_will P((int, int)), + send_wont P((int, int)), + send_do P((int, int)), + send_dont P((int, int)), + intp P((void)), + sendbrk P((void)); extern void lm_will P((unsigned char *, int)), --- socks4-server-4.3.beta2.orig/rtelnet/telnet/Makefile +++ socks4-server-4.3.beta2/rtelnet/telnet/Makefile @@ -34,17 +34,21 @@ then \ echo ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ else \ echo ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ fi .DEFAULT: @@ -52,15 +56,19 @@ then \ echo ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ else \ echo ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ fi --- socks4-server-4.3.beta2.orig/rtelnet/telnet/commands.c +++ socks4-server-4.3.beta2/rtelnet/telnet/commands.c @@ -51,6 +51,8 @@ #endif /* #if defined(ISC) */ #include +#include +#include #include "general.h" @@ -69,6 +71,7 @@ #endif /* CRAY */ #include #endif /* LINUX */ +#include #if defined(SOLARIS) || defined(_SEQUENT_) #include "bstring.h" @@ -302,7 +305,7 @@ }; -extern int +static int send_esc P((void)), send_help P((void)), send_docmd P((char *)), @@ -672,7 +675,7 @@ } -extern int togglehelp P((void)); +static int togglehelp P((void)); #if defined(AUTHENTICATE) extern int auth_togdebug P((int)); #endif @@ -1514,7 +1517,7 @@ int arg; }; -extern void slc_help(); +static void slc_help(); struct slclist SlcList[] = { { "export", "Use local special character definitions", @@ -1597,7 +1600,8 @@ env_export P((unsigned char *)), env_unexport P((unsigned char *)), env_send P((unsigned char *)), - env_list P((void)), + env_list P((void)); +static void env_help P((void)); struct envlist EnvList[] = { @@ -2203,7 +2207,7 @@ } } else { #if !defined(htons) - u_short htons(); + /* u_short htons();*/ #endif /* !defined(htons) */ sin.sin_port = htons(sin.sin_port); } @@ -2328,7 +2332,7 @@ envhelp[] = "change environment variables ('environ ?' for more)", modestring[] = "try to enter line or character mode ('mode ?' for more)"; -extern int help(); +static int help(); static Command cmdtab[] = { { "close", closehelp, bye, 1 }, --- socks4-server-4.3.beta2.orig/rtelnet/telnet/sys_bsd.c +++ socks4-server-4.3.beta2/rtelnet/telnet/sys_bsd.c @@ -369,6 +369,13 @@ } #endif +#ifdef SIGTSTP +static SIG_FUNC_RET susp(); +#endif /* SIGTSTP */ +#ifdef SIGINFO +static SIG_FUNC_RET ayt(); +#endif /* SIGINFO */ + /* * TerminalNewMode - set up terminal to a specific mode. * MODE_ECHO: do local terminal echo @@ -617,13 +624,6 @@ if (f != -1) { #ifdef SIGTSTP - static SIG_FUNC_RET susp(); -#endif /* SIGTSTP */ -#ifdef SIGINFO - static SIG_FUNC_RET ayt(); -#endif /* SIGINFO */ - -#ifdef SIGTSTP (void) signal(SIGTSTP, susp); #endif /* SIGTSTP */ #ifdef SIGINFO --- socks4-server-4.3.beta2.orig/rtelnet/libtelnet/Makefile +++ socks4-server-4.3.beta2/rtelnet/libtelnet/Makefile @@ -34,17 +34,21 @@ then \ echo ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ else \ echo ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" ;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" ;\ fi .DEFAULT: @@ -52,15 +56,19 @@ then \ echo ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ ${MAKE} -f ../Config.local WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ else \ echo ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ ${MAKE} -f ../Config.generic WHAT=${WHAT} CC="${CC}" \ OPTIMIZE="${OPTIMIZE}" SOCKS="${SOCKS}" \ - SOCKS_LIB=${SOCKS_LIB} RESOLV_LIB="${RESOLV_LIB}" $@;\ + SOCKS_LIB_DEP=${SOCKS_LIB_DEP} \ + SOCKS_LIB="${SOCKS_LIB}" RESOLV_LIB="${RESOLV_LIB}" $@;\ fi --- socks4-server-4.3.beta2.orig/sockd/Makefile +++ socks4-server-4.3.beta2/sockd/Makefile @@ -12,14 +12,14 @@ LIB=libsockd.a -CFLAGS = -I../include -I../libident $(OPTIMIZE) $(OTHER_CFLAGS) +CFLAGS = -I../include $(OPTIMIZE) $(OTHER_CFLAGS) all: echocwd $(LIB) $(PROG) -sockd: sockd.o ../include/socks.h ../Makefile $(LIB) $(SOCKS_LIB) $(IDENT_LIB) +sockd: sockd.o ../include/socks.h ../Makefile $(LIB) $(SOCKS_LIB_DEP) $(IDENT_LIB) $(CC) $(CFLAGS) -o $@ sockd.o $(LIB) $(SOCKS_LIB) $(IDENT_LIB) $(RESOLV_LIB) -rsockd: rsockd.o ../include/socks.h ../Makefile $(LIB) $(SOCKS_LIB) $(IDENT_LIB) +rsockd: rsockd.o ../include/socks.h ../Makefile $(LIB) $(SOCKS_LIB_DEP) $(IDENT_LIB) $(CC) $(CFLAGS) -o $@ rsockd.o $(LIB) $(SOCKS_LIB) $(IDENT_LIB) $(RESOLV_LIB) libsockd.a: $(LIBOBJS) ../include/socks.h ../Makefile @@ -59,7 +59,7 @@ $(INSTALL) -m 444 ../doc/sockd.8 $(MAN_DEST_DIR)/man8 $(INSTALL) -m 444 ../doc/sockd.conf.5 $(MAN_DEST_DIR)/man5 $(INSTALL) -m 444 ../doc/sockd.route.5 $(MAN_DEST_DIR)/man5 - + clean: echocwd rm -f *.o $(LIB) $(PROG) core --- socks4-server-4.3.beta2.orig/rftp/domacro.c +++ socks4-server-4.3.beta2/rftp/domacro.c @@ -42,7 +42,7 @@ #include #include #ifdef LINUX -#include +/*#include */ #else # if !defined(SCO) && !defined(_SEQUENT_) && !defined(ISC) #include --- socks4-server-4.3.beta2.orig/rftp/ruserpass.c +++ socks4-server-4.3.beta2/rftp/ruserpass.c @@ -80,6 +80,8 @@ 0, 0 }; +static int token(); + ruserpass(host, aname, apass, aacct) char *host, **aname, **apass, **aacct; { @@ -87,7 +89,6 @@ char myname[MAXHOSTNAMELEN], *mydomain; int t, i, c, usedefault = 0; struct stat stb; - static int token(); hdir = getenv("HOME"); if (hdir == NULL) --- socks4-server-4.3.beta2.orig/rftp/cmds.c +++ socks4-server-4.3.beta2/rftp/cmds.c @@ -80,7 +80,6 @@ extern char *index(); extern char *rindex(); extern char *strerror(); -extern int errno; extern off_t restart_point; extern char reply_string[]; --- socks4-server-4.3.beta2.orig/rftp/ftp_var.h +++ socks4-server-4.3.beta2/rftp/ftp_var.h @@ -33,6 +33,8 @@ * @(#)ftp_var.h 5.9 (Berkeley) 6/1/90 */ +#include + /* * FTP global variables. */ @@ -136,19 +138,13 @@ extern char *index(); extern char *rindex(); extern char *remglob(); -extern int errno; -extern char *mktemp(); -extern char *strncpy(); -extern char *strncat(); -extern char *strcat(); -extern char *strcpy(); #if defined (COMPAT) || defined (ultrix) || defined(SCO) typedef void (*sig_t)(); static char *strerror(errnum) { extern int sys_nerr; - extern char *sys_errlist[]; + extern const char *const sys_errlist[]; return (errnum < sys_nerr && errnum >= 0 ? sys_errlist[errno] : "UNDEFINED"); --- socks4-server-4.3.beta2.orig/rftp/glob.c +++ socks4-server-4.3.beta2/rftp/glob.c @@ -54,7 +54,7 @@ #include #endif #ifdef LINUX -#include +/*#include */ #endif #include @@ -82,7 +82,6 @@ char **ftpglob(); char *globerr; char *home; -extern int errno; static char *strspl(), *strend(); char **copyblk(); @@ -242,7 +241,7 @@ return; goto patherr2; } - if (fstat(dirp->dd_fd, &stb) < 0) + if (fstat(dirfd(dirp), &stb) < 0) goto patherr1; if (!isdir(stb)) { errno = ENOTDIR; --- socks4-server-4.3.beta2.orig/rftp/Makefile +++ socks4-server-4.3.beta2/rftp/Makefile @@ -10,7 +10,7 @@ all: echocwd rftp -rftp: $(OBJS) $(SOCKS_LIB) ../include/socks.h ../Makefile +rftp: $(OBJS) $(SOCKS_LIB_DEP) ../include/socks.h ../Makefile $(CC) $(CFLAGS) -o $@ $(OBJS) $(SOCKS_LIB) $(RESOLV_LIB) install: echocwd rftp --- socks4-server-4.3.beta2.orig/rftp/ftp.c +++ socks4-server-4.3.beta2/rftp/ftp.c @@ -95,7 +95,7 @@ int pasvmode = 0; extern char *strerror(); -extern int connected, errno; +extern int connected; FILE *cin, *cout; FILE *dataconn(); @@ -261,6 +261,13 @@ return ((char *)0); } +#ifdef USE_VARARGS +int command(va_alist); +va_dcl +#else +int command(char *fmt, ...); +#endif + login(host) char *host; { @@ -1435,7 +1442,7 @@ int secndflag = 0, prox_type, nfnd; extern jmp_buf ptabort; char *cmd2; - struct fd_set mask; + fd_set mask; void abortpt(); if (strcmp(cmd, "RETR")) @@ -1550,7 +1557,7 @@ reset() { - struct fd_set mask; + fd_set mask; int nfnd = 1; FD_ZERO(&mask); @@ -1618,7 +1625,7 @@ { char buf[BUFSIZ]; int nfnd; - struct fd_set mask; + fd_set mask; /* * send IAC in urgent mode instead of DM because 4.3BSD places oob mark --- socks4-server-4.3.beta2.orig/include/socks.h +++ socks4-server-4.3.beta2/include/socks.h @@ -43,7 +43,7 @@ * to /usr/ucb/finger.orig and the pathname you should use here is the * new (altered) pathname, i.e., /usr/ucb/finger.orig. */ -#define ORIG_FINGER "/usr/ucb/finger.orig" +#define ORIG_FINGER "/usr/bin/finger" /* Overridden at runtime by environment variable ORIG_FINGER if it exists. */ /* Control file for clients */ @@ -142,7 +142,7 @@ /* Location of the pid file of the running sockd. Meaningful only * when STAND_ALONE_SERVER is defined. */ -#define PID_FILE "/etc/sockd.pid" +#define PID_FILE "/var/run/sockd.pid" #define BAD_ID_STR "#BAD_ID:" #define NO_IDENTD_STR "#NO_IDENTD:" --- socks4-server-4.3.beta2.orig/libident/id_open.c,v +++ socks4-server-4.3.beta2/libident/id_open.c,v @@ -0,0 +1,201 @@ +head 1.1; +access; +symbols; +locks + martin:1.1; strict; +comment @ * @; + + +1.1 +date 97.10.09.10.53.40; author martin; state Exp; +branches; +next ; + + +desc +@@ + + +1.1 +log +@Initial revision +@ +text +@/* +** id_open.c Establish/initiate a connection to an IDENT server +** +** Author: Peter Eriksson +** Fixes: Pdr Emanuelsson +*/ + + +#include +#include +#if defined(ISC) +#include +#endif /* #if defined(ISC) */ +#include + +#include +#include +#include +#include +#include +#if defined(ISC) +#include +#endif /* #if defined(ISC) */ +#include +#include + +/* SOLARIS */ +#if defined(__svr4__) || defined (SOLARIS) || defined(SCO) +#include +#endif + +/* LINUX */ +#ifdef LINUX +#include +#include +#include +#ifdef FNDLEAY /*watch out for a ?typo? in fcntl.h !? */ +#define FNDELAY FNDLEAY +#endif +#endif /* LINUX */ + +/* The following struct linger declaration seemed to be + * missing from older versions of LINUX but is present in + * current. If you need it, you must uncomment NEED_STRUCT_LINGER + * in the top level Makefile. + */ + +#ifdef NEED_STRUCT_LINGER +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; +#endif /* #ifdef NEED_STRUCT_LINGER */ + +#include "ident.h" + +extern void *malloc __P((int size)); + + +ident_t *id_open +#ifdef __STDC__ + (struct in_addr *laddr, struct in_addr *faddr, struct timeval *timeout) +#else + (laddr, faddr, timeout) +struct in_addr *laddr; +struct in_addr *faddr; +struct timeval *timeout; +#endif +{ + ident_t *id; + int res, tmperrno; + struct sockaddr_in sin_laddr, sin_faddr; + fd_set rs, ws, es; +#if !defined(SO_DONTLINGER) || defined(SOLARIS) + struct linger linger; +#endif + +#if defined(sgi) || defined (SOLARIS) || defined(__bsdi__) + int on = 1; +#endif + + if ((id = (ident_t *) malloc(sizeof(*id))) == 0) + return 0; + + if ((id->fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + { + free(id); + return 0; + } + + if (timeout) + { + if ((res = fcntl(id->fd, F_GETFL, 0)) < 0) + goto ERROR; + + if (fcntl(id->fd, F_SETFL, res | FNDELAY) < 0) + goto ERROR; + } + +#if defined(SO_DONTLINGER) && !defined(SOLARIS) + if (setsockopt(id->fd, SOL_SOCKET, SO_DONTLINGER, 0, 0) < 0) + goto ERROR; +#else + linger.l_onoff = 0; + linger.l_linger = 0; + + if (setsockopt(id->fd, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)) < 0) + goto ERROR; +#endif + +#if defined(sgi) || defined(SOLARIS) || defined(__bsdi__) + if (setsockopt(id->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, + sizeof(on)) < 0) +#else +# if !defined(LINUX) + if (setsockopt(id->fd, SOL_SOCKET, SO_REUSEADDR, 0, 0) < 0) +# endif +#endif + goto ERROR; + + id->buf[0] = '\0'; + + memset(&sin_laddr, 0, sizeof(sin_laddr)); + sin_laddr.sin_family = AF_INET; + sin_laddr.sin_addr = *laddr; + sin_laddr.sin_port = 0; + + if (bind(id->fd, (struct sockaddr *)&sin_laddr, sizeof(sin_laddr)) < 0) + goto ERROR; + + memset(&sin_faddr, 0, sizeof(sin_faddr)); + sin_faddr.sin_family = AF_INET; + sin_faddr.sin_addr = *faddr; + sin_faddr.sin_port = htons(IDPORT); + + res = connect(id->fd, (struct sockaddr *)&sin_faddr, sizeof(sin_faddr)); + if (res < 0 && errno != EINPROGRESS) + goto ERROR; + + if (timeout) + { + FD_ZERO(&rs); + FD_ZERO(&ws); + FD_ZERO(&es); + FD_SET(id->fd, &rs); + FD_SET(id->fd, &ws); + FD_SET(id->fd, &es); + + if ((res = select(FD_SETSIZE, &rs, &ws, &es, timeout)) < 0) + goto ERROR; + + if (res == 0) + { + errno = ETIMEDOUT; + goto ERROR; + } + + if (FD_ISSET(id->fd, &es)) + goto ERROR; + + if (!FD_ISSET(id->fd, &rs) && !FD_ISSET(id->fd, &ws)) + goto ERROR; + } + + return id; + +ERROR: + tmperrno = errno; /* Save, so close() won't erase it */ + close(id->fd); + free(id); + errno = tmperrno; + return 0; +} + +@ --- socks4-server-4.3.beta2.orig/libident/id_open.c +++ socks4-server-4.3.beta2/libident/id_open.c @@ -57,7 +57,7 @@ #include "ident.h" -extern void *malloc __P((int size)); +/*extern void *malloc __P((int size));*/ ident_t *id_open --- socks4-server-4.3.beta2.orig/doc/sockd.8 +++ socks4-server-4.3.beta2/doc/sockd.8 @@ -98,13 +98,13 @@ .SH OPTIONS The options are mutually exclusive and thus may only be used one at a time. .TP -.B\-ver +.B \-ver With this option, \fIsockd\fR prints its own version number, the version number of the SOCKS protocol, whether it is SOCKSified, whether it is a standalone daemon or must be run under inetd, whether it support RBIND, and whether a route file is required. .TP -.B\-I +.B \-I Use \fIidentd\fR (RFC 1413) to verify the requester's user-id. Deny access if connection to client's \fIidentd\fR fails or if the result does not match the user-id reported by the client program. Client hosts without a properly @@ -112,7 +112,7 @@ done before and in addition to the normal access control. This can be overridden in the sockd.conf file on a line by line basis. .TP -.B\-i +.B \-i Similar to \fB-I\fP but more lenient. Access is denied only if client's \fIidentd\fR reports a user-id that's different from what the client program claims. This can be overridden in the sockd.conf file on a line --- socks4-server-4.3.beta2.orig/lib/Makefile +++ socks4-server-4.3.beta2/lib/Makefile @@ -5,22 +5,39 @@ OBJS = Rconnect.o SendGetDst.o porttoserv.o utils.o \ Rbind.o Rgethostbyname.o Rselect.o \ - null_syslog.o porttoserv.o shell_cmd.o \ + null_syslog.o shell_cmd.o \ socks_ckcf.o socks_rdconf.o \ socks_rdfz.o socks_wrfz.o \ socks_dumpcf.o sockd_dumpcf.o sockd_dumprt.o \ sockd_rdconf.o sockd_rdroute.o \ $(GETPASS) $(STRDUP) +SOBJS = $(patsubst %.o,%.lo,$(OBJS)) + LIB = libsocks.a -CFLAGS = -I../include -I../libident $(OPTIMIZE) $(OTHER_CFLAGS) +SLIB = libsocks.so.4.3 +SLIBNAME = libsocks.so.4 +CFLAGS = -I../include $(OPTIMIZE) $(OTHER_CFLAGS) -all: echocwd $(LIB) +all: echocwd $(LIB) $(SLIB) $(LIB): $(OBJS) ../include/socks.h ../Makefile rm -f $(LIB) ar rc $(LIB) $(OBJS) $(RANLIB) $(LIB) +# ld -shared -o $(SLIB) -soname $(SLIBNAME) --whole-archive $(LIB) +# gcc -shared -o $(SLIB) -Wl,-soname,$(SLIBNAME) -Wl,--whole-archive $(LIB) -Wl,--no-whole-archive -lc +# ln -sf libsocks.so.4.3 libsocks.so.4 +# ln -sf libsocks.so.4.3 libsocks.so + +$(SLIB): $(SOBJS) ../include/socks.h ../Makefile + rm -f $(SLIB) + gcc -shared -o $(SLIB) -Wl,-soname,$(SLIBNAME) -Wl,--whole-archive $(SOBJS) -Wl,--no-whole-archive -lc + ln -sf libsocks.so.4.3 libsocks.so.4 + ln -sf libsocks.so.4.3 libsocks.so + +%.lo: %.c + $(CC) -fPIC $(CFLAGS) -c -o $@ $< $(OBJS):: ../include/socks.h ../Makefile @@ -34,7 +51,7 @@ $(INSTALL) -m 444 ../doc/socks.conf.5 $(MAN_DEST_DIR)/man5 clean: echocwd - rm -f *.o $(LIB) core + rm -f *.o *.lo $(LIB) libsocks.so* core echocwd: @pwd --- socks4-server-4.3.beta2.orig/lib/Rconnect.c +++ socks4-server-4.3.beta2/lib/Rconnect.c @@ -22,7 +22,7 @@ #include #endif #include "socks.h" -#ifdef LINUX +#ifdef LINUX_ #include #endif --- socks4-server-4.3.beta2.orig/lib/Rconnect.c,v +++ socks4-server-4.3.beta2/lib/Rconnect.c,v @@ -0,0 +1,624 @@ +head 1.1; +access; +symbols; +locks + martin:1.1; strict; +comment @ * @; + + +1.1 +date 97.10.09.10.48.55; author martin; state Exp; +branches; +next ; + + +desc +@@ + + +1.1 +log +@Initial revision +@ +text +@/* Rconnect */ + +#include +#include +#include +#include +#include +#include +#include +#if defined(ISC) +#include +#endif /* #if defined(ISC) */ +#include +#include +#include +#include +#include +#include +#if (defined(sun) && !defined(SOLARIS)) || defined(sgi) +#include +#else +#include +#endif +#include "socks.h" +#ifdef LINUX +#include +#endif + +/* >>> K. Shackelford */ +#if defined(hpux) || defined(ultrix) || defined (__NetBSD__) || defined(__FreeBSD__) || defined(AIX) || defined(__bsdi__) || defined(SCO) || defined(ISC) || defined(BIND_RESOLVER) +extern int h_errno; +#endif +/* <<< K.Shackelford */ + +#include +#include + +char *socks_def_server; +char *socks_server; +char *socks_serverlist; + +extern char *getenv(); +extern char *getlogin(); +struct sockaddr_in socks_cursin; +pid_t socks_conn_sock = 0; +pid_t socks_conn_init = 0; +unsigned short socks_conn_port = 0; +u_int32 socks_conn_host = 0; +int socks_conn_code = 0; +int socks_init_done = 0; +unsigned short socks_last_conn_port = 0; +u_int32 socks_last_conn_host = 0; + +struct sockaddr_in socks_nsin; +static struct sockaddr_in me; +static struct passwd *pw; +static int socks_direct = 0; +struct config *scfAddr = NULL; +int Nscf = 0; +int socks_no_conf = 0; +static char *cfStrings = NULL; + +int socks_useSyslog = 0; + +extern struct hostent socks_fakeIP[]; + +extern char *socks_porttoserv(); + +struct sockshost_s socks_srcsh, socks_dstsh; +#define dst_name socks_dstsh.dmname[0] +#define dst_serv socks_dstsh.portname +#define src_user socks_srcsh.user +#define real_user socks_srcsh.ruser +#define src_name socks_srcsh.dmname[0] +#define socks_cmd socks_dstsh.user + +struct in_addr socks_self; + +int socks_check_result(code) +char code; +{ + switch (code) { + case SOCKS_FAIL: + errno = ECONNREFUSED; + return -1; + case SOCKS_NO_IDENTD: + errno = ECONNREFUSED; + if (socks_useSyslog) + syslog(LOG_LOW, "Error: SOCKS server %s cannot connect to identd on this host.\n", socks_server); + else + fprintf(stderr, "Error: SOCKS server %s cannot connect to identd on this host.\n", socks_server); + return -1; + case SOCKS_BAD_ID: + errno = ECONNREFUSED; + if (socks_useSyslog) + syslog(LOG_LOW, "Error: user-id does not agree with the one reported by identd on this host.\n"); + else + fprintf(stderr, "Error: user-id does not agree with the one reported by identd on this host.\n"); + return -1; + default: + return 0; + } +} + + +int SOCKSinit(Progname) +char *Progname; /* name of the calling program, "rfinger", "rftp", etc. */ +{ + struct stat statfc, statcf; +#ifdef SOCKS_DEFAULT_NS + static char *defaultNS = SOCKS_DEFAULT_NS; +#endif +#ifdef SOCKS_DEFAULT_DNAME + static char *defaultDNAME = SOCKS_DEFAULT_DNAME; +#endif + static char *defaultSERVER = SOCKS_DEFAULT_SERVER; + char socks_src_name[NAMELEN]; + char *cp, *ns, *dp; + struct hostent *hp; + struct servent *sp; + int v,uid; + + if (socks_init_done) + return; + socks_init_done = 1; + + bzero((char *)&socks_cursin, sizeof(socks_cursin)); + bzero((char *)&socks_nsin, sizeof(socks_nsin)); + bzero((char *)&me, sizeof(me)); + + /* skip the path if included in Progname */ + if( (cp = rindex(Progname, '/')) == NULL) + cp = Progname; + else + cp++; + +#ifndef LOG_DAEMON + (void) openlog(cp, LOG_PID); +#else + (void) openlog(cp, LOG_PID, SYSLOG_FAC); +#endif + + socks_self.s_addr = inet_addr("127.0.0.1"); + gethostname(socks_src_name, sizeof(socks_src_name)); + if (socks_host(socks_src_name, &socks_srcsh) < 0) { + if (socks_useSyslog) + syslog(LOG_LOW, "Out of Memory\n"); + else + fprintf(stderr, "Out of Memory\n"); + exit(1); + } + if (socks_srcsh.shipaddr[0].s_addr = 0) { + if (socks_useSyslog) + syslog(LOG_LOW, "Cannot resolve the host's own name: %s\n", socks_src_name); + else + fprintf(stderr, "Cannot resolve the host's own name: %s\n", socks_src_name); + exit(1); + } + + if ((cp = getlogin()) == NULL) { + /* some systems returns NULL if process is not attached to a terminal */ + strcpy(real_user, "unknown"); + } else + strncpy(real_user, cp, sizeof(real_user)); + if ((pw = getpwuid(uid=geteuid())) == NULL) { + if (socks_useSyslog) + syslog(LOG_LOW, "Unknown user-id %d\n",uid); + else + fprintf(stderr, "Unknown user-id %d\n",uid); + exit(1); + } + strncpy(src_user, pw->pw_name, sizeof(src_user)); + +#if !defined(DNS_THROUGH_NIS) + + if ((ns = getenv("SOCKS_NS")) == NULL) { +#ifdef SOCKS_DEFAULT_NS + ns = defaultNS; +#else + ; +#endif + } + if ((dp = getenv("SOCKS_DNAME")) == NULL) { +#ifdef SOCKS_DEFAULT_DNAME + dp = defaultDNAME; +#else + ; +#endif + } + + if ((ns != NULL) || (dp != NULL)) { + res_init(); +#ifdef sgi + sethostresorder("local:nis:bind"); +#endif + } +#if defined(SOLARIS) + (void)gethostbyname("dont.care"); + /* without this, the first call to gethostbyname() will + * wipe out what we put into the _res structure! */ +#endif /* #if defined(SOLARIS) */ + + if (ns != NULL) { +#ifdef ultrix + _res.ns_list[0].addr.sin_addr.s_addr = inet_addr(ns); +#else + _res.nsaddr_list[0].sin_addr.s_addr = inet_addr(ns); +#endif + _res.nscount = 1; + } + if (dp != NULL) { + strncpy(_res.defdname, dp, sizeof(_res.defdname)-1); + } + +/* >>> jon r. luini */ +/* +#ifdef SOCKS_DEFAULT_DNAME + bzero (_res.defdname, sizeof (_res.defdname)); + + if ( (cp = getenv("SOCKS_DNAME")) != NULL ) + { + strncpy (_res.defdname, cp, sizeof (_res.defdname)-1); + } + else + { + strncpy (_res.defdname, SOCKS_DEFAULT_DNAME, + sizeof (_res.defdname)-1); + } +#endif +*/ +/* <<< jon r. luini */ + +#endif /* #if !defined(DNS_THROUGH_NIS) */ + + if ((socks_def_server = getenv("SOCKS_SERVER")) == NULL) + socks_def_server = defaultSERVER; + socks_server = socks_def_server; + if ((cp = getenv("SOCKS_BANNER")) != NULL) { + if (socks_useSyslog) + syslog(LOG_LOW, "SOCKS %s client. Default SOCKS server: %s\n", + RELEASE, socks_def_server); + else + fprintf(stderr, "SOCKS lient. Default SOCKS server: %s\n", + RELEASE, socks_def_server); + } + + socks_nsin.sin_family = AF_INET; + if ((sp = getservbyname("socks", "tcp")) != NULL) + socks_nsin.sin_port = sp->s_port; + else + socks_nsin.sin_port = htons(SOCKS_DEF_PORT); +/* + if ((hp = gethostbyname(socks_server)) == NULL) { + socks_nsin.sin_addr.s_addr = inet_addr(socks_server); + } else { + bcopy(hp->h_addr_list[0], &socks_nsin.sin_addr.s_addr, hp->h_length); + } +*/ + if (stat(SOCKS_FC, &statfc) == 0) + socks_rdfz(SOCKS_FC, &scfAddr, &Nscf, &cfStrings, socks_useSyslog); + else if (stat(SOCKS_CONF, &statcf) == 0) + socks_rdconf(SOCKS_CONF, &scfAddr, &Nscf, socks_useSyslog); + else + socks_no_conf = 1; + return 0; +} + + +int socks_connect_sockd(sock) +int sock; +/* returns 0 if successfully connected to a SOCKS server, + returns -1 otherwise + */ +{ + int last = 0; + int new_sock; + struct hostent *hp; + char **cp; + + while (socks_server = socks_serverlist) { + if (socks_serverlist = index(socks_serverlist, ',')) + *socks_serverlist = '\0'; + if (socks_GetQuad(socks_server, &socks_nsin.sin_addr) != -1) { + cp = NULL; + } else if ((hp = gethostbyname(socks_server)) == NULL) { + break; + } else { + cp = hp->h_addr_list; + bcopy(*cp++, &socks_nsin.sin_addr, IPADDRLENG); + } + + while (1) { + new_sock = socket(PF_INET, SOCK_STREAM, 0); + if (new_sock < 0) { + return -1; + } + if (connect(new_sock, (struct sockaddr *)&socks_nsin, sizeof(struct sockaddr_in)) == 0) { + if (dup2(new_sock, sock) < 0) { + close(new_sock); + return -1; + } else { + close(new_sock); + return 0; + } + } else { + close(new_sock); +#ifdef EAGAIN + if ((errno == EISCONN) || (errno == EINPROGRESS) || (errno == EAGAIN)) +#else + if ((errno == EISCONN) || (errno == EINPROGRESS)) +#endif + return -1; + } + if ((cp == NULL) || (*cp == NULL)) + break; + bcopy(*cp++, &socks_nsin.sin_addr, IPADDRLENG); + } + syslog(LOG_LOW, "Failed to connect to sockd at %s: %m", socks_server); + if (!(socks_serverlist)) { + return -1; + } + if (socks_serverlist) *socks_serverlist++ =','; + } + errno = ECONNREFUSED; + return -1; + +} + + +static int send_name(s, name) +int s; +char *name; +{ + char *p = name; + int i, n, ret; + fd_set fds; + int fdsbits = s + 1; + struct timeval timeout; + + i = strlen(name) + 1; + while ( i > 0) { + FD_ZERO(&fds); + FD_SET(s, &fds); + timeout.tv_sec = 15; + timeout.tv_usec = 0; + if ((ret = select(fdsbits, NULL, &fds, NULL, &timeout)) < 0) { + if (errno == EINTR) + continue; + return(-1); + } + if (ret == 0) + continue; + if((n = write(s, p, i)) <= 0) { + return(-2); + } + p += n; + i -= n; + } + return(0); +} + + +int socksC_proto(s, dst) +int s; +Socks_t *dst; +{ + int sta; + u_int32 addr; + char *hostname; + + if ((sta = socks_SendDst(s, dst)) < 0) { + if (socks_useSyslog) + syslog(LOG_LOW, "Connection refused by SOCKS server %s\n", socks_server); + else + fprintf(stderr, "Connection refused by SOCKS server %s\n", socks_server); + return(sta); + } + if ((sta = send_name(s, src_user)) < 0) { + if (socks_useSyslog) + syslog(LOG_LOW, "Connection refused by SOCKS server %s\n", socks_server); + else + fprintf(stderr, "Connection refused by SOCKS server %s\n", socks_server); + return(sta); + } + + addr = ntohl(dst->host); + if ((addr >> 8) == 0) { + /* Using fake IP, send destination hostname */ + if ((sta = send_name(s, socks_fakeIP[addr-1].h_name)) < 0) { + if (socks_useSyslog) + syslog(LOG_LOW, "Connection refused by SOCKS server %s\n", socks_server); + else + fprintf(stderr, "Connection refused by SOCKS server %s\n", socks_server); + } + } + + if ((sta = socks_GetDst(s, dst)) < 0) { + if (socks_useSyslog) + syslog(LOG_LOW, "Connection refused by SOCKS server %s\n", socks_server); + else + fprintf(stderr, "Connection refused by SOCKS server %s\n", socks_server); + return(sta); + } + return(0); +} + +static void quit_C_proto() +{ + exit(SOCKS_FAIL); +} + +static void do_C_proto(sock, port, addr) +int sock; +unsigned short port; +u_int32 addr; +{ + Socks_t dst; + + signal(SIGALRM, quit_C_proto); + alarm(CLIENT_CONN_TIMEOUT); + dst.version = SOCKS_VERSION; + dst.cmd = SOCKS_CONNECT; + dst.port = port; + dst.host = addr; + if (socksC_proto(sock, &dst) < 0) { + alarm(0); + exit(SOCKS_FAIL); + } + alarm(0); + if ((dst.cmd == SOCKS_FAIL) || (dst.cmd == SOCKS_NO_IDENTD) + || (dst.cmd == SOCKS_BAD_ID)) { + exit(dst.cmd); + } + exit(SOCKS_RESULT); + +} + + +int Rconnect(sock, sin, size) +int sock; +struct sockaddr_in *sin; +int size; +{ + Socks_t dst; + int i; + int res_ret, con_ret, con_errno; + u_int32 addr; + int status, wait_ret, child_pid; + + + if (sin->sin_family != AF_INET) { + return connect(sock, (struct sockaddr *)sin, size); + } + + if (socks_init_done == 0) + SOCKSinit("SOCKSclient"); + + if ((sock != socks_conn_sock) || (sin->sin_port != socks_conn_port) + || (sin->sin_addr.s_addr != socks_conn_host)) { + if (socks_conn_init) + kill(socks_conn_init, SIGKILL); + socks_conn_code = 0; + socks_conn_init = 0; + strcpy(socks_cmd, "connect"); + if (socks_IPtohost(&sin->sin_addr, &socks_dstsh) < 0) { + if (socks_useSyslog) + fprintf(stderr, "Out of memory\n"); + else + fprintf(stderr, "Out of memory\n"); + exit(1); + } + socks_dstsh.port = sin->sin_port; + socks_porttoserv(sin->sin_port, dst_serv, sizeof(dst_serv)); + } else if (status = socks_conn_code) { + socks_conn_init = 0; + socks_conn_code = 0; + socks_conn_sock = 0; + socks_conn_port = 0; + socks_conn_host = 0; + res_ret = socks_check_result(status); + if (status == SOCKS_RESULT) { + errno = EISCONN; + socks_last_conn_host = sin->sin_addr.s_addr; + socks_last_conn_port = sin->sin_port; + } else { + syslog(LOG_LOW, "Connection failed.\n"); + } + return -1; + } else if (socks_conn_init) { +#if defined(NO_WAITPID) + wait_ret = wait3(&status, WNOHANG, (struct rusage *) NULL); +#else + wait_ret = waitpid(socks_conn_init, &status, WNOHANG); +#endif /* #if defined(NO_WAITPID) */ + if (wait_ret == 0) { + errno = EALREADY; + return -1; + } else if (wait_ret == socks_conn_init) { + socks_conn_init = 0; + socks_conn_code = 0; + socks_conn_sock = 0; + socks_conn_port = 0; + socks_conn_host = 0; + if (status & 0x00ff) { + kill(socks_conn_init, SIGKILL); + errno = ECONNREFUSED; + syslog(LOG_LOW, "Connection failed.\n"); + return -1; + } else { + status = (status >> 8) & 0x00ff; + res_ret = socks_check_result(status); + if (res_ret == 0) { + errno = EISCONN; + socks_last_conn_host = sin->sin_addr.s_addr; + socks_last_conn_port = sin->sin_port; + } else { + syslog(LOG_LOW, "Connection failed.\n"); + } + return -1; + } + } else { + kill(socks_conn_init, SIGKILL); + errno = ECONNREFUSED; + socks_conn_init = 0; + socks_conn_code = 0; + socks_conn_sock = 0; + socks_conn_port = 0; + socks_conn_host = 0; + syslog(LOG_LOW, "Connection failed.\n"); + return -1; + } + } + + + if (socks_no_conf) + socks_direct = SOCKS_DIRECT; + else + socks_direct = socks_ckcf(&socks_srcsh, &socks_dstsh, scfAddr, Nscf, socks_useSyslog); + if (socks_direct == SOCKS_DENY) { + syslog(LOG_LOW, "refused -- connect() from %s(%s) to %s (%s)", + src_user, real_user, dst_name, dst_serv); + errno = ECONNREFUSED; + return -1; + } + + if (socks_direct == SOCKS_DIRECT) { + syslog(LOG_LOW, "connect() directly from %s(%s) to %s (%s)", + src_user, real_user, dst_name, dst_serv); + con_ret = connect(sock, (struct sockaddr *)sin, size); + if (con_ret == 0) { + socks_last_conn_host = sin->sin_addr.s_addr; + socks_last_conn_port = sin->sin_port; + } + return(con_ret); + } + + con_ret = socks_connect_sockd(sock); + if (con_ret == 0) { + syslog(LOG_LOW, "connect() from %s(%s) to %s (%s) using sockd at %s", + src_user, real_user, dst_name, dst_serv, socks_server); + dst.version = SOCKS_VERSION; + dst.cmd = SOCKS_CONNECT; + dst.port = sin->sin_port; + dst.host = sin->sin_addr.s_addr; + if (socksC_proto(sock, &dst) < 0) { + return -1; + } + res_ret = socks_check_result(dst.cmd); + if (res_ret == 0) { + socks_last_conn_host = sin->sin_addr.s_addr; + socks_last_conn_port = sin->sin_port; + } + return(res_ret); + } + if ((con_ret < 0) && (errno != EINPROGRESS)) { + return -1; + } + syslog(LOG_LOW, "connect() from %s(%s) to %s (%s) using sockd at %s", + src_user, real_user, dst_name, dst_serv, socks_server); + + switch (child_pid = fork()) { + case -1: + if (socks_useSyslog) + syslog(LOG_LOW, "Rconnect(): cannot fork: %m\n"); + else + perror("Rconnect(): fork()"); + errno = ECONNREFUSED; + return -1; + case 0: + do_C_proto(sock, sin->sin_port, sin->sin_addr.s_addr); + default: + socks_conn_init = child_pid; + socks_conn_code = 0; + socks_conn_sock = sock; + socks_conn_port = sin->sin_port; + socks_conn_host = sin->sin_addr.s_addr; + errno = EINPROGRESS; + return -1; + } +} +@ --- socks4-server-4.3.beta2.orig/runsocks/gethostbyname.c +++ socks4-server-4.3.beta2/runsocks/gethostbyname.c @@ -0,0 +1,31 @@ +#include +#include + +#include + +#include "wrap.h" + +int REAL(gethostbyname)(int sockfd, unsigned int backlog ) +{ + GETFUNC("gethostbyname", TRY_LIBC, -1, (int (*)(int sockfd, unsigned int backlog )), (sockfd, backlog), int); +} + +int gethostbyname(int sockfd, unsigned int backlog ) +{ + int ret; + +// printf("gethostbyname(%d)\n", InSocksFunctions); + + InSocksFunctions++; + + if (InSocksFunctions == 1) + ret = LIBPREFIX(gethostbyname)(sockfd, backlog); + else + ret = REAL(gethostbyname)(sockfd, backlog); + + InSocksFunctions--; + +// printf("gethostbyname(%d) ende\n", InSocksFunctions); + + return ret; +} --- socks4-server-4.3.beta2.orig/runsocks/wrap.h +++ socks4-server-4.3.beta2/runsocks/wrap.h @@ -0,0 +1,21 @@ +#ifndef WRAP_H +#define WRAP_H + +#define REAL(x) _RLD_ ## x +#define LIBPREFIX(x) R ## x + +#define TRY_LIBC (1 << 0) + +extern int InSocksFunctions; + +#define GETFUNC(name, flags, invalid, cast, args, rtype) \ + static void *func = NULL; \ + static rtype rval; \ + GetOriginalFunc(&func, (name), (flags)); \ + if (!func || func == (void *)-1) return (invalid); \ + rval = (cast func)args; \ + return rval + +void doinit(); + +#endif --- socks4-server-4.3.beta2.orig/runsocks/accept.c +++ socks4-server-4.3.beta2/runsocks/accept.c @@ -0,0 +1,31 @@ +#include +#include + +#include + +#include "wrap.h" + +int REAL(accept)(int sockfd, struct sockaddr *addr, socklen_t *addrlen ) +{ + GETFUNC("accept", TRY_LIBC, -1, (int (*)(int sockfd, struct sockaddr *addr, socklen_t *addrlen )), (sockfd, addr, addrlen), int); +} + +int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen ) +{ + int ret; + +// printf("accept(%d)\n", InSocksFunctions); + + InSocksFunctions++; + + if (InSocksFunctions == 1) + ret = LIBPREFIX(accept)(sockfd, addr, addrlen); + else + ret = REAL(accept)(sockfd, addr, addrlen); + + InSocksFunctions--; + +// printf("accept(%d) ende\n", InSocksFunctions); + + return ret; +} --- socks4-server-4.3.beta2.orig/runsocks/listen.c +++ socks4-server-4.3.beta2/runsocks/listen.c @@ -0,0 +1,31 @@ +#include +#include + +#include + +#include "wrap.h" + +int REAL(listen)(int sockfd, unsigned int backlog ) +{ + GETFUNC("listen", TRY_LIBC, -1, (int (*)(int sockfd, unsigned int backlog )), (sockfd, backlog), int); +} + +int listen(int sockfd, int backlog ) +{ + int ret; + +// printf("listen(%d)\n", InSocksFunctions); + + InSocksFunctions++; + + if (InSocksFunctions == 1) + ret = LIBPREFIX(listen)(sockfd, backlog); + else + ret = REAL(listen)(sockfd, backlog); + + InSocksFunctions--; + +// printf("listen(%d) ende\n", InSocksFunctions); + + return ret; +} --- socks4-server-4.3.beta2.orig/runsocks/README.runsocks +++ socks4-server-4.3.beta2/runsocks/README.runsocks @@ -0,0 +1,36 @@ +There is now a preload library which enables every binary to use a +socks gateway. + +The preload library /usr/lib/socks4/libsockspl.so can be loaded before +the normal c library and replaces the accept, bind, connect and listen +system-calls. + +You can use it in different ways: + +- set the environment variable LD_PRELOAD to libsockspl.so + and then run you program. e.g.: + + LD_PRELOAD=/usr/lib/socks4/libsockspl.so; export LD_PRELOAD + telnet host.behind.firewall + + or + + LD_PRELOAD=/usr/lib/socks4/libsockspl.so telnet host.behind.firewall + +- use the shellscript runsocks which does just the above: + + runsocks ssh host.behind.firewall + +- add a line + + /usr/lib/socks4/libsockspl.so + + to /etc/ld.so.preload to tell ALL binaries to use socks. But be + aware, if you mistype the line here. No binary will find the preload + library and all will fail to run. + +Note: + +If you are using ftp, remember to set passive mode, because it is not +possible for the server to connect to your client backwards through +your firewall. --- socks4-server-4.3.beta2.orig/runsocks/Makefile +++ socks4-server-4.3.beta2/runsocks/Makefile @@ -0,0 +1,24 @@ +CFLAGS = -fPIC + +SHAREDCFLAGS = -nostdlib -shared + +OTHER_CFLAGS= -DLINUX -DCOMPAT + +OBJECTS = wrap.o connect.o bind.o accept.o listen.o gethostbyname.o #Rconnect.o Rgethostbyname.o utils.o socks_rdconf.o #select.o getsockname.o + +LIB= libsockspl.so +LIBDIR= $(LIB_DEST_DIR)/socks4/ + +%.o: %.c + $(CC) $(CFLAGS) $(OTHER_CFLAGS) -c $< + +$(LIB) : $(OBJECTS) + $(CC) -o $@ $(CFLAGS) $(SHAREDCFLAGS) $(OBJECTS) $(SOCKS_LIB) -ldl -lc + +install: + -mkdir -p $(LIBDIR) + $(INSTALL) $(LIB) $(LIBDIR)/ + $(INSTALL) runsocks $(CLIENTS_BIN_DIR)/ + +clean: + rm -f *.o *.so --- socks4-server-4.3.beta2.orig/runsocks/bind.c +++ socks4-server-4.3.beta2/runsocks/bind.c @@ -0,0 +1,34 @@ +#include +#include + +#include + +#include "wrap.h" + +int REAL(bind)(int sockfd, __const struct sockaddr *my_addr, socklen_t addrlen ) +{ + GETFUNC("bind", TRY_LIBC, -1, (int (*)(int sockfd, __const struct sockaddr *my_addr, socklen_t addrlen )), (sockfd, my_addr, addrlen), int); +} + +int bind(int sockfd, __const struct sockaddr *my_addr, socklen_t addrlen ) +{ + int ret; + +// printf("bind(%d)\n", InSocksFunctions); + + InSocksFunctions++; + + doinit(); + + if (InSocksFunctions == 1) + ret = LIBPREFIX(bind)(sockfd, my_addr, addrlen); + else + ret = REAL(bind)(sockfd, my_addr, addrlen); + + + InSocksFunctions--; + +// printf("bind(%d) ende\n", InSocksFunctions); + + return ret; +} --- socks4-server-4.3.beta2.orig/runsocks/runsocks +++ socks4-server-4.3.beta2/runsocks/runsocks @@ -0,0 +1,2 @@ +#!/bin/bash +LD_PRELOAD=/usr/lib/socks4/libsockspl.so $@ --- socks4-server-4.3.beta2.orig/runsocks/wrap.c +++ socks4-server-4.3.beta2/runsocks/wrap.c @@ -0,0 +1,77 @@ +#include +#include +#include +#include +#include "wrap.h" + +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef LIBC_NAME +#define LIBC_NAME "libc.so.6" +#endif + +int InSocksFunctions = 0; + +#define GETSYM(handle, libname, flags) \ + if (!(handle) && ((handle) = dlopen((libname), (flags))) == NULL) { \ + return; \ + } \ + if ((*fptr = dlsym((handle), name)) != NULL) { \ + return; \ + } + +#define GETSYMHANDLE(mask, handle, libname, envname, flags) \ + if (libmask & (mask)) { \ + static void *(handle) = NULL; \ + char *lname = (envname)?getenv((envname)):NULL; \ + if (lname == NULL) lname = (libname); \ + if (lname) { GETSYM((handle), lname, (flags)); } \ + } + +/* Look up name in libc.so, libnsl.so, and libsocket.so, if its there return */ +/* the symbol we found, otherwise return NULL... */ +void GetOriginalFunc(void **fptr, char *name, int libmask) { + /* Synchronize access to func and lib opening functions if we can... */ + + if (*fptr) return; +// printf("GetOriginalFunc(%s)\n", name); + /* Still have to figure out what OSs USE_RTLD_NEXT is valid for. For */ + /* most that I've tried, it hasn't worked right... */ +#if defined(RTLD_NEXT) && defined(USE_RTLD_NEXT) + if (name && ~libmask & NO_RTLD_NEXT && (*fptr = dlsym(RTLD_NEXT, name)) != NULL) { + return; + } +#endif + + GETSYMHANDLE(TRY_LIBC, libc_handle, LIBC_NAME, "LIBC_NAME", RTLD_LAZY); +} + +void doinit() +{ + static int init = 0; + + if (++init == 1) + { + pid_t pid; + FILE *fd; + char procfile[255]; + static char cmd[255]; + + pid = getpid(); + sprintf(procfile, "/proc/%d/cmdline", pid); + if ((fd = fopen(procfile, "r")) == NULL) + { + fprintf(stderr, "Can not open %s : %s\n", + procfile, strerror(errno)); + } + else + { + fgets(cmd, 254, fd); + +// printf("%d:%s:%s\n", pid,procfile,cmd); + + SOCKSinit(cmd); + } + } +} --- socks4-server-4.3.beta2.orig/runsocks/connect.c +++ socks4-server-4.3.beta2/runsocks/connect.c @@ -0,0 +1,38 @@ +#include +#include + +#include + +#include "wrap.h" + +int REAL(connect)(int sockfd, __const struct sockaddr *serv_addr, socklen_t addrlen ) +{ + GETFUNC("connect", TRY_LIBC, -1, (int (*)(int sockfd, __const struct sockaddr *serv_addr, socklen_t addrlen )), (sockfd, serv_addr, addrlen), int); +} + +int connect(int sockfd, __const struct sockaddr *serv_addr, socklen_t addrlen ) +{ + int ret; + +// printf("connect (%d)\n", InSocksFunctions); + + InSocksFunctions++; + + doinit(); + + if (InSocksFunctions == 1) + { + + ret = LIBPREFIX(connect)(sockfd, serv_addr, addrlen); + } + else + { + ret = REAL(connect)(sockfd, serv_addr, addrlen); + } + + InSocksFunctions--; + +// printf("connect (%d) ende\n", InSocksFunctions); + + return ret; +} --- socks4-server-4.3.beta2.orig/rfinger/finger.c +++ socks4-server-4.3.beta2/rfinger/finger.c @@ -12,8 +12,8 @@ #include #endif /* #if defined(ISC) */ #include "socks.h" +#include -extern int errno; extern char *strrchr(); char *Progname; extern char *getenv(); @@ -40,13 +40,6 @@ struct in_addr dstaddr[21]; -#ifdef LINUX - int optind = 1; -#else - extern int optind; -#endif - extern char *optarg; - if ((Progname = strrchr(argv[0], '/')) == NULL) Progname = argv[0]; else --- socks4-server-4.3.beta2.orig/rfinger/Makefile +++ socks4-server-4.3.beta2/rfinger/Makefile @@ -9,10 +9,10 @@ all: echocwd rfinger rwhois -rfinger: $(OBJ) $(SOCKS_LIB) ../include/socks.h ../Makefile +rfinger: $(OBJ) $(SOCKS_LIB_DEP) ../include/socks.h ../Makefile $(CC) $(CFLAGS) -o $@ $(OBJ) $(SOCKS_LIB) $(RESOLV_LIB) -rwhois: $(SRC) $(SOCKS_LIB) ../include/socks.h ../Makefile +rwhois: $(SRC) $(SOCKS_LIB_DEP) ../include/socks.h ../Makefile $(CC) $(WHOIS_SERVER) $(CFLAGS) -o $@ $(SRC) $(SOCKS_LIB) $(RESOLV_LIB) install: echocwd rfinger rwhois --- socks4-server-4.3.beta2.orig/debian/changelog +++ socks4-server-4.3.beta2/debian/changelog @@ -0,0 +1,147 @@ +socks4-server (4.3.beta2-18) unstable; urgency=low + + * QA upload. + * Stop compiling with -DCOMPAT. With a modern C library it achieves + nothing useful except breaking things (closes: #625030, LP: #832779). + * Remove explicit make dependencies on system libraries, which do more + harm than good, especially with the switch to multiarch. + + -- Colin Watson Mon, 19 Sep 2011 17:27:38 +0100 + +socks4-server (4.3.beta2-17) unstable; urgency=low + + * set maintainer to Debian QA Group + package is orphaned (#485646) + + -- Christoph Martin Tue, 24 May 2011 20:56:47 +0200 + +socks4-server (4.3.beta2-16) unstable; urgency=low + + * correct maintainer email + * add lintian override for usr/lib/libsocks.so + * rephrase socks4-clients description + + -- Christoph Martin Wed, 18 Jun 2008 18:10:59 +0200 + +socks4-server (4.3.beta2-15) unstable; urgency=low + + * upgrade to debhelper compat 5 + * upgrade to standards version 3.8.0 (no changes) + * fix manpage errors + + -- Christoph Martin Tue, 17 Jun 2008 18:12:49 +0200 + +socks4-server (4.3.beta2-14) unstable; urgency=low + + * make code compatible with gcc-4.0 (closes: #294371) + * update download URL in copyright + * change to DH_COMPAT=3 + + -- Christoph Martin Fri, 9 Sep 2005 11:24:04 +0200 + +socks4-server (4.3.beta2-13) stable; urgency=low + + * changed priority of libsocks4 to optional + * fix building of rtelnet + + -- Christoph Martin Sat, 24 Aug 2002 12:46:29 +0200 + +socks4-server (4.3.beta2-12) unstable; urgency=low + + * fix package description of libsocks (closes: #90609) + * fix -h handling in rfinger (closes: #76073) + * include NMU fixes (closes: #90529, #90607, #93213, #92097) + + -- Christoph Martin Mon, 19 Nov 2001 21:01:46 +0100 + +socks4-server (4.3.beta2-11.1) unstable; urgency=low + + * Non-maintainer upload + * Set soname of libsocks (closes: #90529, #90607, #93213) + * change the prototype of listen(2) in runsocks/listen.c (which makes it + build again). + * removed the debian templates in debian/ + * updated standards-version + + -- Tollef Fog Heen Wed, 11 Apr 2001 18:31:21 +0200 + +socks4-server (4.3.beta2-11) unstable; urgency=low + + * added builddepends for libident-dev, libncurses5-dev (closes: #83132) + + -- Christoph Martin Tue, 23 Jan 2001 10:09:11 +0100 + +socks4-server (4.3.beta2-10) unstable; urgency=low + + * move conffile /etc/socks.conf from socks4-clients to libsocks4 + (closes: #59195) + * build shared library with -fPIC (closes: #56611) + + -- Christoph Martin Tue, 16 Jan 2001 17:53:16 +0100 + +socks4-server (4.3.beta2-9) unstable; urgency=low + + * fix runsocks symbol problmes (closes: Bug#49262) + * move to debhelpers and fix lintian problems + + -- Christoph Martin Tue, 30 Nov 1999 11:20:41 +0100 + +socks4-server (4.3.beta2-8) unstable; urgency=low + + * let sockd run as nobody instead of root (Bug #26640) + * added default route to sockd.route + * removed default permit line in sockd.conf + * removed extra directory from socks4-client (Bug #25654) + + -- Christoph Martin Sat, 22 May 1999 18:43:47 +0200 + +socks4-server (4.3.beta2-7) unstable; urgency=low + + * SOCKSinit too in connect.c of runsocks + + -- Christoph Martin Mon, 3 Aug 1998 11:26:02 +0200 + +socks4-server (4.3.beta2-6) unstable; urgency=low + + * added runsocks to socksify "normal" programs using a + preload-library. Using this it is normaly no longer necessary to build + programs with socks support. + + -- Christoph Martin Wed, 22 Jul 1998 16:10:08 +0200 + +socks4-server (4.3.beta2-5) frozen unstable; urgency=high + + * fixed shared library links to support compiling shared linked + programs. (Bug #22469) + * added missing changelog to socks4-clients and libsocks4 + + -- Christoph Martin Thu, 18 Jun 1998 22:13:53 +0200 + +socks4-server (4.3.beta2-4) frozen unstable; urgency=low + + * fixed default socks.conf (Bug #15104) + * included contents of COPYRIGHTS in copyright (Bug #14905) + * fixed some bugs reportet by lintian + * added socks line to /etc/services + + -- Christoph Martin Sat, 28 Mar 1998 17:38:50 +0100 + +socks4 (4.3.beta2-3) unstable; urgency=low + + * linked against libncurses3.4 (Bug #14797) + + -- Christoph Martin Mon, 17 Nov 1997 20:59:26 +0100 + +socks4 (4.3.beta2-2) unstable; urgency=low + + * linked shared library against libc6 + + -- Christoph Martin Tue, 4 Nov 1997 15:31:45 +0100 + +socks4 (4.3.beta2-1) unstable; urgency=low + + * Initial Release. + + -- Christoph Martin Thu, 9 Oct 1997 10:32:41 +0200 + + --- socks4-server-4.3.beta2.orig/debian/libsocks4.dirs +++ socks4-server-4.3.beta2/debian/libsocks4.dirs @@ -0,0 +1,3 @@ +usr/lib +usr/share/doc/libsocks4 +usr/share/lintian/overrides --- socks4-server-4.3.beta2.orig/debian/rules +++ socks4-server-4.3.beta2/debian/rules @@ -0,0 +1,90 @@ +#!/usr/bin/make -f +# Made with the aid of debmake, by Christoph Lameter, +# based on the sample debian/rules file for GNU hello by Ian Jackson. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +package=socks4 + +build: build-stamp +build-stamp: + dh_testdir + + make + + touch build-stamp + +clean: + dh_testdir + dh_testroot + -rm -f build-stamp install-stamp + make clean + -rm -f `find . -name "*~"` + -rm -rf debian/socks4-server debian/libsocks4 debian/socks4-clients `find debian/* -type d` debian/files* core + -rm -f debian/*substvars + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_installdirs +#server install + make install.server install.mkfc DESTDIR=`pwd`/debian/socks4-server + install -m 755 sockd/rsockd `pwd`/debian/socks4-server/usr/sbin/ + install -m 644 debian/sockd.conf `pwd`/debian/socks4-server/etc/ + install -m 644 debian/sockd.route `pwd`/debian/socks4-server/etc/ +#client install + make install.clients DESTDIR=`pwd`/debian/socks4-server + install -m 644 debian/socks.conf `pwd`/debian/socks4-server/etc/ + cd debian/socks4-clients/usr/share/man/man1 && ln -s ../man7/undocumented.7.gz runsocks.1.gz +#libs install + make install.lib DESTDIR=`pwd`/debian/socks4-server + install -m 644 lib/libsocks.so.4.3 `pwd`/debian/socks4-server/usr/lib/ + ln -s libsocks.so.4.3 debian/socks4-server/usr/lib/libsocks.so.4 + ln -s libsocks.so.4.3 debian/socks4-server/usr/lib/libsocks.so + make install.man DESTDIR=`pwd`/debian/socks4-server + + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +# Build architecture-dependent files here. +binary-arch: build install +# dh_testversion + dh_testdir + dh_testroot + + dh_movefiles --sourcedir=debian/socks4-server + rmdir debian/socks4-server/usr/bin + rmdir debian/socks4-server/usr/share/man/man1 + rmdir debian/socks4-server/usr/lib/socks4 + rmdir debian/socks4-server/usr/lib + install -m 644 debian/libsocks4.lintian debian/libsocks4/usr/share/lintian/overrides/libsocks4 + dh_installchangelogs CHANGES + dh_installdocs runsocks/README.runsocks + dh_installexamples + dh_installmenu +# dh_installemacsen +# dh_installinit + dh_installcron + dh_installman +# dh_undocumented + dh_strip + dh_link + dh_compress + dh_fixperms +# dh_suidregister + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-arch binary-indep binary --- socks4-server-4.3.beta2.orig/debian/libsocks4.files +++ socks4-server-4.3.beta2/debian/libsocks4.files @@ -0,0 +1,2 @@ +usr/lib/ +etc/socks.conf --- socks4-server-4.3.beta2.orig/debian/compat +++ socks4-server-4.3.beta2/debian/compat @@ -0,0 +1 @@ +5 --- socks4-server-4.3.beta2.orig/debian/libsocks4.postinst +++ socks4-server-4.3.beta2/debian/libsocks4.postinst @@ -0,0 +1,8 @@ +#!/bin/sh -e + +case "$1" in + configure) + ldconfig +esac + +#DEBHELPER# --- socks4-server-4.3.beta2.orig/debian/socks4-server.dirs +++ socks4-server-4.3.beta2/debian/socks4-server.dirs @@ -0,0 +1,8 @@ +usr/bin +usr/share/doc +usr/sbin +usr/lib +usr/share/man/man1 +usr/share/man/man5 +usr/share/man/man8 +etc --- socks4-server-4.3.beta2.orig/debian/socks.conf +++ socks4-server-4.3.beta2/debian/socks.conf @@ -0,0 +1,5 @@ +# socks configuration +#direct 127.0.0.1 255.255.255.255 +#direct 10.7.10.255 255.255.255.0 +#sockd 0.0.0.0 0.0.0.0 +direct 0.0.0.0 0.0.0.0 --- socks4-server-4.3.beta2.orig/debian/socks4-clients.files +++ socks4-server-4.3.beta2/debian/socks4-clients.files @@ -0,0 +1,6 @@ +usr/bin/ +usr/share/man/man1/ +usr/share/man/man*/*socks* +usr/sbin/make_socksfc +usr/sbin/dump_socksfc +usr/lib/socks4 --- socks4-server-4.3.beta2.orig/debian/control +++ socks4-server-4.3.beta2/debian/control @@ -0,0 +1,50 @@ +Source: socks4-server +Section: net +Priority: extra +Maintainer: Debian QA Group +Build-Depends: debhelper (>= 4.2.0), libident-dev, libncurses5-dev +Standards-Version: 3.8.0 + +Package: socks4-server +Architecture: any +Depends: ${shlibs:Depends} +Description: SOCKS4 server for proxying IP-based services over a firewall + This is version 4.3 of SOCKS, a package that allows Unix hosts + behind a firewall to gain full access to the internet without requiring + direct IP reachability. It does require a SOCKS server program being + run on a hosts that can communicate directly to hosts behind the firewall + as well as hosts on the Internet at large. It is based on the original + SOCKS written by David Koblas . + . + This package includes the SOCKS server. + +Package: socks4-clients +Architecture: any +Depends: ${shlibs:Depends} +Description: Socks4 enabled clients as rtelnet and rftp + This is version 4.3 of SOCKS, a package that allows Unix hosts + behind a firewall to gain full access to the internet without requiring + direct IP reachability. It does require a SOCKS server program being + run on a hosts that can communicate directly to hosts behind the firewall + as well as hosts on the Internet at large. It is based on the original + SOCKS written by David Koblas . + . + This package includes SOCKSified client programs of finger, ftp, + telnet, and whois. A few other SOCKSified clients may be found on + ftp.nec.com, in directory /pub/security/socks.cstc. + +Package: libsocks4 +Architecture: any +Depends: ${shlibs:Depends} +Replaces: socks4-clients +Section: libs +Priority: optional +Description: SOCKS libraries + This is version 4.3 of SOCKS, a package that allows Unix hosts + behind a firewall to gain full access to the internet without requiring + direct IP reachability. It does require a SOCKS server program being + run on a hosts that can communicate directly to hosts behind the firewall + as well as hosts on the Internet at large. It is based on the original + SOCKS written by David Koblas . + . + This package includes libsocks needed by SOCKSified client programs. --- socks4-server-4.3.beta2.orig/debian/README.debian +++ socks4-server-4.3.beta2/debian/README.debian @@ -0,0 +1,6 @@ +socks4 for DEBIAN +---------------------- + +Socks firewall proxy software for Debian/Linux + +Christoph Martin , Thu, 9 Oct 1997 10:32:41 +0200 --- socks4-server-4.3.beta2.orig/debian/libsocks4.lintian +++ socks4-server-4.3.beta2/debian/libsocks4.lintian @@ -0,0 +1 @@ +libsocks4: non-dev-pkg-with-shlib-symlink usr/lib/libsocks.so.4.3 usr/lib/libsocks.so --- socks4-server-4.3.beta2.orig/debian/copyright +++ socks4-server-4.3.beta2/debian/copyright @@ -0,0 +1,56 @@ +This package was debianized by Christoph Martin christoph.martin@uni-mainz.de on +Thu, 9 Oct 1997 10:32:41 +0200. + +It was downloaded from +ftp://ftp.uni-mainz.de/pub/software/security/socks/socks4/export.socks.4.3.beta2.tar.gz. + +----------------------------------------------------------------- +Copyright (c) 1989 Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +----------------------------------------------------------------- +Portions Copyright (c) 1993, 1994, 1995 by NEC Systems Laboratory. + +Permission to use, copy, modify, and distribute this software for +any purpose with or without fee is hereby granted, provided that +the above copyright notice and this permission notice appear in all +copies, and that the name of NEC Systems Laboratory not be used in +advertising or publicity pertaining to distribution of the document +or software without specific, written prior permission. + +THE SOFTWARE IS PROVIDED ``AS IS'' AND NEC SYSTEMS LABORATORY DISCLAIMS +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NEC +SYSTEMS LABORATORY BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. --- socks4-server-4.3.beta2.orig/debian/sockd.route +++ socks4-server-4.3.beta2/debian/sockd.route @@ -0,0 +1,5 @@ +# routes for sockd +# +# IP of interface destination netmask for destination +# eg: 10.0.0.254 10.0.0.28 255.255.255.255 + 0.0.0.0 0.0.0.0 0.0.0.0 --- socks4-server-4.3.beta2.orig/debian/socks4-clients.dirs +++ socks4-server-4.3.beta2/debian/socks4-clients.dirs @@ -0,0 +1,6 @@ +usr/bin +usr/share/doc/socks4-clients +usr/share/man/man1 +usr/share/man/man5 +usr/share/man/man8 +etc --- socks4-server-4.3.beta2.orig/debian/sockd.conf +++ socks4-server-4.3.beta2/debian/sockd.conf @@ -0,0 +1,6 @@ +# Replace 'my.domain' below with your own domain name before using. +# Make sure you retain the leading period. + +deny ALL 0.0.0.0 .my.domain 0.0.0.0 + +#permit .my.domain 0.0.0.0 ALL 0.0.0.0 --- socks4-server-4.3.beta2.orig/debian/docs +++ socks4-server-4.3.beta2/debian/docs @@ -0,0 +1,7 @@ +README.1st +README.4.0 +README.4.1 +README.4.2 +README.4.3.beta2 +README.DK +COPYRIGHTS --- socks4-server-4.3.beta2.orig/debian/inetd.conf +++ socks4-server-4.3.beta2/debian/inetd.conf @@ -0,0 +1,2 @@ +#:OTHER: +socks stream tcp nowait nobody /usr/sbin/sockd sockd -I