e615632
diff -up tcp_wrappers_7.6/fix_options.c.patch9 tcp_wrappers_7.6/fix_options.c
e615632
--- tcp_wrappers_7.6/fix_options.c.patch9	1997-04-08 02:29:19.000000000 +0200
e615632
+++ tcp_wrappers_7.6/fix_options.c	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -11,6 +11,9 @@ static char sccsid[] = "@(#) fix_options
cvsdist 0fce7bf
 
cvsdist 0fce7bf
 #include <sys/types.h>
cvsdist 0fce7bf
 #include <sys/param.h>
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+#include <sys/socket.h>
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
 #include <netinet/in.h>
cvsdist 0fce7bf
 #include <netinet/in_systm.h>
cvsdist 0fce7bf
 #include <netinet/ip.h>
e615632
@@ -41,6 +44,22 @@ struct request_info *request;
cvsdist 0fce7bf
     unsigned int opt;
cvsdist 0fce7bf
     int     optlen;
cvsdist 0fce7bf
     struct in_addr dummy;
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+    struct sockaddr_storage ss;
cvsdist 0fce7bf
+    int sslen;
cvsdist 0fce7bf
+
cvsdist 0fce7bf
+    /*
cvsdist 0fce7bf
+     * check if this is AF_INET socket
cvsdist 0fce7bf
+     * XXX IPv6 support?
cvsdist 0fce7bf
+     */
cvsdist 0fce7bf
+    sslen = sizeof(ss);
cvsdist 0fce7bf
+    if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) {
cvsdist 0fce7bf
+	syslog(LOG_ERR, "getpeername: %m");
cvsdist 0fce7bf
+	clean_exit(request);
cvsdist 0fce7bf
+    }
cvsdist 0fce7bf
+    if (ss.ss_family != AF_INET)
cvsdist 0fce7bf
+	return;
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
 
cvsdist 0fce7bf
     if ((ip = getprotobyname("ip")) != 0)
cvsdist 0fce7bf
 	ipproto = ip->p_proto;
e615632
diff -up tcp_wrappers_7.6/hosts_access.5.patch9 tcp_wrappers_7.6/hosts_access.5
e615632
--- tcp_wrappers_7.6/hosts_access.5.patch9	2008-08-29 09:45:12.000000000 +0200
e615632
+++ tcp_wrappers_7.6/hosts_access.5	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -85,11 +85,18 @@ member of the specified netgroup. Netgro
cvsdist 0fce7bf
 for daemon process names or for client user names.
