--------------------- PatchSet 4123 Date: 2007/03/26 10:50:57 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Remainder of Masking fix that were overlooked in previous update. Members: include/IPAddress.h:1.1.2.5->1.1.2.6 lib/IPAddress.cc:1.1.2.7->1.1.2.8 Index: squid3/include/IPAddress.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/Attic/IPAddress.h,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid3/include/IPAddress.h 24 Mar 2007 05:07:02 -0000 1.1.2.5 +++ squid3/include/IPAddress.h 26 Mar 2007 10:50:57 -0000 1.1.2.6 @@ -1,5 +1,5 @@ /* - * $Id: IPAddress.h,v 1.1.2.5 2007/03/24 05:07:02 amosjeffries Exp $ + * $Id: IPAddress.h,v 1.1.2.6 2007/03/26 10:50:57 amosjeffries Exp $ */ #ifndef _INC_IPADDRESS_H #define _INC_IPADDRESS_H @@ -35,14 +35,14 @@ // default constructor. IPAddress(); IPAddress(const IPAddress &); - IPAddress(const hostent *); - IPAddress(const char*); IPAddress(const struct in_addr &); IPAddress(const struct sockaddr_in &); #ifdef USE_IPV6 IPAddress(const struct in6_addr &); IPAddress(const struct sockaddr_in6 &); #endif + IPAddress(const hostent *); + IPAddress(const char*); /// Default destructor. ~IPAddress(); /*@}*/ @@ -50,14 +50,14 @@ /** @name Assignment Operators */ /*@{*/ IPAddress& operator =(const IPAddress &s); - IPAddress& operator =(const struct hostent *s); - IPAddress& operator =(const char *s); IPAddress& operator =(struct sockaddr_in const &s); IPAddress& operator =(struct in_addr const &s); #ifdef USE_IPV6 IPAddress& operator =(struct in6_addr const &s); IPAddress& operator =(struct sockaddr_in6 const &s); #endif + bool operator =(const struct hostent *s); + bool operator =(const char *s); /*@}*/ /** @name Boolean Operators */ Index: squid3/lib/IPAddress.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/Attic/IPAddress.cc,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid3/lib/IPAddress.cc 24 Mar 2007 09:39:38 -0000 1.1.2.7 +++ squid3/lib/IPAddress.cc 26 Mar 2007 10:51:00 -0000 1.1.2.8 @@ -1,5 +1,5 @@ /* - * $Id: IPAddress.cc,v 1.1.2.7 2007/03/24 09:39:38 amosjeffries Exp $ + * $Id: IPAddress.cc,v 1.1.2.8 2007/03/26 10:51:00 amosjeffries Exp $ */ #include "IPAddress.h" @@ -247,13 +247,13 @@ operator=(s); } -IPAddress& IPAddress::operator =(const char* s) +bool IPAddress::operator =(const char* s) { - struct hostent *hp; + struct hostent *hp = NULL; if ((hp = gethostbyname(s)) == NULL) { fprintf(stderr, "IPAddress:::operator= : Given Bad IP '%s'\n", s); - return *this; + return false; } return operator=(hp->h_addr_list[0]); @@ -347,7 +347,7 @@ operator=(s); } -IPAddress& IPAddress::operator =(const struct hostent *s) +bool IPAddress::operator =(const struct hostent *s) { struct in_addr* ipv4 = NULL; struct in6_addr* ipv6 = NULL; @@ -363,22 +363,23 @@ switch(s->h_addrtype) { case AF_INET: - ipv4 = (in_addr*)s->h_addr_list[0]; + ipv4 = (in_addr*)(s->h_addr_list[0]); /* this */ operator=(*ipv4); break; case AF_INET6: - ipv6 = (in6_addr*)s->h_addr_list[0]; + ipv6 = (in6_addr*)(s->h_addr_list[0]); #ifdef USE_IPV6 /* this */ operator=(*ipv6); #else - fprintf(stderr, "IPAddress::operator= : Discarded IPv6 Address. Protocol disabled (temporary).\n"); + fprintf(stderr, "IPAddress::operator= : Discarded IPv6 Address. Protocol disabled (temporary).\n"); - // TODO see if there is another address in the list that might be usable ?? + // TODO see if there is another address in the list that might be usable ?? + return false; #endif break; } - return *this; + return true; } #ifdef _GLIBCXX_IOSTREAM