wok diff libwrap/stuff/tcp_wrappers-7.6-shared_lib_plus_plus-1.patch @ rev 21668

updated pcre2 and pcre2-dev (10.21 -> 10.32)
author Hans-G?nter Theisgen
date Sat Jun 01 14:42:22 2019 +0100 (2019-06-01)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libwrap/stuff/tcp_wrappers-7.6-shared_lib_plus_plus-1.patch	Sat Jun 01 14:42:22 2019 +0100
     1.3 @@ -0,0 +1,1035 @@
     1.4 +Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
     1.5 +Date: 2003-10-04
     1.6 +Initial Package Version: 7.6
     1.7 +Origin: http://archives.linuxfromscratch.org/mail-archives/blfs-dev/2003-January/001960.html
     1.8 +Description: The patch was created from the tcp_wrappers modified package by Mark Heerdink.
     1.9 +This patch provides the following improvements:
    1.10 +    * Install libwrap.so along with libwrap.a.
    1.11 +    * Create an install target for tcp_wrappers.
    1.12 +    * Compilation and security fixes.
    1.13 +    * Documentation fixes.
    1.14 +diff -Naur tcp_wrappers_7.6/Makefile tcp_wrappers_7.6.gimli/Makefile
    1.15 +--- tcp_wrappers_7.6/Makefile	1997-03-21 12:27:21.000000000 -0600
    1.16 ++++ tcp_wrappers_7.6.gimli/Makefile	2002-07-15 16:07:21.000000000 -0500
    1.17 +@@ -1,5 +1,10 @@
    1.18 ++GLIBC=$(shell grep -s -c __GLIBC__ /usr/include/features.h)
    1.19 ++
    1.20 + # @(#) Makefile 1.23 97/03/21 19:27:20
    1.21 + 
    1.22 ++# unset the HOSTNAME environment variable
    1.23 ++HOSTNAME =
    1.24 ++
    1.25 + what:
    1.26 + 	@echo
    1.27 + 	@echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
    1.28 +@@ -19,7 +24,7 @@
    1.29 + 	@echo "	generic (most bsd-ish systems with sys5 compatibility)"
    1.30 + 	@echo "	386bsd aix alpha apollo bsdos convex-ultranet dell-gcc dgux dgux543"
    1.31 + 	@echo "	dynix epix esix freebsd hpux irix4 irix5 irix6 isc iunix"
    1.32 +-	@echo "	linux machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
    1.33 ++	@echo "	linux gnu machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
    1.34 + 	@echo "	ptx-2.x ptx-generic pyramid sco sco-nis sco-od2 sco-os5 sinix sunos4"
    1.35 + 	@echo "	sunos40 sunos5 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
    1.36 + 	@echo "	uts215 uxp"
    1.37 +@@ -43,8 +48,8 @@
    1.38 + # Ultrix 4.x SunOS 4.x ConvexOS 10.x Dynix/ptx
    1.39 + #REAL_DAEMON_DIR=/usr/etc
    1.40 + #
    1.41 +-# SysV.4 Solaris 2.x OSF AIX
    1.42 +-#REAL_DAEMON_DIR=/usr/sbin
    1.43 ++# SysV.4 Solaris 2.x OSF AIX Linux
    1.44 ++REAL_DAEMON_DIR=/usr/sbin
    1.45 + #
    1.46 + # BSD 4.4
    1.47 + #REAL_DAEMON_DIR=/usr/libexec
    1.48 +@@ -141,10 +146,21 @@
    1.49 + 	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
    1.50 + 	EXTRA_CFLAGS=-DSYS_ERRLIST_DEFINED VSYSLOG= all
    1.51 + 
    1.52 ++ifneq ($(GLIBC),0)
    1.53 ++MYLIB=-lnsl
    1.54 ++endif
    1.55 ++
    1.56 + linux:
    1.57 + 	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
    1.58 +-	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
    1.59 +-	NETGROUP= TLI= EXTRA_CFLAGS="-DBROKEN_SO_LINGER" all
    1.60 ++	LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
    1.61 ++	NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
    1.62 ++	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_WEAKSYMS -D_REENTRANT"
    1.63 ++
    1.64 ++gnu:
    1.65 ++	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
    1.66 ++	LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
    1.67 ++	NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
    1.68 ++	EXTRA_CFLAGS="-DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT"
    1.69 + 
    1.70 + # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
    1.71 + hpux hpux8 hpux9 hpux10:
    1.72 +@@ -391,7 +407,7 @@
    1.73 + # the ones provided with this source distribution. The environ.c module
    1.74 + # implements setenv(), getenv(), and putenv().
    1.75 + 
    1.76 +-AUX_OBJ= setenv.o
    1.77 ++#AUX_OBJ= setenv.o
    1.78 + #AUX_OBJ= environ.o
    1.79 + #AUX_OBJ= environ.o strcasecmp.o
    1.80 + 
    1.81 +@@ -454,7 +470,8 @@
    1.82 + # host name aliases. Compile with -DSOLARIS_24_GETHOSTBYNAME_BUG to work
    1.83 + # around this. The workaround does no harm on other Solaris versions.
    1.84 + 
    1.85 +-BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
    1.86 ++BUGS =
    1.87 ++#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
    1.88 + #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DINET_ADDR_BUG
    1.89 + #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DSOLARIS_24_GETHOSTBYNAME_BUG
    1.90 + 
    1.91 +@@ -464,7 +481,7 @@
    1.92 + # If your system supports NIS or YP-style netgroups, enable the following
    1.93 + # macro definition. Netgroups are used only for host access control.
    1.94 + #
    1.95 +-#NETGROUP= -DNETGROUP
    1.96 ++NETGROUP= -DNETGROUP
    1.97 + 
    1.98 + ###############################################################
    1.99 + # System dependencies: whether or not your system has vsyslog()
   1.100 +@@ -491,7 +508,7 @@
   1.101 + # Uncomment the next definition to turn on the language extensions
   1.102 + # (examples: allow, deny, banners, twist and spawn).
   1.103 + # 
   1.104 +-#STYLE	= -DPROCESS_OPTIONS	# Enable language extensions.
   1.105 ++STYLE	= -DPROCESS_OPTIONS	# Enable language extensions.
   1.106 + 
   1.107 + ################################################################
   1.108 + # Optional: Changing the default disposition of logfile records
   1.109 +@@ -514,7 +531,7 @@
   1.110 + #
   1.111 + # The LOG_XXX names below are taken from the /usr/include/syslog.h file.
   1.112 + 
   1.113 +-FACILITY= LOG_MAIL	# LOG_MAIL is what most sendmail daemons use
   1.114 ++FACILITY= LOG_DAEMON	# LOG_MAIL is what most sendmail daemons use
   1.115 + 
   1.116 + # The syslog priority at which successful connections are logged.
   1.117 + 
   1.118 +@@ -610,7 +627,7 @@
   1.119 + # Paranoid mode implies hostname lookup. In order to disable hostname
   1.120 + # lookups altogether, see the next section.
   1.121 + 
   1.122 +-PARANOID= -DPARANOID
   1.123 ++#PARANOID= -DPARANOID
   1.124 + 
   1.125 + ########################################
   1.126 + # Optional: turning off hostname lookups
   1.127 +@@ -623,7 +640,7 @@
   1.128 + # In order to perform selective hostname lookups, disable paranoid
   1.129 + # mode (see previous section) and comment out the following definition.
   1.130 + 
   1.131 +-HOSTNAME= -DALWAYS_HOSTNAME
   1.132 ++#HOSTNAME= -DALWAYS_HOSTNAME
   1.133 + 
   1.134 + #############################################
   1.135 + # Optional: Turning on host ADDRESS checking
   1.136 +@@ -649,28 +666,46 @@
   1.137 + # source-routed traffic in the kernel. Examples: 4.4BSD derivatives,
   1.138 + # Solaris 2.x, and Linux. See your system documentation for details.
   1.139 + #
   1.140 +-# KILL_OPT= -DKILL_IP_OPTIONS
   1.141 ++KILL_OPT= -DKILL_IP_OPTIONS
   1.142 + 
   1.143 + ## End configuration options
   1.144 + ############################
   1.145 + 
   1.146 + # Protection against weird shells or weird make programs.
   1.147 + 
   1.148 ++CC	= gcc
   1.149 + SHELL	= /bin/sh
   1.150 +-.c.o:;	$(CC) $(CFLAGS) -c $*.c
   1.151 ++.c.o:;	$(CC) $(CFLAGS) -o $*.o -c $*.c
   1.152 ++
   1.153 ++SOMAJOR = 0
   1.154 ++SOMINOR = 7.6
   1.155 ++
   1.156 ++LIB	= libwrap.a
   1.157 ++SHLIB	= shared/libwrap.so.$(SOMAJOR).$(SOMINOR)
   1.158 ++SHLIBSOMAJ= shared/libwrap.so.$(SOMAJOR)
   1.159 ++SHLIBSO	= shared/libwrap.so
   1.160 ++SHLIBFLAGS = -Lshared -lwrap
   1.161 + 
   1.162 +-CFLAGS	= -O -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
   1.163 ++shared/%.o: %.c
   1.164 ++	$(CC) $(CFLAGS) $(SHCFLAGS) -c $< -o $@
   1.165 ++
   1.166 ++CFLAGS	= -O2 -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
   1.167 + 	$(BUGS) $(SYSTYPE) $(AUTH) $(UMASK) \
   1.168 + 	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
   1.169 + 	-DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
   1.170 + 	$(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS) $(DOT) \
   1.171 + 	$(VSYSLOG) $(HOSTNAME)
   1.172 + 
   1.173 ++SHLINKFLAGS = -shared -Xlinker -soname -Xlinker libwrap.so.$(SOMAJOR) -lc $(LIBS)
   1.174 ++SHCFLAGS = -fPIC -shared -D_REENTRANT
   1.175 ++
   1.176 + LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
   1.177 + 	hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
   1.178 + 	$(FROM_OBJ) fix_options.o socket.o tli.o workarounds.o \
   1.179 + 	update.o misc.o diag.o percent_m.o myvsyslog.o
   1.180 + 
   1.181 ++SHLIB_OBJ= $(addprefix shared/, $(LIB_OBJ));
   1.182 ++
   1.183 + FROM_OBJ= fromhost.o
   1.184 + 
   1.185 + KIT	= README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
   1.186 +@@ -684,46 +719,80 @@
   1.187 + 	refuse.c tcpdchk.8 setenv.c inetcf.c inetcf.h scaffold.c \
   1.188 + 	scaffold.h tcpdmatch.8 README.NIS
   1.189 + 
   1.190 +-LIB	= libwrap.a
   1.191 +-
   1.192 +-all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
   1.193 ++all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(LIB)
   1.194 + 
   1.195 + # Invalidate all object files when the compiler options (CFLAGS) have changed.
   1.196 + 
   1.197 + config-check:
   1.198 + 	@set +e; test -n "$(REAL_DAEMON_DIR)" || { make; exit 1; }
   1.199 +-	@set +e; echo $(CFLAGS) >/tmp/cflags.$$$$ ; \
   1.200 +-	if cmp cflags /tmp/cflags.$$$$ ; \
   1.201 +-	then rm /tmp/cflags.$$$$ ; \
   1.202 +-	else mv /tmp/cflags.$$$$ cflags ; \
   1.203 ++	@set +e; echo $(CFLAGS) >cflags.new ; \
   1.204 ++	if cmp cflags cflags.new ; \
   1.205 ++	then rm cflags.new ; \
   1.206 ++	else mv cflags.new cflags ; \
   1.207 + 	fi >/dev/null 2>/dev/null
   1.208 ++	@if [ ! -d shared ]; then mkdir shared; fi
   1.209 + 
   1.210 + $(LIB):	$(LIB_OBJ)
   1.211 + 	rm -f $(LIB)
   1.212 + 	$(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
   1.213 + 	-$(RANLIB) $(LIB)
   1.214 + 
   1.215 +-tcpd:	tcpd.o $(LIB)
   1.216 +-	$(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
   1.217 ++$(SHLIB): $(SHLIB_OBJ)
   1.218 ++	rm -f $(SHLIB)
   1.219 ++	$(CC) -o $(SHLIB) $(SHLINKFLAGS) $(SHLIB_OBJ)
   1.220 ++	ln -s $(notdir $(SHLIB)) $(SHLIBSOMAJ)
   1.221 ++	ln -s $(notdir $(SHLIBSOMAJ)) $(SHLIBSO)
   1.222 ++
   1.223 ++tcpd:	tcpd.o $(SHLIB)
   1.224 ++	$(CC) $(CFLAGS) -o $@ tcpd.o $(SHLIBFLAGS)
   1.225 + 
   1.226 +-miscd:	miscd.o $(LIB)
   1.227 +-	$(CC) $(CFLAGS) -o $@ miscd.o $(LIB) $(LIBS)
   1.228 ++miscd:	miscd.o $(SHLIB)
   1.229 ++	$(CC) $(CFLAGS) -o $@ miscd.o $(SHLIBFLAGS)
   1.230 + 
   1.231 +-safe_finger: safe_finger.o $(LIB)
   1.232 +-	$(CC) $(CFLAGS) -o $@ safe_finger.o $(LIB) $(LIBS)
   1.233 ++safe_finger: safe_finger.o $(SHLIB)
   1.234 ++	$(CC) $(CFLAGS) -o $@ safe_finger.o $(SHLIBFLAGS)
   1.235 + 
   1.236 + TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
   1.237 + 
   1.238 +-tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
   1.239 +-	$(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(LIB) $(LIBS)
   1.240 ++tcpdmatch: $(TCPDMATCH_OBJ) $(SHLIB)
   1.241 ++	$(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(SHLIBFLAGS)
   1.242 + 
   1.243 +-try-from: try-from.o fakelog.o $(LIB)
   1.244 +-	$(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(LIB) $(LIBS)
   1.245 ++try-from: try-from.o fakelog.o $(SHLIB)
   1.246 ++	$(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(SHLIBFLAGS)
   1.247 + 
   1.248 + TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
   1.249 + 
   1.250 +-tcpdchk: $(TCPDCHK_OBJ) $(LIB)
   1.251 +-	$(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(LIB) $(LIBS)
   1.252 ++tcpdchk: $(TCPDCHK_OBJ) $(SHLIB)
   1.253 ++	$(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(SHLIBFLAGS)
   1.254 ++
   1.255 ++install: install-lib install-bin install-dev
   1.256 ++
   1.257 ++install-lib:
   1.258 ++	install -o root -g root -m 0755 $(SHLIB) ${DESTDIR}/usr/lib/
   1.259 ++	ln -sf $(notdir $(SHLIB)) ${DESTDIR}/usr/lib/$(notdir $(SHLIBSOMAJ))
   1.260 ++	ln -sf $(notdir $(SHLIBSOMAJ)) ${DESTDIR}/usr/lib/$(notdir $(SHLIBSO))
   1.261 ++
   1.262 ++install-bin:
   1.263 ++	install -o root -g root -m 0755 tcpd ${DESTDIR}/usr/sbin/
   1.264 ++	install -o root -g root -m 0755 tcpdchk ${DESTDIR}/usr/sbin/
   1.265 ++	install -o root -g root -m 0755 tcpdmatch ${DESTDIR}/usr/sbin/
   1.266 ++	install -o root -g root -m 0755 try-from ${DESTDIR}/usr/sbin/
   1.267 ++	install -o root -g root -m 0755 safe_finger ${DESTDIR}/usr/sbin/
   1.268 ++	install -o root -g root -m 0644 tcpd.8 ${DESTDIR}/usr/share/man/man8/
   1.269 ++	install -o root -g root -m 0644 tcpdchk.8 ${DESTDIR}/usr/share/man/man8/
   1.270 ++	install -o root -g root -m 0644 try-from.8 ${DESTDIR}/usr/share/man/man8/
   1.271 ++	install -o root -g root -m 0644 tcpdmatch.8 ${DESTDIR}/usr/share/man/man8/
   1.272 ++	install -o root -g root -m 0644 safe_finger.8 ${DESTDIR}/usr/share/man/man8/
   1.273 ++	install -o root -g root -m 0644 hosts_access.5 ${DESTDIR}/usr/share/man/man5/
   1.274 ++	install -o root -g root -m 0644 hosts_options.5 ${DESTDIR}/usr/share/man/man5/
   1.275 ++
   1.276 ++install-dev:
   1.277 ++	install -o root -g root -m 0644 hosts_access.3 ${DESTDIR}/usr/share/man/man3/
   1.278 ++	install -o root -g root -m 0644 tcpd.h ${DESTDIR}/usr/include/
   1.279 ++	install -o root -g root -m 0644 $(LIB) ${DESTDIR}/usr/lib/
   1.280 ++	ln -sf hosts_access.3 ${DESTDIR}/usr/share/man/man3/hosts_ctl.3
   1.281 ++	ln -sf hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_init.3
   1.282 ++	ln -sf hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_set.3
   1.283 + 
   1.284 + shar:	$(KIT)
   1.285 + 	@shar $(KIT)
   1.286 +@@ -739,7 +808,8 @@
   1.287 + 
   1.288 + clean:
   1.289 + 	rm -f tcpd miscd safe_finger tcpdmatch tcpdchk try-from *.[oa] core \
   1.290 +-	cflags
   1.291 ++	cflags libwrap*.so*
   1.292 ++	rm -rf shared
   1.293 + 
   1.294 + tidy:	clean
   1.295 + 	chmod -R a+r .
   1.296 +@@ -885,5 +955,6 @@
   1.297 + update.o: mystdarg.h
   1.298 + update.o: tcpd.h
   1.299 + vfprintf.o: cflags
   1.300 ++weak_symbols.o: tcpd.h
   1.301 + workarounds.o: cflags
   1.302 + workarounds.o: tcpd.h
   1.303 +diff -Naur tcp_wrappers_7.6/fix_options.c tcp_wrappers_7.6.gimli/fix_options.c
   1.304 +--- tcp_wrappers_7.6/fix_options.c	1997-04-07 19:29:19.000000000 -0500
   1.305 ++++ tcp_wrappers_7.6.gimli/fix_options.c	2002-01-07 08:50:19.000000000 -0600
   1.306 +@@ -35,7 +35,12 @@
   1.307 + #ifdef IP_OPTIONS
   1.308 +     unsigned char optbuf[BUFFER_SIZE / 3], *cp;
   1.309 +     char    lbuf[BUFFER_SIZE], *lp;
   1.310 ++#if !defined(__GLIBC__)
   1.311 +     int     optsize = sizeof(optbuf), ipproto;
   1.312 ++#else /* __GLIBC__ */
   1.313 ++    size_t  optsize = sizeof(optbuf);
   1.314 ++    int     ipproto;
   1.315 ++#endif /* __GLIBC__ */
   1.316 +     struct protoent *ip;
   1.317 +     int     fd = request->fd;
   1.318 +     unsigned int opt;
   1.319 +diff -Naur tcp_wrappers_7.6/hosts_access.3 tcp_wrappers_7.6.gimli/hosts_access.3
   1.320 +--- tcp_wrappers_7.6/hosts_access.3	1996-02-11 10:01:27.000000000 -0600
   1.321 ++++ tcp_wrappers_7.6.gimli/hosts_access.3	2002-01-07 08:50:19.000000000 -0600
   1.322 +@@ -3,7 +3,7 @@
   1.323 + hosts_access, hosts_ctl, request_init, request_set \- access control library
   1.324 + .SH SYNOPSIS
   1.325 + .nf
   1.326 +-#include "tcpd.h"
   1.327 ++#include <tcpd.h>
   1.328 + 
   1.329 + extern int allow_severity;
   1.330 + extern int deny_severity;
   1.331 +diff -Naur tcp_wrappers_7.6/hosts_access.5 tcp_wrappers_7.6.gimli/hosts_access.5
   1.332 +--- tcp_wrappers_7.6/hosts_access.5	1995-01-30 12:51:47.000000000 -0600
   1.333 ++++ tcp_wrappers_7.6.gimli/hosts_access.5	2002-01-07 08:50:19.000000000 -0600
   1.334 +@@ -8,9 +8,9 @@
   1.335 + impatient reader is encouraged to skip to the EXAMPLES section for a
   1.336 + quick introduction.
   1.337 + .PP
   1.338 +-An extended version of the access control language is described in the
   1.339 +-\fIhosts_options\fR(5) document. The extensions are turned on at
   1.340 +-program build time by building with -DPROCESS_OPTIONS.
   1.341 ++The extended version of the access control language is described in the
   1.342 ++\fIhosts_options\fR(5) document. \fBNote that this language supersedes
   1.343 ++the meaning of \fIshell_command\fB as documented below.\fR
   1.344 + .PP
   1.345 + In the following text, \fIdaemon\fR is the the process name of a
   1.346 + network daemon process, and \fIclient\fR is the name and/or address of
   1.347 +@@ -40,7 +40,7 @@
   1.348 + character. This permits you to break up long lines so that they are
   1.349 + easier to edit.
   1.350 + .IP \(bu
   1.351 +-Blank lines or lines that begin with a `#\' character are ignored.
   1.352 ++Blank lines or lines that begin with a `#' character are ignored.
   1.353 + This permits you to insert comments and whitespace so that the tables
   1.354 + are easier to read.
   1.355 + .IP \(bu
   1.356 +@@ -69,26 +69,33 @@
   1.357 + .SH PATTERNS
   1.358 + The access control language implements the following patterns:
   1.359 + .IP \(bu
   1.360 +-A string that begins with a `.\' character. A host name is matched if
   1.361 ++A string that begins with a `.' character. A host name is matched if
   1.362 + the last components of its name match the specified pattern.  For
   1.363 +-example, the pattern `.tue.nl\' matches the host name
   1.364 +-`wzv.win.tue.nl\'.
   1.365 ++example, the pattern `.tue.nl' matches the host name
   1.366 ++`wzv.win.tue.nl'.
   1.367 + .IP \(bu
   1.368 +-A string that ends with a `.\' character. A host address is matched if
   1.369 ++A string that ends with a `.' character. A host address is matched if
   1.370 + its first numeric fields match the given string.  For example, the
   1.371 +-pattern `131.155.\' matches the address of (almost) every host on the
   1.372 ++pattern `131.155.' matches the address of (almost) every host on the
   1.373 + Eind\%hoven University network (131.155.x.x).
   1.374 + .IP \(bu
   1.375 +-A string that begins with an `@\' character is treated as an NIS
   1.376 ++A string that begins with an `@' character is treated as an NIS
   1.377 + (formerly YP) netgroup name. A host name is matched if it is a host
   1.378 + member of the specified netgroup. Netgroup matches are not supported
   1.379 + for daemon process names or for client user names.
   1.380 + .IP \(bu
   1.381 +-An expression of the form `n.n.n.n/m.m.m.m\' is interpreted as a
   1.382 +-`net/mask\' pair. A host address is matched if `net\' is equal to the
   1.383 +-bitwise AND of the address and the `mask\'. For example, the net/mask
   1.384 +-pattern `131.155.72.0/255.255.254.0\' matches every address in the
   1.385 +-range `131.155.72.0\' through `131.155.73.255\'.
   1.386 ++An expression of the form `n.n.n.n/m.m.m.m' is interpreted as a
   1.387 ++`net/mask' pair. A host address is matched if `net' is equal to the
   1.388 ++bitwise AND of the address and the `mask'. For example, the net/mask
   1.389 ++pattern `131.155.72.0/255.255.254.0' matches every address in the
   1.390 ++range `131.155.72.0' through `131.155.73.255'.
   1.391 ++.IP \(bu
   1.392 ++A string that begins with a `/' character is treated as a file
   1.393 ++name. A host name or address is matched if it matches any host name
   1.394 ++or address pattern listed in the named file. The file format is
   1.395 ++zero or more lines with zero or more host name or address patterns
   1.396 ++separated by whitespace.  A file name pattern can be used anywhere
   1.397 ++a host name or address pattern can be used.
   1.398 + .SH WILDCARDS
   1.399 + The access control language supports explicit wildcards:
   1.400 + .IP ALL
   1.401 +@@ -115,19 +122,19 @@
   1.402 + .ne 6
   1.403 + .SH OPERATORS
   1.404 + .IP EXCEPT
   1.405 +-Intended use is of the form: `list_1 EXCEPT list_2\'; this construct
   1.406 ++Intended use is of the form: `list_1 EXCEPT list_2'; this construct
   1.407 + matches anything that matches \fIlist_1\fR unless it matches
   1.408 + \fIlist_2\fR.  The EXCEPT operator can be used in daemon_lists and in
   1.409 + client_lists. The EXCEPT operator can be nested: if the control
   1.410 +-language would permit the use of parentheses, `a EXCEPT b EXCEPT c\'
   1.411 +-would parse as `(a EXCEPT (b EXCEPT c))\'.
   1.412 ++language would permit the use of parentheses, `a EXCEPT b EXCEPT c'
   1.413 ++would parse as `(a EXCEPT (b EXCEPT c))'.
   1.414 + .br
   1.415 + .ne 6
   1.416 + .SH SHELL COMMANDS
   1.417 + If the first-matched access control rule contains a shell command, that
   1.418 + command is subjected to %<letter> substitutions (see next section).
   1.419 + The result is executed by a \fI/bin/sh\fR child process with standard
   1.420 +-input, output and error connected to \fI/dev/null\fR.  Specify an `&\'
   1.421 ++input, output and error connected to \fI/dev/null\fR.  Specify an `&'
   1.422 + at the end of the command if you do not want to wait until it has
   1.423 + completed.
   1.424 + .PP
   1.425 +@@ -159,7 +166,7 @@
   1.426 + .IP %u
   1.427 + The client user name (or "unknown").
   1.428 + .IP %%
   1.429 +-Expands to a single `%\' character.
   1.430 ++Expands to a single `%' character.
   1.431 + .PP
   1.432 + Characters in % expansions that may confuse the shell are replaced by
   1.433 + underscores.
   1.434 +@@ -243,9 +250,9 @@
   1.435 + less trustworthy. It is possible for an intruder to spoof both the
   1.436 + client connection and the IDENT lookup, although doing so is much
   1.437 + harder than spoofing just a client connection. It may also be that
   1.438 +-the client\'s IDENT server is lying.
   1.439 ++the client's IDENT server is lying.
   1.440 + .PP
   1.441 +-Note: IDENT lookups don\'t work with UDP services. 
   1.442 ++Note: IDENT lookups don't work with UDP services. 
   1.443 + .SH EXAMPLES
   1.444 + The language is flexible enough that different types of access control
   1.445 + policy can be expressed with a minimum of fuss. Although the language
   1.446 +@@ -285,7 +292,7 @@
   1.447 + .br
   1.448 + ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
   1.449 + .PP
   1.450 +-The first rule permits access from hosts in the local domain (no `.\'
   1.451 ++The first rule permits access from hosts in the local domain (no `.'
   1.452 + in the host name) and from members of the \fIsome_netgroup\fP
   1.453 + netgroup.  The second rule permits access from all hosts in the
   1.454 + \fIfoobar.edu\fP domain (notice the leading dot), with the exception of
   1.455 +@@ -322,8 +329,8 @@
   1.456 + /etc/hosts.deny:
   1.457 + .in +3
   1.458 + .nf
   1.459 +-in.tftpd: ALL: (/some/where/safe_finger -l @%h | \\
   1.460 +-	/usr/ucb/mail -s %d-%h root) &
   1.461 ++in.tftpd: ALL: (/usr/sbin/safe_finger -l @%h | \\
   1.462 ++	/usr/bin/mail -s %d-%h root) &
   1.463 + .fi
   1.464 + .PP
   1.465 + The safe_finger command comes with the tcpd wrapper and should be
   1.466 +@@ -349,7 +356,7 @@
   1.467 + capacity of an internal buffer; when an access control rule is not
   1.468 + terminated by a newline character; when the result of %<letter>
   1.469 + expansion would overflow an internal buffer; when a system call fails
   1.470 +-that shouldn\'t.  All problems are reported via the syslog daemon.
   1.471 ++that shouldn't.  All problems are reported via the syslog daemon.
   1.472 + .SH FILES
   1.473 + .na
   1.474 + .nf
   1.475 +diff -Naur tcp_wrappers_7.6/hosts_access.c tcp_wrappers_7.6.gimli/hosts_access.c
   1.476 +--- tcp_wrappers_7.6/hosts_access.c	1997-02-11 19:13:23.000000000 -0600
   1.477 ++++ tcp_wrappers_7.6.gimli/hosts_access.c	2002-01-07 08:50:19.000000000 -0600
   1.478 +@@ -240,6 +240,26 @@
   1.479 +     }
   1.480 + }
   1.481 + 
   1.482 ++/* hostfile_match - look up host patterns from file */
   1.483 ++
   1.484 ++static int hostfile_match(path, host)
   1.485 ++char   *path;
   1.486 ++struct hosts_info *host;
   1.487 ++{
   1.488 ++    char    tok[BUFSIZ];
   1.489 ++    int     match = NO;
   1.490 ++    FILE   *fp;
   1.491 ++
   1.492 ++    if ((fp = fopen(path, "r")) != 0) {
   1.493 ++        while (fscanf(fp, "%s", tok) == 1 && !(match = host_match(tok, host)))
   1.494 ++            /* void */ ;
   1.495 ++        fclose(fp);
   1.496 ++    } else if (errno != ENOENT) {
   1.497 ++        tcpd_warn("open %s: %m", path);
   1.498 ++    }
   1.499 ++    return (match);
   1.500 ++}
   1.501 ++
   1.502 + /* host_match - match host name and/or address against pattern */
   1.503 + 
   1.504 + static int host_match(tok, host)
   1.505 +@@ -267,6 +287,8 @@
   1.506 + 	tcpd_warn("netgroup support is disabled");	/* not tcpd_jump() */
   1.507 + 	return (NO);
   1.508 + #endif
   1.509 ++    } else if (tok[0] == '/') {                         /* /file hack */
   1.510 ++        return (hostfile_match(tok, host));
   1.511 +     } else if (STR_EQ(tok, "KNOWN")) {		/* check address and name */
   1.512 + 	char   *name = eval_hostname(host);
   1.513 + 	return (STR_NE(eval_hostaddr(host), unknown) && HOSTNAME_KNOWN(name));
   1.514 +diff -Naur tcp_wrappers_7.6/hosts_options.5 tcp_wrappers_7.6.gimli/hosts_options.5
   1.515 +--- tcp_wrappers_7.6/hosts_options.5	1994-12-28 10:42:29.000000000 -0600
   1.516 ++++ tcp_wrappers_7.6.gimli/hosts_options.5	2002-01-07 08:50:19.000000000 -0600
   1.517 +@@ -58,12 +58,12 @@
   1.518 + Execute, in a child process, the specified shell command, after
   1.519 + performing the %<letter> expansions described in the hosts_access(5)
   1.520 + manual page.  The command is executed with stdin, stdout and stderr
   1.521 +-connected to the null device, so that it won\'t mess up the
   1.522 ++connected to the null device, so that it won't mess up the
   1.523 + conversation with the client host. Example:
   1.524 + .sp
   1.525 + .nf
   1.526 + .ti +3
   1.527 +-spawn (/some/where/safe_finger -l @%h | /usr/ucb/mail root) &
   1.528 ++spawn (/usr/sbin/safe_finger -l @%h | /usr/bin/mail root) &
   1.529 + .fi
   1.530 + .sp
   1.531 + executes, in a background child process, the shell command "safe_finger
   1.532 +diff -Naur tcp_wrappers_7.6/options.c tcp_wrappers_7.6.gimli/options.c
   1.533 +--- tcp_wrappers_7.6/options.c	1996-02-11 10:01:32.000000000 -0600
   1.534 ++++ tcp_wrappers_7.6.gimli/options.c	2002-01-07 08:50:19.000000000 -0600
   1.535 +@@ -473,6 +473,9 @@
   1.536 + #ifdef LOG_CRON
   1.537 +     "cron", LOG_CRON,
   1.538 + #endif
   1.539 ++#ifdef LOG_FTP
   1.540 ++    "ftp", LOG_FTP,
   1.541 ++#endif
   1.542 + #ifdef LOG_LOCAL0
   1.543 +     "local0", LOG_LOCAL0,
   1.544 + #endif
   1.545 +diff -Naur tcp_wrappers_7.6/percent_m.c tcp_wrappers_7.6.gimli/percent_m.c
   1.546 +--- tcp_wrappers_7.6/percent_m.c	1994-12-28 10:42:37.000000000 -0600
   1.547 ++++ tcp_wrappers_7.6.gimli/percent_m.c	2002-01-07 08:50:19.000000000 -0600
   1.548 +@@ -13,7 +13,7 @@
   1.549 + #include <string.h>
   1.550 + 
   1.551 + extern int errno;
   1.552 +-#ifndef SYS_ERRLIST_DEFINED
   1.553 ++#if !defined(SYS_ERRLIST_DEFINED) && !defined(HAVE_STRERROR)
   1.554 + extern char *sys_errlist[];
   1.555 + extern int sys_nerr;
   1.556 + #endif
   1.557 +@@ -29,11 +29,15 @@
   1.558 + 
   1.559 +     while (*bp = *cp)
   1.560 + 	if (*cp == '%' && cp[1] == 'm') {
   1.561 ++#ifdef HAVE_STRERROR
   1.562 ++            strcpy(bp, strerror(errno));
   1.563 ++#else
   1.564 + 	    if (errno < sys_nerr && errno > 0) {
   1.565 + 		strcpy(bp, sys_errlist[errno]);
   1.566 + 	    } else {
   1.567 + 		sprintf(bp, "Unknown error %d", errno);
   1.568 + 	    }
   1.569 ++#endif
   1.570 + 	    bp += strlen(bp);
   1.571 + 	    cp += 2;
   1.572 + 	} else {
   1.573 +diff -Naur tcp_wrappers_7.6/rfc931.c tcp_wrappers_7.6.gimli/rfc931.c
   1.574 +--- tcp_wrappers_7.6/rfc931.c	1995-01-02 09:11:34.000000000 -0600
   1.575 ++++ tcp_wrappers_7.6.gimli/rfc931.c	2002-01-07 08:50:19.000000000 -0600
   1.576 +@@ -33,7 +33,7 @@
   1.577 + 
   1.578 + int     rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
   1.579 + 
   1.580 +-static jmp_buf timebuf;
   1.581 ++static sigjmp_buf timebuf;
   1.582 + 
   1.583 + /* fsocket - open stdio stream on top of socket */
   1.584 + 
   1.585 +@@ -62,7 +62,7 @@
   1.586 + static void timeout(sig)
   1.587 + int     sig;
   1.588 + {
   1.589 +-    longjmp(timebuf, sig);
   1.590 ++    siglongjmp(timebuf, sig);
   1.591 + }
   1.592 + 
   1.593 + /* rfc931 - return remote user name, given socket structures */
   1.594 +@@ -99,7 +99,7 @@
   1.595 + 	 * Set up a timer so we won't get stuck while waiting for the server.
   1.596 + 	 */
   1.597 + 
   1.598 +-	if (setjmp(timebuf) == 0) {
   1.599 ++	if (sigsetjmp(timebuf,1) == 0) {
   1.600 + 	    signal(SIGALRM, timeout);
   1.601 + 	    alarm(rfc931_timeout);
   1.602 + 
   1.603 +diff -Naur tcp_wrappers_7.6/safe_finger.8 tcp_wrappers_7.6.gimli/safe_finger.8
   1.604 +--- tcp_wrappers_7.6/safe_finger.8	1969-12-31 18:00:00.000000000 -0600
   1.605 ++++ tcp_wrappers_7.6.gimli/safe_finger.8	2002-01-07 08:50:19.000000000 -0600
   1.606 +@@ -0,0 +1,34 @@
   1.607 ++.TH SAFE_FINGER 8 "21th June 1997" Linux "Linux Programmer's Manual"
   1.608 ++.SH NAME
   1.609 ++safe_finger \- finger client wrapper that protects against nasty stuff
   1.610 ++from finger servers
   1.611 ++.SH SYNOPSIS
   1.612 ++.B safe_finger [finger_options]
   1.613 ++.SH DESCRIPTION
   1.614 ++The
   1.615 ++.B safe_finger
   1.616 ++command protects against nasty stuff from finger servers. Use this
   1.617 ++program for automatic reverse finger probes from the
   1.618 ++.B tcp_wrapper
   1.619 ++.B (tcpd)
   1.620 ++, not the raw finger command. The
   1.621 ++.B safe_finger
   1.622 ++command makes sure that the finger client is not run with root
   1.623 ++privileges. It also runs the finger client with a defined PATH
   1.624 ++environment.
   1.625 ++.B safe_finger
   1.626 ++will also protect you from problems caused by the output of some
   1.627 ++finger servers. The problem: some programs may react to stuff in
   1.628 ++the first column. Other programs may get upset by thrash anywhere
   1.629 ++on a line. File systems may fill up as the finger server keeps
   1.630 ++sending data. Text editors may bomb out on extremely long lines.
   1.631 ++The finger server may take forever because it is somehow wedged.
   1.632 ++.B safe_finger
   1.633 ++takes care of all this badness.
   1.634 ++.SH SEE ALSO
   1.635 ++.BR hosts_access (5),
   1.636 ++.BR hosts_options (5),
   1.637 ++.BR tcpd (8)
   1.638 ++.SH AUTHOR
   1.639 ++Wietse Venema, Eindhoven University of Technology, The Netherlands.
   1.640 ++
   1.641 +diff -Naur tcp_wrappers_7.6/safe_finger.c tcp_wrappers_7.6.gimli/safe_finger.c
   1.642 +--- tcp_wrappers_7.6/safe_finger.c	1994-12-28 10:42:42.000000000 -0600
   1.643 ++++ tcp_wrappers_7.6.gimli/safe_finger.c	2002-01-07 08:50:19.000000000 -0600
   1.644 +@@ -26,21 +26,24 @@
   1.645 + #include <stdio.h>
   1.646 + #include <ctype.h>
   1.647 + #include <pwd.h>
   1.648 ++#include <syslog.h>
   1.649 + 
   1.650 + extern void exit();
   1.651 + 
   1.652 + /* Local stuff */
   1.653 + 
   1.654 +-char    path[] = "PATH=/bin:/usr/bin:/usr/ucb:/usr/bsd:/etc:/usr/etc:/usr/sbin";
   1.655 ++char    path[] = "PATH=/bin:/usr/bin:/sbin:/usr/sbin";
   1.656 + 
   1.657 + #define	TIME_LIMIT	60		/* Do not keep listinging forever */
   1.658 + #define	INPUT_LENGTH	100000		/* Do not keep listinging forever */
   1.659 + #define	LINE_LENGTH	128		/* Editors can choke on long lines */
   1.660 + #define	FINGER_PROGRAM	"finger"	/* Most, if not all, UNIX systems */
   1.661 + #define	UNPRIV_NAME	"nobody"	/* Preferred privilege level */
   1.662 +-#define	UNPRIV_UGID	32767		/* Default uid and gid */
   1.663 ++#define	UNPRIV_UGID	65534		/* Default uid and gid */
   1.664 + 
   1.665 + int     finger_pid;
   1.666 ++int	allow_severity = SEVERITY;
   1.667 ++int	deny_severity = LOG_WARNING;
   1.668 + 
   1.669 + void    cleanup(sig)
   1.670 + int     sig;
   1.671 +diff -Naur tcp_wrappers_7.6/scaffold.c tcp_wrappers_7.6.gimli/scaffold.c
   1.672 +--- tcp_wrappers_7.6/scaffold.c	1997-03-21 12:27:24.000000000 -0600
   1.673 ++++ tcp_wrappers_7.6.gimli/scaffold.c	2002-01-07 08:50:19.000000000 -0600
   1.674 +@@ -180,10 +180,12 @@
   1.675 + 
   1.676 + /* ARGSUSED */
   1.677 + 
   1.678 +-void    rfc931(request)
   1.679 +-struct request_info *request;
   1.680 ++void    rfc931(rmt_sin, our_sin, dest)
   1.681 ++struct sockaddr_in *rmt_sin;
   1.682 ++struct sockaddr_in *our_sin;
   1.683 ++char   *dest;
   1.684 + {
   1.685 +-    strcpy(request->user, unknown);
   1.686 ++    strcpy(dest, unknown);
   1.687 + }
   1.688 + 
   1.689 + /* check_path - examine accessibility */
   1.690 +diff -Naur tcp_wrappers_7.6/socket.c tcp_wrappers_7.6.gimli/socket.c
   1.691 +--- tcp_wrappers_7.6/socket.c	1997-03-21 12:27:25.000000000 -0600
   1.692 ++++ tcp_wrappers_7.6.gimli/socket.c	2002-01-07 08:50:19.000000000 -0600
   1.693 +@@ -76,7 +76,11 @@
   1.694 + {
   1.695 +     static struct sockaddr_in client;
   1.696 +     static struct sockaddr_in server;
   1.697 ++#if !defined (__GLIBC__)
   1.698 +     int     len;
   1.699 ++#else /* __GLIBC__ */
   1.700 ++    size_t  len;
   1.701 ++#endif /* __GLIBC__ */
   1.702 +     char    buf[BUFSIZ];
   1.703 +     int     fd = request->fd;
   1.704 + 
   1.705 +@@ -224,7 +228,11 @@
   1.706 + {
   1.707 +     char    buf[BUFSIZ];
   1.708 +     struct sockaddr_in sin;
   1.709 ++#if !defined(__GLIBC__)
   1.710 +     int     size = sizeof(sin);
   1.711 ++#else /* __GLIBC__ */
   1.712 ++    size_t  size = sizeof(sin);
   1.713 ++#endif /* __GLIBC__ */
   1.714 + 
   1.715 +     /*
   1.716 +      * Eat up the not-yet received datagram. Some systems insist on a
   1.717 +diff -Naur tcp_wrappers_7.6/tcpd.8 tcp_wrappers_7.6.gimli/tcpd.8
   1.718 +--- tcp_wrappers_7.6/tcpd.8	1996-02-21 09:39:16.000000000 -0600
   1.719 ++++ tcp_wrappers_7.6.gimli/tcpd.8	2002-01-07 08:50:19.000000000 -0600
   1.720 +@@ -94,7 +94,7 @@
   1.721 + .PP
   1.722 + The example assumes that the network daemons live in /usr/etc. On some
   1.723 + systems, network daemons live in /usr/sbin or in /usr/libexec, or have
   1.724 +-no `in.\' prefix to their name.
   1.725 ++no `in.' prefix to their name.
   1.726 + .SH EXAMPLE 2
   1.727 + This example applies when \fItcpd\fR expects that the network daemons
   1.728 + are left in their original place.
   1.729 +@@ -110,26 +110,26 @@
   1.730 + becomes:
   1.731 + .sp
   1.732 + .ti +5
   1.733 +-finger  stream  tcp  nowait  nobody  /some/where/tcpd     in.fingerd
   1.734 ++finger  stream  tcp  nowait  nobody  /usr/sbin/tcpd       in.fingerd
   1.735 + .sp
   1.736 + .fi
   1.737 + .PP
   1.738 + The example assumes that the network daemons live in /usr/etc. On some
   1.739 + systems, network daemons live in /usr/sbin or in /usr/libexec, the
   1.740 +-daemons have no `in.\' prefix to their name, or there is no userid
   1.741 ++daemons have no `in.' prefix to their name, or there is no userid
   1.742 + field in the inetd configuration file.
   1.743 + .PP
   1.744 + Similar changes will be needed for the other services that are to be
   1.745 +-covered by \fItcpd\fR.  Send a `kill -HUP\' to the \fIinetd\fR(8)
   1.746 ++covered by \fItcpd\fR.  Send a `kill -HUP' to the \fIinetd\fR(8)
   1.747 + process to make the changes effective. AIX users may also have to
   1.748 +-execute the `inetimp\' command.
   1.749 ++execute the `inetimp' command.
   1.750 + .SH EXAMPLE 3
   1.751 + In the case of daemons that do not live in a common directory ("secret"
   1.752 + or otherwise), edit the \fIinetd\fR configuration file so that it
   1.753 + specifies an absolute path name for the process name field. For example:
   1.754 + .nf
   1.755 + .sp
   1.756 +-    ntalk  dgram  udp  wait  root  /some/where/tcpd  /usr/local/lib/ntalkd
   1.757 ++    ntalk  dgram  udp  wait  root  /usr/sbin/tcpd  /usr/sbin/in.ntalkd
   1.758 + .sp
   1.759 + .fi
   1.760 + .PP
   1.761 +diff -Naur tcp_wrappers_7.6/tcpd.h tcp_wrappers_7.6.gimli/tcpd.h
   1.762 +--- tcp_wrappers_7.6/tcpd.h	1996-03-19 09:22:25.000000000 -0600
   1.763 ++++ tcp_wrappers_7.6.gimli/tcpd.h	2002-01-07 08:50:19.000000000 -0600
   1.764 +@@ -4,6 +4,25 @@
   1.765 +   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
   1.766 +   */
   1.767 + 
   1.768 ++#ifndef _TCPWRAPPERS_TCPD_H
   1.769 ++#define _TCPWRAPPERS_TCPD_H
   1.770 ++
   1.771 ++/* someone else may have defined this */
   1.772 ++#undef  __P
   1.773 ++
   1.774 ++/* use prototypes if we have an ANSI C compiler or are using C++ */
   1.775 ++#if defined(__STDC__) || defined(__cplusplus)
   1.776 ++#define __P(args)       args
   1.777 ++#else
   1.778 ++#define __P(args)       ()
   1.779 ++#endif
   1.780 ++
   1.781 ++/* Need definitions of struct sockaddr_in and FILE. */
   1.782 ++#include <netinet/in.h>
   1.783 ++#include <stdio.h>
   1.784 ++
   1.785 ++__BEGIN_DECLS
   1.786 ++
   1.787 + /* Structure to describe one communications endpoint. */
   1.788 + 
   1.789 + #define STRING_LENGTH	128		/* hosts, users, processes */
   1.790 +@@ -25,10 +44,10 @@
   1.791 +     char    pid[10];			/* access via eval_pid(request) */
   1.792 +     struct host_info client[1];		/* client endpoint info */
   1.793 +     struct host_info server[1];		/* server endpoint info */
   1.794 +-    void  (*sink) ();			/* datagram sink function or 0 */
   1.795 +-    void  (*hostname) ();		/* address to printable hostname */
   1.796 +-    void  (*hostaddr) ();		/* address to printable address */
   1.797 +-    void  (*cleanup) ();		/* cleanup function or 0 */
   1.798 ++    void  (*sink) __P((int));		/* datagram sink function or 0 */
   1.799 ++    void  (*hostname) __P((struct host_info *)); /* address to printable hostname */
   1.800 ++    void  (*hostaddr) __P((struct host_info *)); /* address to printable address */
   1.801 ++    void  (*cleanup) __P((struct request_info *)); /* cleanup function or 0 */
   1.802 +     struct netconfig *config;		/* netdir handle */
   1.803 + };
   1.804 + 
   1.805 +@@ -61,25 +80,30 @@
   1.806 + /* Global functions. */
   1.807 + 
   1.808 + #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
   1.809 +-extern void fromhost();			/* get/validate client host info */
   1.810 ++extern void fromhost __P((struct request_info *));	/* get/validate client host info */
   1.811 + #else
   1.812 + #define fromhost sock_host		/* no TLI support needed */
   1.813 + #endif
   1.814 + 
   1.815 +-extern int hosts_access();		/* access control */
   1.816 +-extern void shell_cmd();		/* execute shell command */
   1.817 +-extern char *percent_x();		/* do %<char> expansion */
   1.818 +-extern void rfc931();			/* client name from RFC 931 daemon */
   1.819 +-extern void clean_exit();		/* clean up and exit */
   1.820 +-extern void refuse();			/* clean up and exit */
   1.821 +-extern char *xgets();			/* fgets() on steroids */
   1.822 +-extern char *split_at();		/* strchr() and split */
   1.823 +-extern unsigned long dot_quad_addr();	/* restricted inet_addr() */
   1.824 ++extern void shell_cmd __P((char *));	/* execute shell command */
   1.825 ++extern char *percent_x __P((char *, int, char *, struct request_info *)); /* do %<char> expansion */
   1.826 ++extern void rfc931 __P((struct sockaddr_in *, struct sockaddr_in *, char *)); /* client name from RFC 931 daemon */
   1.827 ++extern void clean_exit __P((struct request_info *)); /* clean up and exit */
   1.828 ++extern void refuse __P((struct request_info *));	/* clean up and exit */
   1.829 ++extern char *xgets __P((char *, int, FILE *));	/* fgets() on steroids */
   1.830 ++extern char *split_at __P((char *, int));	/* strchr() and split */
   1.831 ++extern unsigned long dot_quad_addr __P((char *)); /* restricted inet_addr() */
   1.832 + 
   1.833 + /* Global variables. */
   1.834 + 
   1.835 ++#ifdef HAVE_WEAKSYMS
   1.836 ++extern int allow_severity __attribute__ ((weak)); /* for connection logging */
   1.837 ++extern int deny_severity __attribute__ ((weak)); /* for connection logging */
   1.838 ++#else
   1.839 + extern int allow_severity;		/* for connection logging */
   1.840 + extern int deny_severity;		/* for connection logging */
   1.841 ++#endif
   1.842 ++
   1.843 + extern char *hosts_allow_table;		/* for verification mode redirection */
   1.844 + extern char *hosts_deny_table;		/* for verification mode redirection */
   1.845 + extern int hosts_access_verbose;	/* for verbose matching mode */
   1.846 +@@ -92,9 +116,14 @@
   1.847 +   */
   1.848 + 
   1.849 + #ifdef __STDC__
   1.850 ++extern int hosts_access(struct request_info *request);
   1.851 ++extern int hosts_ctl(char *daemon, char *client_name, char *client_addr, 
   1.852 ++                     char *client_user);
   1.853 + extern struct request_info *request_init(struct request_info *,...);
   1.854 + extern struct request_info *request_set(struct request_info *,...);
   1.855 + #else
   1.856 ++extern int hosts_access();
   1.857 ++extern int hosts_ctl();
   1.858 + extern struct request_info *request_init();	/* initialize request */
   1.859 + extern struct request_info *request_set();	/* update request structure */
   1.860 + #endif
   1.861 +@@ -117,27 +146,31 @@
   1.862 +   * host_info structures serve as caches for the lookup results.
   1.863 +   */
   1.864 + 
   1.865 +-extern char *eval_user();		/* client user */
   1.866 +-extern char *eval_hostname();		/* printable hostname */
   1.867 +-extern char *eval_hostaddr();		/* printable host address */
   1.868 +-extern char *eval_hostinfo();		/* host name or address */
   1.869 +-extern char *eval_client();		/* whatever is available */
   1.870 +-extern char *eval_server();		/* whatever is available */
   1.871 ++extern char *eval_user __P((struct request_info *));	/* client user */
   1.872 ++extern char *eval_hostname __P((struct host_info *));	/* printable hostname */
   1.873 ++extern char *eval_hostaddr __P((struct host_info *));	/* printable host address */
   1.874 ++extern char *eval_hostinfo __P((struct host_info *));	/* host name or address */
   1.875 ++extern char *eval_client __P((struct request_info *));	/* whatever is available */
   1.876 ++extern char *eval_server __P((struct request_info *));	/* whatever is available */
   1.877 + #define eval_daemon(r)	((r)->daemon)	/* daemon process name */
   1.878 + #define eval_pid(r)	((r)->pid)	/* process id */
   1.879 + 
   1.880 + /* Socket-specific methods, including DNS hostname lookups. */
   1.881 + 
   1.882 +-extern void sock_host();		/* look up endpoint addresses */
   1.883 +-extern void sock_hostname();		/* translate address to hostname */
   1.884 +-extern void sock_hostaddr();		/* address to printable address */
   1.885 ++/* look up endpoint addresses */
   1.886 ++extern void sock_host __P((struct request_info *));
   1.887 ++/* translate address to hostname */
   1.888 ++extern void sock_hostname __P((struct host_info *));
   1.889 ++/* address to printable address */
   1.890 ++extern void sock_hostaddr __P((struct host_info *));
   1.891 ++
   1.892 + #define sock_methods(r) \
   1.893 + 	{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
   1.894 + 
   1.895 + /* The System V Transport-Level Interface (TLI) interface. */
   1.896 + 
   1.897 + #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
   1.898 +-extern void tli_host();			/* look up endpoint addresses etc. */
   1.899 ++extern void tli_host __P((struct request_info *));	/* look up endpoint addresses etc. */
   1.900 + #endif
   1.901 + 
   1.902 +  /*
   1.903 +@@ -178,7 +211,7 @@
   1.904 +   * behavior.
   1.905 +   */
   1.906 + 
   1.907 +-extern void process_options();		/* execute options */
   1.908 ++extern void process_options __P((char *, struct request_info *)); /* execute options */
   1.909 + extern int dry_run;			/* verification flag */
   1.910 + 
   1.911 + /* Bug workarounds. */
   1.912 +@@ -217,3 +250,7 @@
   1.913 + #define strtok	my_strtok
   1.914 + extern char *my_strtok();
   1.915 + #endif
   1.916 ++
   1.917 ++__END_DECLS
   1.918 ++
   1.919 ++#endif /* tcpd.h */
   1.920 +diff -Naur tcp_wrappers_7.6/tcpdchk.c tcp_wrappers_7.6.gimli/tcpdchk.c
   1.921 +--- tcp_wrappers_7.6/tcpdchk.c	1997-02-11 19:13:25.000000000 -0600
   1.922 ++++ tcp_wrappers_7.6.gimli/tcpdchk.c	2002-01-07 08:50:19.000000000 -0600
   1.923 +@@ -350,6 +350,8 @@
   1.924 + {
   1.925 +     if (pat[0] == '@') {
   1.926 + 	tcpd_warn("%s: daemon name begins with \"@\"", pat);
   1.927 ++    } else if (pat[0] == '/') {
   1.928 ++        tcpd_warn("%s: daemon name begins with \"/\"", pat);
   1.929 +     } else if (pat[0] == '.') {
   1.930 + 	tcpd_warn("%s: daemon name begins with dot", pat);
   1.931 +     } else if (pat[strlen(pat) - 1] == '.') {
   1.932 +@@ -382,6 +384,8 @@
   1.933 + {
   1.934 +     if (pat[0] == '@') {			/* @netgroup */
   1.935 + 	tcpd_warn("%s: user name begins with \"@\"", pat);
   1.936 ++    } else if (pat[0] == '/') {
   1.937 ++        tcpd_warn("%s: user name begins with \"/\"", pat);
   1.938 +     } else if (pat[0] == '.') {
   1.939 + 	tcpd_warn("%s: user name begins with dot", pat);
   1.940 +     } else if (pat[strlen(pat) - 1] == '.') {
   1.941 +@@ -402,8 +406,13 @@
   1.942 + static int check_host(pat)
   1.943 + char   *pat;
   1.944 + {
   1.945 ++    char    buf[BUFSIZ];
   1.946 +     char   *mask;
   1.947 +     int     addr_count = 1;
   1.948 ++    FILE   *fp;
   1.949 ++    struct tcpd_context saved_context;
   1.950 ++    char   *cp;
   1.951 ++    char   *wsp = " \t\r\n";
   1.952 + 
   1.953 +     if (pat[0] == '@') {			/* @netgroup */
   1.954 + #ifdef NO_NETGRENT
   1.955 +@@ -422,6 +431,21 @@
   1.956 + 	tcpd_warn("netgroup support disabled");
   1.957 + #endif
   1.958 + #endif
   1.959 ++    } else if (pat[0] == '/') {                 /* /path/name */
   1.960 ++        if ((fp = fopen(pat, "r")) != 0) {
   1.961 ++            saved_context = tcpd_context;
   1.962 ++            tcpd_context.file = pat;
   1.963 ++            tcpd_context.line = 0;
   1.964 ++            while (fgets(buf, sizeof(buf), fp)) {
   1.965 ++                tcpd_context.line++;
   1.966 ++                for (cp = strtok(buf, wsp); cp; cp = strtok((char *) 0, wsp))
   1.967 ++                    check_host(cp);
   1.968 ++            }
   1.969 ++            tcpd_context = saved_context;
   1.970 ++            fclose(fp);
   1.971 ++        } else if (errno != ENOENT) {
   1.972 ++            tcpd_warn("open %s: %m", pat);
   1.973 ++        }
   1.974 +     } else if (mask = split_at(pat, '/')) {	/* network/netmask */
   1.975 + 	if (dot_quad_addr(pat) == INADDR_NONE
   1.976 + 	    || dot_quad_addr(mask) == INADDR_NONE)
   1.977 +diff -Naur tcp_wrappers_7.6/try-from.8 tcp_wrappers_7.6.gimli/try-from.8
   1.978 +--- tcp_wrappers_7.6/try-from.8	1969-12-31 18:00:00.000000000 -0600
   1.979 ++++ tcp_wrappers_7.6.gimli/try-from.8	2002-01-07 08:50:19.000000000 -0600
   1.980 +@@ -0,0 +1,28 @@
   1.981 ++.TH TRY-FROM 8 "21th June 1997" Linux "Linux Programmer's Manual"
   1.982 ++.SH NAME
   1.983 ++try-from \- test program for the tcp_wrapper
   1.984 ++.SH SYNOPSIS
   1.985 ++.B try-from
   1.986 ++.SH DESCRIPTION
   1.987 ++The
   1.988 ++.B try-from
   1.989 ++command can be called via a remote shell command to find out
   1.990 ++if the hostname and address are properly recognized
   1.991 ++by the
   1.992 ++.B tcp_wrapper
   1.993 ++library, if username lookup works, and (SysV only) if the TLI
   1.994 ++on top of IP heuristics work. Diagnostics are reported through
   1.995 ++.BR syslog (3)
   1.996 ++and redirected to stderr.
   1.997 ++
   1.998 ++Example:
   1.999 ++
  1.1000 ++rsh host /some/where/try-from
  1.1001 ++
  1.1002 ++.SH SEE ALSO
  1.1003 ++.BR hosts_access (5),
  1.1004 ++.BR hosts_options (5),
  1.1005 ++.BR tcpd (8)
  1.1006 ++.SH AUTHOR
  1.1007 ++Wietse Venema, Eindhoven University of Technology, The Netherlands.
  1.1008 ++
  1.1009 +diff -Naur tcp_wrappers_7.6/weak_symbols.c tcp_wrappers_7.6.gimli/weak_symbols.c
  1.1010 +--- tcp_wrappers_7.6/weak_symbols.c	1969-12-31 18:00:00.000000000 -0600
  1.1011 ++++ tcp_wrappers_7.6.gimli/weak_symbols.c	2002-01-07 08:50:19.000000000 -0600
  1.1012 +@@ -0,0 +1,11 @@
  1.1013 ++ /*
  1.1014 ++  * @(#) weak_symbols.h 1.5 99/12/29 23:50
  1.1015 ++  * 
  1.1016 ++  * Author: Anthony Towns <ajt@debian.org>
  1.1017 ++  */
  1.1018 ++
  1.1019 ++#ifdef HAVE_WEAKSYMS
  1.1020 ++#include <syslog.h>
  1.1021 ++int deny_severity = LOG_WARNING;
  1.1022 ++int allow_severity = SEVERITY; 
  1.1023 ++#endif
  1.1024 +diff -Naur tcp_wrappers_7.6/workarounds.c tcp_wrappers_7.6.gimli/workarounds.c
  1.1025 +--- tcp_wrappers_7.6/workarounds.c	1996-03-19 09:22:26.000000000 -0600
  1.1026 ++++ tcp_wrappers_7.6.gimli/workarounds.c	2002-01-07 08:50:19.000000000 -0600
  1.1027 +@@ -163,7 +163,11 @@
  1.1028 + int     fix_getpeername(sock, sa, len)
  1.1029 + int     sock;
  1.1030 + struct sockaddr *sa;
  1.1031 ++#if !defined(__GLIBC__)
  1.1032 + int    *len;
  1.1033 ++#else /* __GLIBC__ */
  1.1034 ++size_t *len;
  1.1035 ++#endif /* __GLIBC__ */
  1.1036 + {
  1.1037 +     int     ret;
  1.1038 +     struct sockaddr_in *sin = (struct sockaddr_in *) sa;