cvsdist 0fce7bf
 .IP \(bu
cvsdist 0fce7bf
 An expression of the form `n.n.n.n/m.m.m.m\' is interpreted as a
cvsdist 0fce7bf
-`net/mask\' pair. A host address is matched if `net\' is equal to the
cvsdist 0fce7bf
+`net/mask\' pair. An IPv4 host address is matched if `net\' is equal to the
cvsdist 0fce7bf
 bitwise AND of the address and the `mask\'. For example, the net/mask
cvsdist 0fce7bf
 pattern `131.155.72.0/255.255.254.0\' matches every address in the
cvsdist 0fce7bf
 range `131.155.72.0\' through `131.155.73.255\'.
e615632
 .IP \(bu
Viktor Hercinger cf076b1
+An expression of the form `[n:n:n:n:n:n:n:n/m]\' is interpreted as a
Viktor Hercinger cf076b1
+`[net/prefixlen]\' pair. An IPv6 host address is matched if
cvsdist 0fce7bf
+`prefixlen\' bits of `net\' is equal to the `prefixlen\' bits of the
Viktor Hercinger cf076b1
+address. For example, the [net/prefixlen] pattern
Viktor Hercinger cf076b1
+`[3ffe:505:2:1::/64]\' matches every address in the range
cvsdist 0fce7bf
+`3ffe:505:2:1::\' through `3ffe:505:2:1:ffff:ffff:ffff:ffff\'.
e615632
+.IP \(bu
cvsdist 0fce7bf
 A string that begins with a `/\' character is treated as a file
cvsdist 0fce7bf
 name. A host name or address is matched if it matches any host name
e615632
 or address pattern listed in the named file. The file format is
e615632
diff -up tcp_wrappers_7.6/inetcf.c.patch9 tcp_wrappers_7.6/inetcf.c
e615632
--- tcp_wrappers_7.6/inetcf.c.patch9	1997-02-12 02:13:24.000000000 +0100
e615632
+++ tcp_wrappers_7.6/inetcf.c	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -26,6 +26,9 @@ extern void exit();
cvsdist 0fce7bf
   * guesses. Shorter names follow longer ones.
cvsdist 0fce7bf
   */
cvsdist 0fce7bf
 char   *inet_files[] = {
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+    "/usr/local/v6/etc/inet6d.conf",	/* KAME */
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
     "/private/etc/inetd.conf",		/* NEXT */
cvsdist 0fce7bf
     "/etc/inet/inetd.conf",		/* SYSV4 */
cvsdist 0fce7bf
     "/usr/etc/inetd.conf",		/* IRIX?? */
e615632
diff -up tcp_wrappers_7.6/Makefile.patch9 tcp_wrappers_7.6/Makefile
Viktor Hercinger cf076b1
--- tcp_wrappers_7.6/Makefile.patch9	2013-01-25 10:53:33.891349937 +0100
Viktor Hercinger cf076b1
+++ tcp_wrappers_7.6/Makefile	2013-01-25 11:00:57.362801588 +0100
e615632
@@ -21,7 +21,7 @@ what:
e615632
 	@echo "	dynix epix esix freebsd hpux irix4 irix5 irix6 isc iunix"
e615632
 	@echo "	linux machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
e615632
 	@echo "	ptx-2.x ptx-generic pyramid sco sco-nis sco-od2 sco-os5 sinix sunos4"
e615632
-	@echo "	sunos40 sunos5 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
e615632
+	@echo "	sunos40 sunos5 solaris8 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
e615632
 	@echo "	uts215 uxp"
e615632
 	@echo
e615632
 	@echo "If none of these match your environment, edit the system"
Viktor Hercinger cf076b1
@@ -138,13 +138,25 @@ epix:
e615632
 
e615632
 freebsd:
e615632
 	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
e615632
+	LIBS="-L/usr/local/v6/lib -linet6" \
e615632
 	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
Viktor Hercinger cf076b1
-	EXTRA_CFLAGS=-DUSE_STRERROR VSYSLOG= all
Viktor Hercinger cf076b1
+	EXTRA_CFLAGS="-DUSE_STRERROR -Dss_family=__ss_family -Dss_len=__ss_len" VSYSLOG= all
e615632
+
e615632
+netbsd:
e615632
+	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
e615632
+	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
Viktor Hercinger cf076b1
+	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -Dss_family=__ss_family -Dss_len=__ss_len" VSYSLOG= all
e615632
 
e615632
 linux:
e615632
 	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
e615632
 	LIBS="-lnsl" RANLIB=ranlib ARFLAGS=rv AUX_OBJ= \
Viktor Hercinger cf076b1
-	NETGROUP="-DNETGROUP" TLI= EXTRA_CFLAGS="$(RPM_OPT_FLAGS) -DUSE_STRERROR -DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER" all
Viktor Hercinger cf076b1
+	NETGROUP="-DNETGROUP" TLI= EXTRA_CFLAGS="$(RPM_OPT_FLAGS) -DUSE_STRERROR -DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER -Dss_family=__ss_family -Dss_len=__ss_len" all
e615632
+
e615632
+linux-old:
e615632
+	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
e615632
+	LIBS="/usr/inet6/lib/libinet6.a -lresolv" \
e615632
+	RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o NETGROUP= TLI= \
Viktor Hercinger cf076b1
+	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER -Dss_family=sin6_family -Dsockaddr_storage=sockaddr_in6 -I/usr/inet6/include" all
e615632
 
e615632
 # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
e615632
 hpux hpux8 hpux9 hpux10:
Viktor Hercinger cf076b1
@@ -197,6 +209,13 @@ sunos5:
Viktor Hercinger cf076b1
 	BUGS="$(BUGS) -DSOLARIS_24_GETHOSTBYNAME_BUG" IPV6="$(IPV6)" \
Viktor Hercinger cf076b1
 	EXTRA_CFLAGS=-DUSE_STRERROR all
e615632
 
e615632
+# SunOS 5.8 is another SYSV4 variant, but has IPv6 support
e615632
+solaris8:
e615632
+	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
e615632
+	LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv VSYSLOG= \
e615632
+	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI \
Viktor Hercinger cf076b1
+	EXTRA_CFLAGS="-DNO_CLONE_DEVICE -DINT32_T" all
e615632
+
e615632
 # Generic SYSV40
e615632
 esix sysv4:
e615632
 	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
Viktor Hercinger cf076b1
@@ -392,7 +411,7 @@ AR	= ar
e615632
 # the ones provided with this source distribution. The environ.c module
e615632
 # implements setenv(), getenv(), and putenv().
e615632
 
e615632
-AUX_OBJ= setenv.o
e615632
+#AUX_OBJ= setenv.o
e615632
 #AUX_OBJ= environ.o
e615632
 #AUX_OBJ= environ.o strcasecmp.o
e615632
 
Viktor Hercinger cf076b1
@@ -455,7 +474,7 @@ AUX_OBJ= setenv.o
e615632
 # host name aliases. Compile with -DSOLARIS_24_GETHOSTBYNAME_BUG to work
e615632
 # around this. The workaround does no harm on other Solaris versions.
e615632
 
e615632
-BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
e615632
+#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
e615632
 #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DINET_ADDR_BUG
e615632
 #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DSOLARIS_24_GETHOSTBYNAME_BUG
e615632
 
Viktor Hercinger cf076b1
@@ -473,7 +492,7 @@ BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS
e615632
 # If your system supports vsyslog(), comment out the following definition.
e615632
 # If in doubt leave it in, it won't harm.
e615632
 
e615632
-VSYSLOG	= -Dvsyslog=myvsyslog
e615632
+#VSYSLOG	= -Dvsyslog=myvsyslog
e615632
 
Viktor Hercinger cf076b1
 ###############################################################
Viktor Hercinger cf076b1
 # System dependencies: whether or not your system has IPV6
Viktor Hercinger cf076b1
@@ -485,7 +504,7 @@ VSYSLOG	= -Dvsyslog=myvsyslog
Viktor Hercinger cf076b1
 
Viktor Hercinger cf076b1
 # If your system does not have getipnodebyname() but uses the obsolete
Viktor Hercinger cf076b1
 # gethostbyname2() instead, use this (AIX)
Viktor Hercinger cf076b1
-# IPV6 = -DHAVE_IPV6 -DUSE_GETHOSTBYNAME2
Viktor Hercinger cf076b1
+IPV6 = -DHAVE_IPV6 -DUSE_GETHOSTBYNAME2
Viktor Hercinger cf076b1
 
e615632
 # End of the system dependencies.
e615632
 #################################
e615632
diff -up tcp_wrappers_7.6/misc.c.patch9 tcp_wrappers_7.6/misc.c
e615632
--- tcp_wrappers_7.6/misc.c.patch9	1996-02-11 17:01:30.000000000 +0100
e615632
+++ tcp_wrappers_7.6/misc.c	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -58,9 +58,31 @@ int     delimiter;
cvsdist 0fce7bf
 {
cvsdist 0fce7bf
     char   *cp;
cvsdist 0fce7bf
 
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+    int bracket = 0;
cvsdist 0fce7bf
+
cvsdist 0fce7bf
+    for (cp = string; cp && *cp; cp++) {
cvsdist 0fce7bf
+	switch (*cp) {
cvsdist 0fce7bf
+	case '[':
cvsdist 0fce7bf
+	    bracket++;
cvsdist 0fce7bf
+	    break;
cvsdist 0fce7bf
+	case ']':
cvsdist 0fce7bf
+	    bracket--;
cvsdist 0fce7bf
+	    break;
cvsdist 0fce7bf
+	default:
cvsdist 0fce7bf
+	    if (bracket == 0 && *cp == delimiter) {
cvsdist 0fce7bf
+		*cp++ = 0;
cvsdist 0fce7bf
+		return cp;
cvsdist 0fce7bf
+	    }
cvsdist 0fce7bf
+	    break;
cvsdist 0fce7bf
+	}
cvsdist 0fce7bf
+    }
cvsdist 0fce7bf
+    return (NULL);
cvsdist 0fce7bf
+#else
cvsdist 0fce7bf
     if ((cp = strchr(string, delimiter)) != 0)
cvsdist 0fce7bf
 	*cp++ = 0;
cvsdist 0fce7bf
     return (cp);
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
 }
cvsdist 0fce7bf
 
cvsdist 0fce7bf
 /* dot_quad_addr - convert dotted quad to internal form */
e615632
diff -up tcp_wrappers_7.6/refuse.c.patch9 tcp_wrappers_7.6/refuse.c
e615632
--- tcp_wrappers_7.6/refuse.c.patch9	1994-12-28 17:42:40.000000000 +0100
e615632
+++ tcp_wrappers_7.6/refuse.c	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -25,7 +25,12 @@ static char sccsid[] = "@(#) refuse.c 1.
cvsdist 0fce7bf
 void    refuse(request)
cvsdist 0fce7bf
 struct request_info *request;
cvsdist 0fce7bf
 {
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+    syslog(deny_severity, "refused connect from %s (%s)",
cvsdist 0fce7bf
+	   eval_client(request), eval_hostaddr(request->client));
cvsdist 0fce7bf
+#else
cvsdist 0fce7bf
     syslog(deny_severity, "refused connect from %s", eval_client(request));
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
     clean_exit(request);
cvsdist 0fce7bf
     /* NOTREACHED */
cvsdist 0fce7bf
 }
e615632
diff -up tcp_wrappers_7.6/rfc931.c.patch9 tcp_wrappers_7.6/rfc931.c
Viktor Hercinger cf076b1
--- tcp_wrappers_7.6/rfc931.c.patch9	2004-05-04 16:01:01.000000000 +0200
Viktor Hercinger cf076b1
+++ tcp_wrappers_7.6/rfc931.c	2013-01-25 11:08:26.690292897 +0100
Viktor Hercinger cf076b1
@@ -94,6 +94,12 @@ char   *dest;
Viktor Hercinger cf076b1
      * sockets.
Viktor Hercinger cf076b1
      */
cvsdist 0fce7bf
 
cvsdist 0fce7bf
+    /* address family must be the same */
Viktor Hercinger cf076b1
+    if (SGFAM(rmt_sin) != SGFAM(our_sin)) {
cvsdist 0fce7bf
+	STRN_CPY(dest, result, STRING_LENGTH);
cvsdist 0fce7bf
+	return;
cvsdist 0fce7bf
+    }
cvsdist 0fce7bf
+
Viktor Hercinger cf076b1
     if ((fp = fsocket(SGFAM(rmt_sin), SOCK_STREAM, 0)) != 0) {
cvsdist 0fce7bf
 	setbuf(fp, (char *) 0);
cvsdist 0fce7bf
 
e615632
diff -up tcp_wrappers_7.6/tcpd.c.patch9 tcp_wrappers_7.6/tcpd.c
e615632
--- tcp_wrappers_7.6/tcpd.c.patch9	2008-08-29 09:45:12.000000000 +0200
e615632
+++ tcp_wrappers_7.6/tcpd.c	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -120,7 +120,12 @@ char  **argv;
e615632
 
e615632
     /* Report request and invoke the real daemon program. */
e615632
 
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
e615632
+    syslog(allow_severity, "connect from %s (%s)",
e615632
+	   eval_client(&request), eval_hostaddr(request.client));
e615632
+#else
e615632
     syslog(allow_severity, "connect from %s", eval_client(&request));
e615632
+#endif
e615632
     closelog();
e615632
     (void) execv(path, argv);
e615632
     syslog(LOG_ERR, "error: cannot execute %s: %m", path);
e615632
diff -up tcp_wrappers_7.6/workarounds.c.patch9 tcp_wrappers_7.6/workarounds.c
e615632
--- tcp_wrappers_7.6/workarounds.c.patch9	1996-03-19 16:22:26.000000000 +0100
e615632
+++ tcp_wrappers_7.6/workarounds.c	2008-08-29 09:45:12.000000000 +0200
e615632
@@ -166,11 +166,22 @@ struct sockaddr *sa;
cvsdist 0fce7bf
 int    *len;
cvsdist 0fce7bf
 {
cvsdist 0fce7bf
     int     ret;
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+    struct sockaddr *sin = sa;
cvsdist 0fce7bf
+#else
cvsdist 0fce7bf
     struct sockaddr_in *sin = (struct sockaddr_in *) sa;
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
 
cvsdist 0fce7bf
     if ((ret = getpeername(sock, sa, len)) >= 0
Viktor Hercinger cf076b1
+#ifdef HAVE_IPV6
cvsdist 0fce7bf
+	&& ((sin->su_si.si_family == AF_INET6
cvsdist 0fce7bf
+	     && IN6_IS_ADDR_UNSPECIFIED(&sin->su_sin6.sin6_addr))
cvsdist 0fce7bf
+	    || (sin->su_si.si_family == AF_INET
cvsdist 0fce7bf
+		&& sin->su_sin.sin_addr.s_addr == 0))) {
cvsdist 0fce7bf
+#else
cvsdist 0fce7bf
 	&& sa->sa_family == AF_INET
cvsdist 0fce7bf
 	&& sin->sin_addr.s_addr == 0) {
cvsdist 0fce7bf
+#endif
cvsdist 0fce7bf
 	errno = ENOTCONN;
cvsdist 0fce7bf
 	return (-1);
cvsdist 0fce7bf
     } else {