--------------------- PatchSet 5738 Date: 2007/09/24 02:15:46 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Add inet_ntop, inet_pton supporting functions. Misc other Fixes This patch fixes several compile errors that have appeared after a recent merge of code from 3-HEAD. It also adds support for inet_ntop and inet_pton on systems where they are not natively available. The ISC (Internet Software Corporation) version is used as it is provided free without copyright restrictions. Members: configure.in:1.63.2.59->1.63.2.60 include/IPAddress.h:1.1.2.38->1.1.2.39 lib/IPAddress.cc:1.1.2.70->1.1.2.71 lib/inet_ntop.c:1.1->1.1.2.1 lib/inet_pton.c:1.1->1.1.2.1 lib/rfc1035.c:1.5.2.22->1.5.2.23 lib/rfc3596.c:1.1.2.6->1.1.2.7 src/ACLIP.cc:1.8.2.45->1.8.2.46 src/dnsserver.cc:1.7.4.21->1.7.4.22 Index: squid3/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid3/configure.in,v retrieving revision 1.63.2.59 retrieving revision 1.63.2.60 diff -u -r1.63.2.59 -r1.63.2.60 --- squid3/configure.in 21 Sep 2007 12:34:13 -0000 1.63.2.59 +++ squid3/configure.in 24 Sep 2007 02:15:46 -0000 1.63.2.60 @@ -1,7 +1,7 @@ dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.63.2.59 2007/09/21 12:34:13 amosjeffries Exp $ +dnl $Id: configure.in,v 1.63.2.60 2007/09/24 02:15:46 amosjeffries Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AC_CONFIG_AUX_DIR(cfgaux) AC_CONFIG_SRCDIR([src/main.cc]) AM_INIT_AUTOMAKE([tar-ustar]) -AC_REVISION($Revision: 1.63.2.59 $)dnl +AC_REVISION($Revision: 1.63.2.60 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -2614,6 +2614,8 @@ AC_REPLACE_FUNCS(\ drand48 \ initgroups \ + inet_ntop \ + inet_pton \ getaddrinfo \ getnameinfo \ strerror \ Index: squid3/include/IPAddress.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/Attic/IPAddress.h,v retrieving revision 1.1.2.38 retrieving revision 1.1.2.39 diff -u -r1.1.2.38 -r1.1.2.39 --- squid3/include/IPAddress.h 23 Sep 2007 10:11:38 -0000 1.1.2.38 +++ squid3/include/IPAddress.h 24 Sep 2007 02:15:46 -0000 1.1.2.39 @@ -1,5 +1,5 @@ /* - * $Id: IPAddress.h,v 1.1.2.38 2007/09/23 10:11:38 serassio Exp $ + * $Id: IPAddress.h,v 1.1.2.39 2007/09/24 02:15:46 amosjeffries Exp $ * * DEBUG: section 14 IP Storage and Handling * AUTHOR: Amos Jeffries @@ -61,6 +61,8 @@ #include "getaddrinfo.h" #include "getnameinfo.h" +#include "inet_ntop.h" +#include "inet_pton.h" /* FreeBSD hack: * This OS has at least one version that defines these as private Index: squid3/lib/IPAddress.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/Attic/IPAddress.cc,v retrieving revision 1.1.2.70 retrieving revision 1.1.2.71 diff -u -r1.1.2.70 -r1.1.2.71 --- squid3/lib/IPAddress.cc 12 Sep 2007 12:52:50 -0000 1.1.2.70 +++ squid3/lib/IPAddress.cc 24 Sep 2007 02:15:47 -0000 1.1.2.71 @@ -1,5 +1,5 @@ /* - * $Id: IPAddress.cc,v 1.1.2.70 2007/09/12 12:52:50 amosjeffries Exp $ + * $Id: IPAddress.cc,v 1.1.2.71 2007/09/24 02:15:47 amosjeffries Exp $ * * DEBUG: section 14 IP Storage and Handling * AUTHOR: Amos Jeffries @@ -973,16 +973,16 @@ #if USE_IPV6 if( force == AF_INET6 || (force == AF_UNSPEC && IsIPv6()) ) { - inet_ntop(AF_INET6, &m_SocketAddr.sin6_addr, buf, blen); + xinet_ntop(AF_INET6, &m_SocketAddr.sin6_addr, buf, blen); } else if ( force == AF_INET || (force == AF_UNSPEC && IsIPv4()) ) { struct in_addr tmp; GetInAddr(tmp); - inet_ntop(AF_INET, &tmp, buf, blen); + xinet_ntop(AF_INET, &tmp, buf, blen); #else if ( force == AF_UNSPEC || (force == AF_INET && IsIPv4()) ) { - inet_ntop(AF_INET, &m_SocketAddr.sin_addr, buf, blen); + xinet_ntop(AF_INET, &m_SocketAddr.sin_addr, buf, blen); #endif } else { debugs(14,0,"WARNING: Corrupt IP Address details OR required to display in unknown format (" << --- /dev/null Sat Sep 29 00:19:47 2007 +++ squid3/lib/inet_ntop.c Sat Sep 29 00:19:47 2007 @@ -0,0 +1,246 @@ +/* + * Shamelessly duplicated from the bind9 public sources + * for use by the Squid Project under ISC written permission + * included "as found" below. + * + * Update/Maintenance History: + * + * 24-Sep-2007 : Copied from bind 9.3.3 + * - Added protection around libray headers + * - Altered configure checks + * - Un-hacked slightly to use system gethostbyname() + * + * Squid CVS $Id: inet_ntop.c,v 1.1.2.1 2007/09/24 02:15:47 amosjeffries Exp $ + * + * Original License and code follows. + */ + +#include "config.h" + +#ifndef HAVE_INET_NTOP + +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = "inet_ntop.c,v 1.1.2.1.8.2 2005/11/03 23:08:40 marka Exp"; +#endif /* LIBC_SCCS and not lint */ + +//AYJ: #include "port_before.h" + +#if HAVE_SYS_PARAM_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_SOCKET_H +#include +#endif + +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_INET_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif + +#if HAVE_ERRNO_H +#include +#endif +#if HAVE_STDIO_H +#include +#endif +#if HAVE_STRING_H +#include +#endif + +//AYJ: #include "port_after.h" + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size)); +static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size)); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +const char * +xinet_ntop(af, src, dst, size) + int af; + const void *src; + char *dst; + size_t size; +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + errno = EAFNOSUPPORT; + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + + if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(src, dst, size) + const u_char *src; + char *dst; + size_t size; +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + struct { int base, len; } best, cur; + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + best.len = 0; + cur.base = -1; + cur.len = 0; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && (best.len == 6 || + (best.len == 7 && words[7] != 0x0001) || + (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += SPRINTF((tp, "%x", words[i])); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +#endif /* HAVE_INET_NTOP */ --- /dev/null Sat Sep 29 00:19:47 2007 +++ squid3/lib/inet_pton.c Sat Sep 29 00:19:47 2007 @@ -0,0 +1,261 @@ +/* + * Shamelessly duplicated from the bind9 public sources + * for use by the Squid Project under ISC written permission + * included "as found" below. + * + * Update/Maintenance History: + * + * 24-Sep-2007 : Copied from bind 9.3.3 + * - Added protection around libray headers + * - Altered configure checks to import + * + * Squid CVS $Id: inet_pton.c,v 1.1.2.1 2007/09/24 02:15:47 amosjeffries Exp $ + * + * Original License and code follows. + */ + +#include "config.h" + +#ifndef HAVE_INET_PTON + +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = "inet_pton.c,v 1.2.206.2 2005/07/28 07:43:18 marka Exp"; +#endif /* LIBC_SCCS and not lint */ + +//AYJ: #include "port_before.h" + +#if HAVE_SYS_PARAM_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_SOCKET_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if ARPA_INET_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif +#if HAVE_STRING_H +#include +#endif +#if HAVE_ERRNO_H +#include +#endif + +//AYJ: #include "port_after.h" + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4 __P((const char *src, u_char *dst)); +static int inet_pton6 __P((const char *src, u_char *dst)); + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +xinet_pton(af, src, dst) + int af; + const char *src; + void *dst; +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: + return (inet_pton6(src, dst)); + default: + errno = EAFNOSUPPORT; + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(src, dst) + const char *src; + u_char *dst; +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + u_char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (saw_digit && *tp == 0) + return (0); + if (new > 255) + return (0); + *tp = new; + if (!saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} + +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(src, dst) + const char *src; + u_char *dst; +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, seen_xdigits; + u_int val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + seen_xdigits = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (++seen_xdigits > 4) + return (0); + continue; + } + if (ch == ':') { + curtok = src; + if (!seen_xdigits) { + if (colonp) + return (0); + colonp = tp; + continue; + } else if (*src == '\0') { + return (0); + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + seen_xdigits = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + seen_xdigits = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (seen_xdigits) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return (0); + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} + +#endif /* HAVE_INET_PTON */ Index: squid3/lib/rfc1035.c =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/rfc1035.c,v retrieving revision 1.5.2.22 retrieving revision 1.5.2.23 diff -u -r1.5.2.22 -r1.5.2.23 --- squid3/lib/rfc1035.c 23 Sep 2007 08:20:28 -0000 1.5.2.22 +++ squid3/lib/rfc1035.c 24 Sep 2007 02:15:47 -0000 1.5.2.23 @@ -1,6 +1,6 @@ /* - * $Id: rfc1035.c,v 1.5.2.22 2007/09/23 08:20:28 serassio Exp $ + * $Id: rfc1035.c,v 1.5.2.23 2007/09/24 02:15:47 amosjeffries Exp $ * * Low level DNS protocol routines * AUTHOR: Duane Wessels @@ -618,7 +618,7 @@ if (msg->ancount == 0) return 0; i = (unsigned int) msg->ancount; - recs = msg->answer = xcalloc(i, sizeof(*recs)); + recs = msg->answer = (rfc1035_rr*)xcalloc(i, sizeof(*recs)); for (j = 0; j < i; j++) { if (off >= sz) { /* corrupt packet */ RFC1035_UNPACK_DEBUG; Index: squid3/lib/rfc3596.c =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/Attic/rfc3596.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- squid3/lib/rfc3596.c 12 Sep 2007 12:52:50 -0000 1.1.2.6 +++ squid3/lib/rfc3596.c 24 Sep 2007 02:15:47 -0000 1.1.2.7 @@ -1,6 +1,6 @@ /* - * $Id: rfc3596.c,v 1.1.2.6 2007/09/12 12:52:50 amosjeffries Exp $ + * $Id: rfc3596.c,v 1.1.2.7 2007/09/24 02:15:47 amosjeffries Exp $ * * Low level DNS protocol routines * AUTHOR: Amos Jeffries, Rafael Martinez Torres @@ -264,7 +264,7 @@ ((struct sockaddr_in6 *)S)->sin6_family = AF_INET6; ((struct sockaddr_in6 *)S)->sin6_port = htons(atoi(argv[var+1])); - if( ! inet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) ) + if( ! xinet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) ) perror("listen address"); return 1; } @@ -277,7 +277,7 @@ ((struct sockaddr_in *)S)->sin_family = AF_INET; ((struct sockaddr_in *)S)->sin_port = htons(atoi(argv[var+1])); - if( ! inet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) ) + if( ! xinet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) ) perror("listen address"); return 1; } @@ -292,10 +292,10 @@ memset(buf, '\0', 512); sz = 512; - if (inet_pton(AF_INET6, input, &junk6)) { + if (xinet_pton(AF_INET6, input, &junk6)) { sid = rfc1035BuildPTRQuery6(junk6, buf, &sz); sidb=0; - } else if (inet_pton(AF_INET, input, &junk4)) { + } else if (xinet_pton(AF_INET, input, &junk4)) { sid = rfc1035BuildPTRQuery4(junk4, buf, &sz); sidb=0; } else { Index: squid3/src/ACLIP.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLIP.cc,v retrieving revision 1.8.2.45 retrieving revision 1.8.2.46 diff -u -r1.8.2.45 -r1.8.2.46 --- squid3/src/ACLIP.cc 21 Sep 2007 12:34:14 -0000 1.8.2.45 +++ squid3/src/ACLIP.cc 24 Sep 2007 02:15:47 -0000 1.8.2.46 @@ -1,5 +1,5 @@ /* - * $Id: ACLIP.cc,v 1.8.2.45 2007/09/21 12:34:14 amosjeffries Exp $ + * $Id: ACLIP.cc,v 1.8.2.46 2007/09/24 02:15:47 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -204,7 +204,7 @@ } /* dotted notation */ - if (safe_inet_addr(asc, mask)) + if (!(mask = asc)) return true; return false; Index: squid3/src/dnsserver.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dnsserver.cc,v retrieving revision 1.7.4.21 retrieving revision 1.7.4.22 diff -u -r1.7.4.21 -r1.7.4.22 --- squid3/src/dnsserver.cc 21 Sep 2007 09:08:25 -0000 1.7.4.21 +++ squid3/src/dnsserver.cc 24 Sep 2007 02:15:47 -0000 1.7.4.22 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.7.4.21 2007/09/21 09:08:25 amosjeffries Exp $ + * $Id: dnsserver.cc,v 1.7.4.22 2007/09/24 02:15:47 amosjeffries Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -224,10 +224,10 @@ /* annoying inet_ntop breaks the nice code by requiring the in*_addr */ switch(aiptr->ai_family) { case AF_INET: - inet_ntop(aiptr->ai_family, &((struct sockaddr_in*)aiptr->ai_addr)->sin_addr, ntoabuf, MAX_IPSTRLEN); + xinet_ntop(aiptr->ai_family, &((struct sockaddr_in*)aiptr->ai_addr)->sin_addr, ntoabuf, MAX_IPSTRLEN); break; case AF_INET6: - inet_ntop(aiptr->ai_family, &((struct sockaddr_in6*)aiptr->ai_addr)->sin6_addr, ntoabuf, MAX_IPSTRLEN); + xinet_ntop(aiptr->ai_family, &((struct sockaddr_in6*)aiptr->ai_addr)->sin6_addr, ntoabuf, MAX_IPSTRLEN); break; default: continue;