Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | |
| 3 | diff -uN tcp_wrappers_7.6/hosts_access.c tcp_wrappers_7.6.new/hosts_access.c |
| 4 | --- tcp_wrappers_7.6/hosts_access.c Mon May 20 14:00:56 2002 |
| 5 | +++ tcp_wrappers_7.6.new/hosts_access.c Mon May 20 14:25:05 2002 |
| 6 | @@ -448,6 +448,15 @@ |
| 7 | int len, mask_len, i = 0; |
| 8 | char ch; |
| 9 | |
| 10 | + /* |
| 11 | + * Behavior of getaddrinfo() against IPv4-mapped IPv6 address is |
| 12 | + * different between KAME and Solaris8. While KAME returns |
| 13 | + * AF_INET6, Solaris8 returns AF_INET. So, we avoid this here. |
| 14 | + */ |
| 15 | + if (STRN_EQ(string, "::ffff:", 7) |
| 16 | + && dot_quad_addr(string + 7) != INADDR_NONE) |
| 17 | + return (masked_match4(net_tok, mask_tok, string + 7)); |
| 18 | + |
| 19 | memset(&hints, 0, sizeof(hints)); |
| 20 | hints.ai_family = AF_INET6; |
| 21 | hints.ai_socktype = SOCK_STREAM; |
| 22 | @@ -457,13 +466,6 @@ |
| 23 | memcpy(&addr, res->ai_addr, sizeof(addr)); |
| 24 | freeaddrinfo(res); |
| 25 | |
| 26 | - if (IN6_IS_ADDR_V4MAPPED(&addr.sin6_addr)) { |
| 27 | - if ((*(u_int32_t *)&net.sin6_addr.s6_addr[12] = dot_quad_addr(net_tok)) == INADDR_NONE |
| 28 | - || (mask = dot_quad_addr(mask_tok)) == INADDR_NONE) |
| 29 | - return (NO); |
| 30 | - return ((*(u_int32_t *)&addr.sin6_addr.s6_addr[12] & mask) == *(u_int32_t *)&net.sin6_addr.s6_addr[12]); |
| 31 | - } |
| 32 | - |
| 33 | /* match IPv6 address against netnumber/prefixlen */ |
| 34 | len = strlen(net_tok); |
| 35 | if (*net_tok != '[' || net_tok[len - 1] != ']') |
| 36 | diff -uN tcp_wrappers_7.6/socket.c tcp_wrappers_7.6.new/socket.c |
| 37 | --- tcp_wrappers_7.6/socket.c Mon May 20 13:48:35 2002 |
| 38 | +++ tcp_wrappers_7.6.new/socket.c Mon May 20 14:22:27 2002 |
| 39 | @@ -228,7 +228,7 @@ |
| 40 | hints.ai_family = sin->sa_family; |
| 41 | hints.ai_socktype = SOCK_STREAM; |
| 42 | hints.ai_flags = AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST; |
| 43 | - if ((err = getaddrinfo(host->name, NULL, &hints, &res0) == 0)) { |
| 44 | + if ((err = getaddrinfo(host->name, NULL, &hints, &res0)) == 0) { |
| 45 | freeaddrinfo(res0); |
| 46 | res0 = NULL; |
| 47 | tcpd_warn("host name/name mismatch: " |