summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/14_cidr_support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/14_cidr_support.patch')
-rw-r--r--meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/14_cidr_support.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/14_cidr_support.patch b/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/14_cidr_support.patch
new file mode 100644
index 0000000000..0e1ecf5b4a
--- /dev/null
+++ b/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/14_cidr_support.patch
@@ -0,0 +1,66 @@
1diff -ruN tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
2--- tcp_wrappers_7.6.orig/hosts_access.5 2003-08-21 03:15:36.000000000 +0200
3+++ tcp_wrappers_7.6/hosts_access.5 2003-08-21 03:15:31.000000000 +0200
4@@ -90,6 +90,10 @@
5 pattern `131.155.72.0/255.255.254.0\' matches every address in the
6 range `131.155.72.0\' through `131.155.73.255\'.
7 .IP \(bu
8+An expression of the form `n.n.n.n/mm' is interpreted as a
9+`net/masklength' pair, where `mm' is the number of consecutive `1'
10+bits in the netmask applied to the `n.n.n.n' address.
11+.IP \(bu
12 An expression of the form `[n:n:n:n:n:n:n:n]/m\' is interpreted as a
13 `[net]/prefixlen\' pair. An IPv6 host address is matched if
14 `prefixlen\' bits of `net\' is equal to the `prefixlen\' bits of the
15diff -ruN tcp_wrappers_7.6.orig/hosts_access.c tcp_wrappers_7.6/hosts_access.c
16--- tcp_wrappers_7.6.orig/hosts_access.c 2003-08-21 03:15:36.000000000 +0200
17+++ tcp_wrappers_7.6/hosts_access.c 2003-08-21 03:09:30.000000000 +0200
18@@ -417,7 +417,8 @@
19 if ((addr = dot_quad_addr(string)) == INADDR_NONE)
20 return (NO);
21 if ((net = dot_quad_addr(net_tok)) == INADDR_NONE
22- || (mask = dot_quad_addr(mask_tok)) == INADDR_NONE) {
23+ || ((mask = dot_quad_addr(mask_tok)) == INADDR_NONE
24+ && (mask = cidr_mask_addr(mask_tok)) == 0)) {
25 #ifndef INET6
26 tcpd_warn("bad net/mask expression: %s/%s", net_tok, mask_tok);
27 #endif
28diff -ruN tcp_wrappers_7.6.orig/misc.c tcp_wrappers_7.6/misc.c
29--- tcp_wrappers_7.6.orig/misc.c 2003-08-21 03:15:36.000000000 +0200
30+++ tcp_wrappers_7.6/misc.c 2003-08-21 03:09:30.000000000 +0200
31@@ -107,3 +107,17 @@
32 }
33 return (runs == 4 ? inet_addr(str) : INADDR_NONE);
34 }
35+
36+/* cidr_mask_addr - convert cidr netmask length to internal form */
37+
38+unsigned long cidr_mask_addr(str)
39+char *str;
40+{
41+ int maskbits;
42+
43+ maskbits = atoi(str);
44+ if (maskbits < 1 || maskbits > 32)
45+ return (0);
46+ return htonl(0xFFFFFFFF << (32 - maskbits));
47+}
48+
49diff -ruN tcp_wrappers_7.6.orig/tcpdchk.c tcp_wrappers_7.6/tcpdchk.c
50--- tcp_wrappers_7.6.orig/tcpdchk.c 2003-08-21 03:15:36.000000000 +0200
51+++ tcp_wrappers_7.6/tcpdchk.c 2003-08-21 03:09:30.000000000 +0200
52@@ -497,12 +497,12 @@
53 int mask_len;
54
55 if ((dot_quad_addr(pat) == INADDR_NONE
56- || dot_quad_addr(mask) == INADDR_NONE)
57+ || dot_quad_addr(mask) == INADDR_NONE && cidr_mask_addr(mask) == 0)
58 && (!is_inet6_addr(pat)
59 || ((mask_len = atoi(mask)) < 0 || mask_len > 128)))
60 #else
61 if (dot_quad_addr(pat) == INADDR_NONE
62- || dot_quad_addr(mask) == INADDR_NONE)
63+ || dot_quad_addr(mask) == INADDR_NONE && cidr_mask_addr(mask) == 0)
64 #endif
65 tcpd_warn("%s/%s: bad net/mask pattern", pat, mask);
66 } else if (STR_EQ(pat, "FAIL")) { /* obsolete */