1 --- tcp-wrappers-7.6.orig/hosts_access.c
2 +++ tcp-wrappers-7.6/hosts_access.c
7 +/* hostfile_match - look up host patterns from file */
9 +static int hostfile_match(path, host)
11 +struct hosts_info *host;
17 + if ((fp = fopen(path, "r")) != 0) {
18 + while (fscanf(fp, "%s", tok) == 1 && !(match = host_match(tok, host)))
21 + } else if (errno != ENOENT) {
22 + tcpd_warn("open %s: %m", path);
27 /* host_match - match host name and/or address against pattern */
29 static int host_match(tok, host)
31 tcpd_warn("netgroup support is disabled"); /* not tcpd_jump() */
34 + } else if (tok[0] == '/') { /* /file hack */
35 + return (hostfile_match(tok, host));
36 } else if (STR_EQ(tok, "KNOWN")) { /* check address and name */
37 char *name = eval_hostname(host);
38 return (STR_NE(eval_hostaddr(host), unknown) && HOSTNAME_KNOWN(name));
39 --- tcp-wrappers-7.6.orig/tcpd.h
40 +++ tcp-wrappers-7.6/tcpd.h
42 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
45 +#ifndef _TCPWRAPPERS_TCPD_H
46 +#define _TCPWRAPPERS_TCPD_H
48 +/* someone else may have defined this */
51 +/* use prototypes if we have an ANSI C compiler or are using C++ */
52 +#if defined(__STDC__) || defined(__cplusplus)
53 +#define __P(args) args
58 +/* Need definitions of struct sockaddr_in and FILE. */
59 +#include <netinet/in.h>
64 /* Structure to describe one communications endpoint. */
66 #define STRING_LENGTH 128 /* hosts, users, processes */
68 char pid[10]; /* access via eval_pid(request) */
69 struct host_info client[1]; /* client endpoint info */
70 struct host_info server[1]; /* server endpoint info */
71 - void (*sink) (); /* datagram sink function or 0 */
72 - void (*hostname) (); /* address to printable hostname */
73 - void (*hostaddr) (); /* address to printable address */
74 - void (*cleanup) (); /* cleanup function or 0 */
75 + void (*sink) __P((int)); /* datagram sink function or 0 */
76 + void (*hostname) __P((struct host_info *)); /* address to printable hostname */
77 + void (*hostaddr) __P((struct host_info *)); /* address to printable address */
78 + void (*cleanup) __P((struct request_info *)); /* cleanup function or 0 */
79 struct netconfig *config; /* netdir handle */
83 /* Global functions. */
85 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
86 -extern void fromhost(); /* get/validate client host info */
87 +extern void fromhost __P((struct request_info *)); /* get/validate client host info */
89 #define fromhost sock_host /* no TLI support needed */
92 -extern int hosts_access(); /* access control */
93 -extern void shell_cmd(); /* execute shell command */
94 -extern char *percent_x(); /* do %<char> expansion */
95 -extern void rfc931(); /* client name from RFC 931 daemon */
96 -extern void clean_exit(); /* clean up and exit */
97 -extern void refuse(); /* clean up and exit */
98 -extern char *xgets(); /* fgets() on steroids */
99 -extern char *split_at(); /* strchr() and split */
100 -extern unsigned long dot_quad_addr(); /* restricted inet_addr() */
101 +extern void shell_cmd __P((char *)); /* execute shell command */
102 +extern char *percent_x __P((char *, int, char *, struct request_info *)); /* do %<char> expansion */
103 +extern void rfc931 __P((struct sockaddr_in *, struct sockaddr_in *, char *)); /* client name from RFC 931 daemon */
104 +extern void clean_exit __P((struct request_info *)); /* clean up and exit */
105 +extern void refuse __P((struct request_info *)); /* clean up and exit */
106 +extern char *xgets __P((char *, int, FILE *)); /* fgets() on steroids */
107 +extern char *split_at __P((char *, int)); /* strchr() and split */
108 +extern unsigned long dot_quad_addr __P((char *)); /* restricted inet_addr() */
110 /* Global variables. */
112 +#ifdef HAVE_WEAKSYMS
113 +extern int allow_severity __attribute__ ((weak)); /* for connection logging */
114 +extern int deny_severity __attribute__ ((weak)); /* for connection logging */
116 extern int allow_severity; /* for connection logging */
117 extern int deny_severity; /* for connection logging */
120 extern char *hosts_allow_table; /* for verification mode redirection */
121 extern char *hosts_deny_table; /* for verification mode redirection */
122 extern int hosts_access_verbose; /* for verbose matching mode */
127 +extern int hosts_access(struct request_info *request);
128 +extern int hosts_ctl(char *daemon, char *client_name, char *client_addr,
129 + char *client_user);
130 extern struct request_info *request_init(struct request_info *,...);
131 extern struct request_info *request_set(struct request_info *,...);
133 +extern int hosts_access();
134 +extern int hosts_ctl();
135 extern struct request_info *request_init(); /* initialize request */
136 extern struct request_info *request_set(); /* update request structure */
138 @@ -117,27 +146,31 @@
139 * host_info structures serve as caches for the lookup results.
142 -extern char *eval_user(); /* client user */
143 -extern char *eval_hostname(); /* printable hostname */
144 -extern char *eval_hostaddr(); /* printable host address */
145 -extern char *eval_hostinfo(); /* host name or address */
146 -extern char *eval_client(); /* whatever is available */
147 -extern char *eval_server(); /* whatever is available */
148 +extern char *eval_user __P((struct request_info *)); /* client user */
149 +extern char *eval_hostname __P((struct host_info *)); /* printable hostname */
150 +extern char *eval_hostaddr __P((struct host_info *)); /* printable host address */
151 +extern char *eval_hostinfo __P((struct host_info *)); /* host name or address */
152 +extern char *eval_client __P((struct request_info *)); /* whatever is available */
153 +extern char *eval_server __P((struct request_info *)); /* whatever is available */
154 #define eval_daemon(r) ((r)->daemon) /* daemon process name */
155 #define eval_pid(r) ((r)->pid) /* process id */
157 /* Socket-specific methods, including DNS hostname lookups. */
159 -extern void sock_host(); /* look up endpoint addresses */
160 -extern void sock_hostname(); /* translate address to hostname */
161 -extern void sock_hostaddr(); /* address to printable address */
162 +/* look up endpoint addresses */
163 +extern void sock_host __P((struct request_info *));
164 +/* translate address to hostname */
165 +extern void sock_hostname __P((struct host_info *));
166 +/* address to printable address */
167 +extern void sock_hostaddr __P((struct host_info *));
169 #define sock_methods(r) \
170 { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
172 /* The System V Transport-Level Interface (TLI) interface. */
174 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
175 -extern void tli_host(); /* look up endpoint addresses etc. */
176 +extern void tli_host __P((struct request_info *)); /* look up endpoint addresses etc. */
184 -extern void process_options(); /* execute options */
185 +extern void process_options __P((char *, struct request_info *)); /* execute options */
186 extern int dry_run; /* verification flag */
188 /* Bug workarounds. */
190 #define strtok my_strtok
191 extern char *my_strtok();
197 --- tcp-wrappers-7.6.orig/Makefile
198 +++ tcp-wrappers-7.6/Makefile
200 +GLIBC=$(shell grep -s -c __GLIBC__ /usr/include/features.h)
202 # @(#) Makefile 1.23 97/03/21 19:27:20
204 +# unset the HOSTNAME environment variable
209 @echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
211 @echo " generic (most bsd-ish systems with sys5 compatibility)"
212 @echo " 386bsd aix alpha apollo bsdos convex-ultranet dell-gcc dgux dgux543"
213 @echo " dynix epix esix freebsd hpux irix4 irix5 irix6 isc iunix"
214 - @echo " linux machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
215 + @echo " linux gnu machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
216 @echo " ptx-2.x ptx-generic pyramid sco sco-nis sco-od2 sco-os5 sinix sunos4"
217 @echo " sunos40 sunos5 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
220 # Ultrix 4.x SunOS 4.x ConvexOS 10.x Dynix/ptx
221 #REAL_DAEMON_DIR=/usr/etc
223 -# SysV.4 Solaris 2.x OSF AIX
224 -#REAL_DAEMON_DIR=/usr/sbin
225 +# SysV.4 Solaris 2.x OSF AIX Linux
226 +REAL_DAEMON_DIR=/usr/sbin
229 #REAL_DAEMON_DIR=/usr/libexec
230 @@ -141,10 +146,21 @@
231 LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
232 EXTRA_CFLAGS=-DSYS_ERRLIST_DEFINED VSYSLOG= all
239 @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
240 - LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
241 - NETGROUP= TLI= EXTRA_CFLAGS="-DBROKEN_SO_LINGER" all
242 + LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
243 + NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
244 + EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_WEAKSYMS -D_REENTRANT"
247 + @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
248 + LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
249 + NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
250 + EXTRA_CFLAGS="-DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT"
252 # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
253 hpux hpux8 hpux9 hpux10:
255 # the ones provided with this source distribution. The environ.c module
256 # implements setenv(), getenv(), and putenv().
261 #AUX_OBJ= environ.o strcasecmp.o
264 # host name aliases. Compile with -DSOLARIS_24_GETHOSTBYNAME_BUG to work
265 # around this. The workaround does no harm on other Solaris versions.
267 -BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
269 +#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
270 #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DINET_ADDR_BUG
271 #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DSOLARIS_24_GETHOSTBYNAME_BUG
274 # If your system supports NIS or YP-style netgroups, enable the following
275 # macro definition. Netgroups are used only for host access control.
277 -#NETGROUP= -DNETGROUP
278 +NETGROUP= -DNETGROUP
280 ###############################################################
281 # System dependencies: whether or not your system has vsyslog()
283 # Uncomment the next definition to turn on the language extensions
284 # (examples: allow, deny, banners, twist and spawn).
286 -#STYLE = -DPROCESS_OPTIONS # Enable language extensions.
287 +STYLE = -DPROCESS_OPTIONS # Enable language extensions.
289 ################################################################
290 # Optional: Changing the default disposition of logfile records
293 # The LOG_XXX names below are taken from the /usr/include/syslog.h file.
295 -FACILITY= LOG_MAIL # LOG_MAIL is what most sendmail daemons use
296 +FACILITY= LOG_DAEMON # LOG_MAIL is what most sendmail daemons use
298 # The syslog priority at which successful connections are logged.
301 # Paranoid mode implies hostname lookup. In order to disable hostname
302 # lookups altogether, see the next section.
304 -PARANOID= -DPARANOID
305 +#PARANOID= -DPARANOID
307 ########################################
308 # Optional: turning off hostname lookups
310 # In order to perform selective hostname lookups, disable paranoid
311 # mode (see previous section) and comment out the following definition.
313 -HOSTNAME= -DALWAYS_HOSTNAME
314 +#HOSTNAME= -DALWAYS_HOSTNAME
316 #############################################
317 # Optional: Turning on host ADDRESS checking
318 @@ -649,28 +666,46 @@
319 # source-routed traffic in the kernel. Examples: 4.4BSD derivatives,
320 # Solaris 2.x, and Linux. See your system documentation for details.
322 -# KILL_OPT= -DKILL_IP_OPTIONS
323 +KILL_OPT= -DKILL_IP_OPTIONS
325 ## End configuration options
326 ############################
328 # Protection against weird shells or weird make programs.
332 -.c.o:; $(CC) $(CFLAGS) -c $*.c
333 +.c.o:; $(CC) $(CFLAGS) -o $*.o -c $*.c
339 +SHLIB = shared/libwrap.so.$(SOMAJOR).$(SOMINOR)
340 +SHLIBSOMAJ= shared/libwrap.so.$(SOMAJOR)
341 +SHLIBSO = shared/libwrap.so
342 +SHLIBFLAGS = -Lshared -lwrap
344 -CFLAGS = -O -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
346 + $(CC) $(CFLAGS) $(SHCFLAGS) -c $< -o $@
348 +CFLAGS = -O2 -g -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
349 $(BUGS) $(SYSTYPE) $(AUTH) $(UMASK) \
350 -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
351 -DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
352 $(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS) $(DOT) \
353 $(VSYSLOG) $(HOSTNAME)
355 +SHLINKFLAGS = -shared -Xlinker -soname -Xlinker libwrap.so.$(SOMAJOR) -lc $(LIBS)
356 +SHCFLAGS = -fPIC -shared -D_REENTRANT
358 LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
359 hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
360 $(FROM_OBJ) fix_options.o socket.o tli.o workarounds.o \
361 update.o misc.o diag.o percent_m.o myvsyslog.o
363 +SHLIB_OBJ= $(addprefix shared/, $(LIB_OBJ));
367 KIT = README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
368 @@ -684,46 +719,78 @@
369 refuse.c tcpdchk.8 setenv.c inetcf.c inetcf.h scaffold.c \
370 scaffold.h tcpdmatch.8 README.NIS
374 -all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
375 +all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(LIB)
377 # Invalidate all object files when the compiler options (CFLAGS) have changed.
380 @set +e; test -n "$(REAL_DAEMON_DIR)" || { make; exit 1; }
381 - @set +e; echo $(CFLAGS) >/tmp/cflags.$$$$ ; \
382 - if cmp cflags /tmp/cflags.$$$$ ; \
383 - then rm /tmp/cflags.$$$$ ; \
384 - else mv /tmp/cflags.$$$$ cflags ; \
385 + @set +e; echo $(CFLAGS) >cflags.new ; \
386 + if cmp cflags cflags.new ; \
387 + then rm cflags.new ; \
388 + else mv cflags.new cflags ; \
389 fi >/dev/null 2>/dev/null
390 + @if [ ! -d shared ]; then mkdir shared; fi
394 $(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
398 - $(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
399 +$(SHLIB): $(SHLIB_OBJ)
401 + $(CC) -o $(SHLIB) $(SHLINKFLAGS) $(SHLIB_OBJ)
402 + ln -s $(notdir $(SHLIB)) $(SHLIBSOMAJ)
403 + ln -s $(notdir $(SHLIBSOMAJ)) $(SHLIBSO)
405 +tcpd: tcpd.o $(SHLIB)
406 + $(CC) $(CFLAGS) -o $@ tcpd.o $(SHLIBFLAGS)
408 -miscd: miscd.o $(LIB)
409 - $(CC) $(CFLAGS) -o $@ miscd.o $(LIB) $(LIBS)
410 +miscd: miscd.o $(SHLIB)
411 + $(CC) $(CFLAGS) -o $@ miscd.o $(SHLIBFLAGS)
413 -safe_finger: safe_finger.o $(LIB)
414 - $(CC) $(CFLAGS) -o $@ safe_finger.o $(LIB) $(LIBS)
415 +safe_finger: safe_finger.o $(SHLIB)
416 + $(CC) $(CFLAGS) -o $@ safe_finger.o $(SHLIBFLAGS)
418 TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
420 -tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
421 - $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(LIB) $(LIBS)
422 +tcpdmatch: $(TCPDMATCH_OBJ) $(SHLIB)
423 + $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(SHLIBFLAGS)
425 -try-from: try-from.o fakelog.o $(LIB)
426 - $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(LIB) $(LIBS)
427 +try-from: try-from.o fakelog.o $(SHLIB)
428 + $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(SHLIBFLAGS)
430 TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
432 -tcpdchk: $(TCPDCHK_OBJ) $(LIB)
433 - $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(LIB) $(LIBS)
434 +tcpdchk: $(TCPDCHK_OBJ) $(SHLIB)
435 + $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(SHLIBFLAGS)
437 +install: install-lib install-bin install-dev
440 + install -o root -g root -m 0644 $(SHLIB) ${DESTDIR}/lib/
441 + ln -s $(notdir $(SHLIB)) ${DESTDIR}/lib/$(notdir $(SHLIBSOMAJ))
444 + install -o root -g root -m 0755 tcpd ${DESTDIR}/usr/sbin/
445 + install -o root -g root -m 0755 tcpdchk ${DESTDIR}/usr/sbin/
446 + install -o root -g root -m 0755 tcpdmatch ${DESTDIR}/usr/sbin/
447 + install -o root -g root -m 0755 try-from ${DESTDIR}/usr/sbin/
448 + install -o root -g root -m 0755 safe_finger ${DESTDIR}/usr/sbin/
449 + install -o root -g root -m 0644 tcpd.8 ${DESTDIR}/usr/share/man/man8/
450 + install -o root -g root -m 0644 tcpdchk.8 ${DESTDIR}/usr/share/man/man8/
451 + install -o root -g root -m 0644 tcpdmatch.8 ${DESTDIR}/usr/share/man/man8/
452 + install -o root -g root -m 0644 hosts_access.5 ${DESTDIR}/usr/share/man/man5/
453 + install -o root -g root -m 0644 hosts_options.5 ${DESTDIR}/usr/share/man/man5/
456 + ln -s /lib/$(notdir $(SHLIBSOMAJ)) ${DESTDIR}/usr/lib/$(notdir $(SHLIBSO))
457 + install -o root -g root -m 0644 hosts_access.3 ${DESTDIR}/usr/share/man/man3/
458 + install -o root -g root -m 0644 tcpd.h ${DESTDIR}/usr/include/
459 + install -o root -g root -m 0644 $(LIB) ${DESTDIR}/usr/lib/
460 + ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/hosts_ctl.3
461 + ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_init.3
462 + ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_set.3
469 rm -f tcpd miscd safe_finger tcpdmatch tcpdchk try-from *.[oa] core \
471 + cflags libwrap*.so*
480 +weak_symbols.o: tcpd.h
481 workarounds.o: cflags
482 workarounds.o: tcpd.h
483 --- tcp-wrappers-7.6.orig/hosts_access.5
484 +++ tcp-wrappers-7.6/hosts_access.5
486 impatient reader is encouraged to skip to the EXAMPLES section for a
489 -An extended version of the access control language is described in the
490 -\fIhosts_options\fR(5) document. The extensions are turned on at
491 -program build time by building with -DPROCESS_OPTIONS.
492 +The extended version of the access control language is described in the
493 +\fIhosts_options\fR(5) document. \fBNote that this language supersedes
494 +the meaning of \fIshell_command\fB as documented below.\fR
496 In the following text, \fIdaemon\fR is the the process name of a
497 network daemon process, and \fIclient\fR is the name and/or address of
499 character. This permits you to break up long lines so that they are
502 -Blank lines or lines that begin with a `#\' character are ignored.
503 +Blank lines or lines that begin with a `#' character are ignored.
504 This permits you to insert comments and whitespace so that the tables
509 The access control language implements the following patterns:
511 -A string that begins with a `.\' character. A host name is matched if
512 +A string that begins with a `.' character. A host name is matched if
513 the last components of its name match the specified pattern. For
514 -example, the pattern `.tue.nl\' matches the host name
516 +example, the pattern `.tue.nl' matches the host name
519 -A string that ends with a `.\' character. A host address is matched if
520 +A string that ends with a `.' character. A host address is matched if
521 its first numeric fields match the given string. For example, the
522 -pattern `131.155.\' matches the address of (almost) every host on the
523 +pattern `131.155.' matches the address of (almost) every host on the
524 Eind\%hoven University network (131.155.x.x).
526 -A string that begins with an `@\' character is treated as an NIS
527 +A string that begins with an `@' character is treated as an NIS
528 (formerly YP) netgroup name. A host name is matched if it is a host
529 member of the specified netgroup. Netgroup matches are not supported
530 for daemon process names or for client user names.
532 -An expression of the form `n.n.n.n/m.m.m.m\' is interpreted as a
533 -`net/mask\' pair. A host address is matched if `net\' is equal to the
534 -bitwise AND of the address and the `mask\'. For example, the net/mask
535 -pattern `131.155.72.0/255.255.254.0\' matches every address in the
536 -range `131.155.72.0\' through `131.155.73.255\'.
537 +An expression of the form `n.n.n.n/m.m.m.m' is interpreted as a
538 +`net/mask' pair. A host address is matched if `net' is equal to the
539 +bitwise AND of the address and the `mask'. For example, the net/mask
540 +pattern `131.155.72.0/255.255.254.0' matches every address in the
541 +range `131.155.72.0' through `131.155.73.255'.
543 +A string that begins with a `/' character is treated as a file
544 +name. A host name or address is matched if it matches any host name
545 +or address pattern listed in the named file. The file format is
546 +zero or more lines with zero or more host name or address patterns
547 +separated by whitespace. A file name pattern can be used anywhere
548 +a host name or address pattern can be used.
550 The access control language supports explicit wildcards:
552 @@ -115,19 +122,19 @@
556 -Intended use is of the form: `list_1 EXCEPT list_2\'; this construct
557 +Intended use is of the form: `list_1 EXCEPT list_2'; this construct
558 matches anything that matches \fIlist_1\fR unless it matches
559 \fIlist_2\fR. The EXCEPT operator can be used in daemon_lists and in
560 client_lists. The EXCEPT operator can be nested: if the control
561 -language would permit the use of parentheses, `a EXCEPT b EXCEPT c\'
562 -would parse as `(a EXCEPT (b EXCEPT c))\'.
563 +language would permit the use of parentheses, `a EXCEPT b EXCEPT c'
564 +would parse as `(a EXCEPT (b EXCEPT c))'.
568 If the first-matched access control rule contains a shell command, that
569 command is subjected to %<letter> substitutions (see next section).
570 The result is executed by a \fI/bin/sh\fR child process with standard
571 -input, output and error connected to \fI/dev/null\fR. Specify an `&\'
572 +input, output and error connected to \fI/dev/null\fR. Specify an `&'
573 at the end of the command if you do not want to wait until it has
578 The client user name (or "unknown").
580 -Expands to a single `%\' character.
581 +Expands to a single `%' character.
583 Characters in % expansions that may confuse the shell are replaced by
586 less trustworthy. It is possible for an intruder to spoof both the
587 client connection and the IDENT lookup, although doing so is much
588 harder than spoofing just a client connection. It may also be that
589 -the client\'s IDENT server is lying.
590 +the client's IDENT server is lying.
592 -Note: IDENT lookups don\'t work with UDP services.
593 +Note: IDENT lookups don't work with UDP services.
595 The language is flexible enough that different types of access control
596 policy can be expressed with a minimum of fuss. Although the language
599 ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
601 -The first rule permits access from hosts in the local domain (no `.\'
602 +The first rule permits access from hosts in the local domain (no `.'
603 in the host name) and from members of the \fIsome_netgroup\fP
604 netgroup. The second rule permits access from all hosts in the
605 \fIfoobar.edu\fP domain (notice the leading dot), with the exception of
610 -in.tftpd: ALL: (/some/where/safe_finger -l @%h | \\
611 - /usr/ucb/mail -s %d-%h root) &
612 +in.tftpd: ALL: (/usr/sbin/safe_finger -l @%h | \\
613 + /usr/bin/mail -s %d-%h root) &
616 The safe_finger command comes with the tcpd wrapper and should be
618 capacity of an internal buffer; when an access control rule is not
619 terminated by a newline character; when the result of %<letter>
620 expansion would overflow an internal buffer; when a system call fails
621 -that shouldn\'t. All problems are reported via the syslog daemon.
622 +that shouldn't. All problems are reported via the syslog daemon.
626 --- tcp-wrappers-7.6.orig/rfc931.c
627 +++ tcp-wrappers-7.6/rfc931.c
630 int rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
632 -static jmp_buf timebuf;
633 +static sigjmp_buf timebuf;
635 /* fsocket - open stdio stream on top of socket */
638 static void timeout(sig)
641 - longjmp(timebuf, sig);
642 + siglongjmp(timebuf, sig);
645 /* rfc931 - return remote user name, given socket structures */
647 * Set up a timer so we won't get stuck while waiting for the server.
650 - if (setjmp(timebuf) == 0) {
651 + if (sigsetjmp(timebuf,1) == 0) {
652 signal(SIGALRM, timeout);
653 alarm(rfc931_timeout);
655 --- tcp-wrappers-7.6.orig/tcpd.8
656 +++ tcp-wrappers-7.6/tcpd.8
659 The example assumes that the network daemons live in /usr/etc. On some
660 systems, network daemons live in /usr/sbin or in /usr/libexec, or have
661 -no `in.\' prefix to their name.
662 +no `in.' prefix to their name.
664 This example applies when \fItcpd\fR expects that the network daemons
665 are left in their original place.
666 @@ -110,26 +110,26 @@
670 -finger stream tcp nowait nobody /some/where/tcpd in.fingerd
671 +finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd
675 The example assumes that the network daemons live in /usr/etc. On some
676 systems, network daemons live in /usr/sbin or in /usr/libexec, the
677 -daemons have no `in.\' prefix to their name, or there is no userid
678 +daemons have no `in.' prefix to their name, or there is no userid
679 field in the inetd configuration file.
681 Similar changes will be needed for the other services that are to be
682 -covered by \fItcpd\fR. Send a `kill -HUP\' to the \fIinetd\fR(8)
683 +covered by \fItcpd\fR. Send a `kill -HUP' to the \fIinetd\fR(8)
684 process to make the changes effective. AIX users may also have to
685 -execute the `inetimp\' command.
686 +execute the `inetimp' command.
688 In the case of daemons that do not live in a common directory ("secret"
689 or otherwise), edit the \fIinetd\fR configuration file so that it
690 specifies an absolute path name for the process name field. For example:
693 - ntalk dgram udp wait root /some/where/tcpd /usr/local/lib/ntalkd
694 + ntalk dgram udp wait root /usr/sbin/tcpd /usr/sbin/in.ntalkd
698 --- tcp-wrappers-7.6.orig/hosts_access.3
699 +++ tcp-wrappers-7.6/hosts_access.3
701 hosts_access, hosts_ctl, request_init, request_set \- access control library
707 extern int allow_severity;
708 extern int deny_severity;
709 --- tcp-wrappers-7.6.orig/options.c
710 +++ tcp-wrappers-7.6/options.c
719 "local0", LOG_LOCAL0,
721 --- tcp-wrappers-7.6.orig/fix_options.c
722 +++ tcp-wrappers-7.6/fix_options.c
725 unsigned char optbuf[BUFFER_SIZE / 3], *cp;
726 char lbuf[BUFFER_SIZE], *lp;
727 +#if !defined(__GLIBC__)
728 int optsize = sizeof(optbuf), ipproto;
729 +#else /* __GLIBC__ */
730 + size_t optsize = sizeof(optbuf);
732 +#endif /* __GLIBC__ */
734 int fd = request->fd;
736 --- tcp-wrappers-7.6.orig/workarounds.c
737 +++ tcp-wrappers-7.6/workarounds.c
739 int fix_getpeername(sock, sa, len)
742 +#if !defined(__GLIBC__)
744 +#else /* __GLIBC__ */
746 +#endif /* __GLIBC__ */
749 struct sockaddr_in *sin = (struct sockaddr_in *) sa;
750 --- tcp-wrappers-7.6.orig/socket.c
751 +++ tcp-wrappers-7.6/socket.c
754 static struct sockaddr_in client;
755 static struct sockaddr_in server;
756 +#if !defined (__GLIBC__)
758 +#else /* __GLIBC__ */
760 +#endif /* __GLIBC__ */
762 int fd = request->fd;
767 struct sockaddr_in sin;
768 +#if !defined(__GLIBC__)
769 int size = sizeof(sin);
770 +#else /* __GLIBC__ */
771 + size_t size = sizeof(sin);
772 +#endif /* __GLIBC__ */
775 * Eat up the not-yet received datagram. Some systems insist on a
776 --- tcp-wrappers-7.6.orig/safe_finger.c
777 +++ tcp-wrappers-7.6/safe_finger.c
788 -char path[] = "PATH=/bin:/usr/bin:/usr/ucb:/usr/bsd:/etc:/usr/etc:/usr/sbin";
789 +char path[] = "PATH=/bin:/usr/bin:/sbin:/usr/sbin";
791 #define TIME_LIMIT 60 /* Do not keep listinging forever */
792 #define INPUT_LENGTH 100000 /* Do not keep listinging forever */
793 #define LINE_LENGTH 128 /* Editors can choke on long lines */
794 #define FINGER_PROGRAM "finger" /* Most, if not all, UNIX systems */
795 #define UNPRIV_NAME "nobody" /* Preferred privilege level */
796 -#define UNPRIV_UGID 32767 /* Default uid and gid */
797 +#define UNPRIV_UGID 65534 /* Default uid and gid */
800 +int allow_severity = SEVERITY;
801 +int deny_severity = LOG_WARNING;
805 --- tcp-wrappers-7.6.orig/hosts_options.5
806 +++ tcp-wrappers-7.6/hosts_options.5
808 Execute, in a child process, the specified shell command, after
809 performing the %<letter> expansions described in the hosts_access(5)
810 manual page. The command is executed with stdin, stdout and stderr
811 -connected to the null device, so that it won\'t mess up the
812 +connected to the null device, so that it won't mess up the
813 conversation with the client host. Example:
817 -spawn (/some/where/safe_finger -l @%h | /usr/ucb/mail root) &
818 +spawn (/usr/sbin/safe_finger -l @%h | /usr/bin/mail root) &
821 executes, in a background child process, the shell command "safe_finger
822 --- tcp-wrappers-7.6.orig/tcpdchk.c
823 +++ tcp-wrappers-7.6/tcpdchk.c
827 tcpd_warn("%s: daemon name begins with \"@\"", pat);
828 + } else if (pat[0] == '/') {
829 + tcpd_warn("%s: daemon name begins with \"/\"", pat);
830 } else if (pat[0] == '.') {
831 tcpd_warn("%s: daemon name begins with dot", pat);
832 } else if (pat[strlen(pat) - 1] == '.') {
835 if (pat[0] == '@') { /* @netgroup */
836 tcpd_warn("%s: user name begins with \"@\"", pat);
837 + } else if (pat[0] == '/') {
838 + tcpd_warn("%s: user name begins with \"/\"", pat);
839 } else if (pat[0] == '.') {
840 tcpd_warn("%s: user name begins with dot", pat);
841 } else if (pat[strlen(pat) - 1] == '.') {
843 static int check_host(pat)
850 + struct tcpd_context saved_context;
852 + char *wsp = " \t\r\n";
854 if (pat[0] == '@') { /* @netgroup */
857 tcpd_warn("netgroup support disabled");
860 + } else if (pat[0] == '/') { /* /path/name */
861 + if ((fp = fopen(pat, "r")) != 0) {
862 + saved_context = tcpd_context;
863 + tcpd_context.file = pat;
864 + tcpd_context.line = 0;
865 + while (fgets(buf, sizeof(buf), fp)) {
866 + tcpd_context.line++;
867 + for (cp = strtok(buf, wsp); cp; cp = strtok((char *) 0, wsp))
870 + tcpd_context = saved_context;
872 + } else if (errno != ENOENT) {
873 + tcpd_warn("open %s: %m", pat);
875 } else if (mask = split_at(pat, '/')) { /* network/netmask */
876 if (dot_quad_addr(pat) == INADDR_NONE
877 || dot_quad_addr(mask) == INADDR_NONE)
878 --- tcp-wrappers-7.6.orig/percent_m.c
879 +++ tcp-wrappers-7.6/percent_m.c
884 -#ifndef SYS_ERRLIST_DEFINED
885 +#if !defined(SYS_ERRLIST_DEFINED) && !defined(HAVE_STRERROR)
886 extern char *sys_errlist[];
892 if (*cp == '%' && cp[1] == 'm') {
893 +#ifdef HAVE_STRERROR
894 + strcpy(bp, strerror(errno));
896 if (errno < sys_nerr && errno > 0) {
897 strcpy(bp, sys_errlist[errno]);
899 sprintf(bp, "Unknown error %d", errno);
905 --- tcp-wrappers-7.6.orig/scaffold.c
906 +++ tcp-wrappers-7.6/scaffold.c
907 @@ -180,10 +180,12 @@
911 -void rfc931(request)
912 -struct request_info *request;
913 +void rfc931(rmt_sin, our_sin, dest)
914 +struct sockaddr_in *rmt_sin;
915 +struct sockaddr_in *our_sin;
918 - strcpy(request->user, unknown);
919 + strcpy(dest, unknown);
922 /* check_path - examine accessibility */
923 --- tcp-wrappers-7.6.orig/weak_symbols.c
924 +++ tcp-wrappers-7.6/weak_symbols.c
927 + * @(#) weak_symbols.h 1.5 99/12/29 23:50
929 + * Author: Anthony Towns <ajt@debian.org>
932 +#ifdef HAVE_WEAKSYMS
934 +int deny_severity = LOG_WARNING;
935 +int allow_severity = SEVERITY;