--------------------- PatchSet 4107 Date: 2007/03/21 08:55:09 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Rollout IPAddress class into ACLChecklist Members: src/ACLChecklist.cc:1.22.4.6->1.22.4.7 src/ACLChecklist.h:1.18.8.6->1.18.8.7 src/ACLDestinationDomain.cc:1.7.6.5->1.7.6.6 src/ACLMaxConnection.cc:1.4.6.1->1.4.6.2 src/ACLMaxUserIP.cc:1.5.6.2->1.5.6.3 src/ACLMyPort.cc:1.2->1.2.8.1 src/ACLSourceDomain.cc:1.3.12.2->1.3.12.3 src/AuthUserRequest.cc:1.2.4.7->1.2.4.8 src/AuthUserRequest.h:1.1.8.6->1.1.8.7 src/asn.cc:1.16.6.9->1.16.6.10 src/client_side.cc:1.68.2.8->1.68.2.9 src/external_acl.cc:1.37.6.3->1.37.6.4 src/forward.cc:1.35.4.9->1.35.4.10 src/neighbors.cc:1.23.4.9->1.23.4.10 src/tunnel.cc:1.13.4.3->1.13.4.4 Index: squid3/src/ACLChecklist.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLChecklist.cc,v retrieving revision 1.22.4.6 retrieving revision 1.22.4.7 diff -u -r1.22.4.6 -r1.22.4.7 --- squid3/src/ACLChecklist.cc 5 Jan 2007 16:57:51 -0000 1.22.4.6 +++ squid3/src/ACLChecklist.cc 21 Mar 2007 08:55:09 -0000 1.22.4.7 @@ -1,5 +1,5 @@ /* - * $Id: ACLChecklist.cc,v 1.22.4.6 2007/01/05 16:57:51 hno Exp $ + * $Id: ACLChecklist.cc,v 1.22.4.7 2007/03/21 08:55:09 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -315,7 +315,9 @@ cbdataFree(t); } -ACLChecklist::ACLChecklist() : accessList (NULL), my_port (0), request (NULL), +ACLChecklist::ACLChecklist() : + accessList (NULL), + request (NULL), reply (NULL), auth_user_request (NULL) #if SQUID_SNMP @@ -334,12 +336,9 @@ sourceDomainChecked_(false), lastACLResult_(false) { - - memset (&src_addr, '\0', sizeof (struct IN_ADDR)); - - memset (&dst_addr, '\0', sizeof (struct IN_ADDR)); - - memset (&my_addr, '\0', sizeof (struct IN_ADDR)); + my_addr.SetEmpty(); + src_addr.SetEmpty(); + dst_addr.SetEmpty(); rfc931[0] = '\0'; } @@ -525,7 +524,7 @@ checklist->request = HTTPMSGLOCK(request); checklist->src_addr = request->client_addr; checklist->my_addr = request->my_addr; - checklist->my_port = request->my_port; + checklist->my_addr.SetPort(request->my_port); } #if USE_IDENT Index: squid3/src/ACLChecklist.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLChecklist.h,v retrieving revision 1.18.8.6 retrieving revision 1.18.8.7 diff -u -r1.18.8.6 -r1.18.8.7 --- squid3/src/ACLChecklist.h 5 Jan 2007 16:57:51 -0000 1.18.8.6 +++ squid3/src/ACLChecklist.h 21 Mar 2007 08:55:09 -0000 1.18.8.7 @@ -1,6 +1,6 @@ /* - * $Id: ACLChecklist.h,v 1.18.8.6 2007/01/05 16:57:51 hno Exp $ + * $Id: ACLChecklist.h,v 1.18.8.7 2007/03/21 08:55:09 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -117,12 +117,16 @@ const acl_access *accessList; - struct IN_ADDR src_addr; +// struct IN_ADDR src_addr; + IPAddress src_addr; - struct IN_ADDR dst_addr; +// struct IN_ADDR dst_addr; + IPAddress dst_addr; + +// struct IN_ADDR my_addr; +// unsigned short my_port; + IPAddress my_addr; - struct IN_ADDR my_addr; - unsigned short my_port; HttpRequest *request; /* for acls that look at reply data */ HttpReply *reply; Index: squid3/src/ACLDestinationDomain.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLDestinationDomain.cc,v retrieving revision 1.7.6.5 retrieving revision 1.7.6.6 diff -u -r1.7.6.5 -r1.7.6.6 --- squid3/src/ACLDestinationDomain.cc 5 Jan 2007 16:57:51 -0000 1.7.6.5 +++ squid3/src/ACLDestinationDomain.cc 21 Mar 2007 08:55:10 -0000 1.7.6.6 @@ -1,5 +1,5 @@ /* - * $Id: ACLDestinationDomain.cc,v 1.7.6.5 2007/01/05 16:57:51 hno Exp $ + * $Id: ACLDestinationDomain.cc,v 1.7.6.6 2007/03/21 08:55:10 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -53,7 +53,8 @@ DestinationDomainLookup::checkForAsync(ACLChecklist *checklist)const { checklist->asyncInProgress(true); - fqdncache_nbgethostbyaddr(checklist->dst_addr, LookupDone, checklist); + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->dst_addr.GetInAddr(tmp); + fqdncache_nbgethostbyaddr(tmp, LookupDone, checklist); } void Index: squid3/src/ACLMaxConnection.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLMaxConnection.cc,v retrieving revision 1.4.6.1 retrieving revision 1.4.6.2 diff -u -r1.4.6.1 -r1.4.6.2 --- squid3/src/ACLMaxConnection.cc 5 Jan 2007 16:58:03 -0000 1.4.6.1 +++ squid3/src/ACLMaxConnection.cc 21 Mar 2007 08:55:10 -0000 1.4.6.2 @@ -1,5 +1,5 @@ /* - * $Id: ACLMaxConnection.cc,v 1.4.6.1 2007/01/05 16:58:03 hno Exp $ + * $Id: ACLMaxConnection.cc,v 1.4.6.2 2007/03/21 08:55:10 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -95,7 +95,8 @@ int ACLMaxConnection::match(ACLChecklist *checklist) { - return (clientdbEstablished(checklist->src_addr, 0) > limit ? 1 : 0); + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->src_addr.GetInAddr(tmp); + return (clientdbEstablished(tmp, 0) > limit ? 1 : 0); } wordlist * Index: squid3/src/ACLMaxUserIP.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLMaxUserIP.cc,v retrieving revision 1.5.6.2 retrieving revision 1.5.6.3 diff -u -r1.5.6.2 -r1.5.6.3 --- squid3/src/ACLMaxUserIP.cc 5 Jan 2007 16:58:05 -0000 1.5.6.2 +++ squid3/src/ACLMaxUserIP.cc 21 Mar 2007 08:55:10 -0000 1.5.6.3 @@ -1,5 +1,5 @@ /* - * $Id: ACLMaxUserIP.cc,v 1.5.6.2 2007/01/05 16:58:05 hno Exp $ + * $Id: ACLMaxUserIP.cc,v 1.5.6.3 2007/03/21 08:55:10 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -161,7 +161,8 @@ if ((ti = checklist->authenticated()) != 1) return ti; - ti = match(checklist->auth_user_request, checklist->src_addr); + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->src_addr.GetInAddr(tmp); + ti = match(checklist->auth_user_request, tmp); checklist->auth_user_request = NULL; Index: squid3/src/ACLMyPort.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLMyPort.cc,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -u -r1.2 -r1.2.8.1 --- squid3/src/ACLMyPort.cc 21 Oct 2003 02:12:44 -0000 1.2 +++ squid3/src/ACLMyPort.cc 21 Mar 2007 08:55:10 -0000 1.2.8.1 @@ -1,6 +1,6 @@ /* - * $Id: ACLMyPort.cc,v 1.2 2003/10/21 02:12:44 squidadm Exp $ + * $Id: ACLMyPort.cc,v 1.2.8.1 2007/03/21 08:55:10 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -51,7 +51,7 @@ int ACLMyPortStrategy::match (ACLData * &data, ACLChecklist *checklist) { - return data->match (checklist->my_port); + return data->match (checklist->my_addr.GetPort()); } ACLMyPortStrategy * Index: squid3/src/ACLSourceDomain.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLSourceDomain.cc,v retrieving revision 1.3.12.2 retrieving revision 1.3.12.3 diff -u -r1.3.12.2 -r1.3.12.3 --- squid3/src/ACLSourceDomain.cc 5 Jan 2007 16:58:15 -0000 1.3.12.2 +++ squid3/src/ACLSourceDomain.cc 21 Mar 2007 08:55:10 -0000 1.3.12.3 @@ -1,5 +1,5 @@ /* - * $Id: ACLSourceDomain.cc,v 1.3.12.2 2007/01/05 16:58:15 hno Exp $ + * $Id: ACLSourceDomain.cc,v 1.3.12.3 2007/03/21 08:55:10 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -52,7 +52,8 @@ SourceDomainLookup::checkForAsync(ACLChecklist *checklist)const { checklist->asyncInProgress(true); - fqdncache_nbgethostbyaddr(checklist->src_addr, LookupDone, checklist); + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->src_addr.GetInAddr(tmp); + fqdncache_nbgethostbyaddr(tmp, LookupDone, checklist); } void @@ -76,14 +77,16 @@ ACLSourceDomainStrategy::match (ACLData * &data, ACLChecklist *checklist) { const char *fqdn = NULL; - fqdn = fqdncache_gethostbyaddr(checklist->src_addr, FQDN_LOOKUP_IF_MISS); + char buf[MAX_IPSTRLEN]; + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->src_addr.GetInAddr(tmp); + fqdn = fqdncache_gethostbyaddr(tmp, FQDN_LOOKUP_IF_MISS); if (fqdn) { return data->match(fqdn); } else if (!checklist->sourceDomainChecked()) { /* FIXME: Using AclMatchedName here is not OO correct. Should find a way to the current acl */ debug(28, 3) ("aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n", - AclMatchedName, INET_NTOA(checklist->src_addr)); + AclMatchedName, checklist->src_addr.NtoA(buf,MAX_IPSTRLEN)); checklist->changeState(SourceDomainLookup::Instance()); return 0; } Index: squid3/src/AuthUserRequest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthUserRequest.cc,v retrieving revision 1.2.4.7 retrieving revision 1.2.4.8 diff -u -r1.2.4.7 -r1.2.4.8 --- squid3/src/AuthUserRequest.cc 5 Jan 2007 16:58:27 -0000 1.2.4.7 +++ squid3/src/AuthUserRequest.cc 21 Mar 2007 08:55:10 -0000 1.2.4.8 @@ -1,6 +1,6 @@ /* - * $Id: AuthUserRequest.cc,v 1.2.4.7 2007/01/05 16:58:27 hno Exp $ + * $Id: AuthUserRequest.cc,v 1.2.4.8 2007/03/21 08:55:10 amosjeffries Exp $ * * DO NOT MODIFY NEXT 2 LINES: * arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4 @@ -327,6 +327,7 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct IN_ADDR src_addr) { + char buf[MAX_IPSTRLEN]; const char *proxy_auth; assert(headertype != 0); @@ -404,8 +405,9 @@ AuthConfig * scheme = AuthConfig::Find(proxy_auth); if (!conn->auth_user_request->user() || conn->auth_user_request->user()->config != scheme) { +/* FIXME INET6 : drop temp conversion */ IPAddress tmp(src_addr); debug(29, 1) ("authenticateAuthenticate: Unexpected change of authentication scheme from '%s' to '%s' (client %s)\n", - conn->auth_user_request->user()->config->type(), proxy_auth, inet_ntoa(src_addr)); + conn->auth_user_request->user()->config->type(), proxy_auth, tmp.NtoA(buf,MAX_IPSTRLEN)); conn->auth_user_request->unlock(); conn->auth_user_request = NULL; conn->auth_type = AUTH_UNKNOWN; @@ -551,7 +553,7 @@ auth_acl_t -AuthUserRequest::tryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct IN_ADDR src_addr) +AuthUserRequest::tryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, IPAddress& src_addr) { /* If we have already been called, return the cached value */ auth_user_request_t *t = authTryGetUser (auth_user_request, conn, request); @@ -570,7 +572,8 @@ } /* ok, call the actual authenticator routine. */ - auth_acl_t result = authenticate(auth_user_request, headertype, request, conn, src_addr); + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; src_addr.GetInAddr(tmp); + auth_acl_t result = authenticate(auth_user_request, headertype, request, conn, tmp); t = authTryGetUser (auth_user_request, conn, request); Index: squid3/src/AuthUserRequest.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthUserRequest.h,v retrieving revision 1.1.8.6 retrieving revision 1.1.8.7 diff -u -r1.1.8.6 -r1.1.8.7 --- squid3/src/AuthUserRequest.h 5 Jan 2007 16:58:28 -0000 1.1.8.6 +++ squid3/src/AuthUserRequest.h 21 Mar 2007 08:55:11 -0000 1.1.8.7 @@ -1,6 +1,6 @@ /* - * $Id: AuthUserRequest.h,v 1.1.8.6 2007/01/05 16:58:28 hno Exp $ + * $Id: AuthUserRequest.h,v 1.1.8.7 2007/03/21 08:55:11 amosjeffries Exp $ * * DO NOT MODIFY NEXT 2 LINES: * arch-tag: 674533af-8b21-4641-b71a-74c4639072a0 @@ -78,7 +78,7 @@ virtual void user (AuthUser *aUser) {_auth_user=aUser;} - static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, HttpRequest *, ConnStateData::Pointer, struct IN_ADDR); + static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, HttpRequest *, ConnStateData::Pointer, IPAddress &); static void addReplyAuthHeader(HttpReply * rep, auth_user_request_t * auth_user_request, HttpRequest * request, int accelerated, int internal); AuthUserRequest(); Index: squid3/src/asn.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/asn.cc,v retrieving revision 1.16.6.9 retrieving revision 1.16.6.10 diff -u -r1.16.6.9 -r1.16.6.10 --- squid3/src/asn.cc 13 Mar 2007 07:00:31 -0000 1.16.6.9 +++ squid3/src/asn.cc 21 Mar 2007 08:55:11 -0000 1.16.6.10 @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.16.6.9 2007/03/13 07:00:31 amosjeffries Exp $ + * $Id: asn.cc,v 1.16.6.10 2007/03/21 08:55:11 amosjeffries Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -686,7 +686,8 @@ int ACLSourceASNStrategy::match (ACLData * &data, ACLChecklist *checklist) { - return data->match(checklist->src_addr); + /* FIXME INET6 : drop temp conversion */ struct IN_ADDR tmp; checklist->src_addr.GetInAddr(tmp); + return data->match(tmp); } ACLSourceASNStrategy * Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.68.2.8 retrieving revision 1.68.2.9 diff -u -r1.68.2.8 -r1.68.2.9 --- squid3/src/client_side.cc 21 Jan 2007 08:40:28 -0000 1.68.2.8 +++ squid3/src/client_side.cc 21 Mar 2007 08:55:11 -0000 1.68.2.9 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.68.2.8 2007/01/21 08:40:28 amosjeffries Exp $ + * $Id: client_side.cc,v 1.68.2.9 2007/03/21 08:55:11 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2798,11 +2798,9 @@ ACLChecklist identChecklist; - identChecklist.src_addr = ADDR_FROM_SA(details->peer); - - identChecklist.my_addr = ADDR_FROM_SA(details->me); + identChecklist.src_addr = details->peer; - identChecklist.my_port = ntohs(PORT_FROM_SA(details->me)); + identChecklist.my_addr = details->me; identChecklist.accessList = cbdataReference(Config.accessList.identLookup); Index: squid3/src/external_acl.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/external_acl.cc,v retrieving revision 1.37.6.3 retrieving revision 1.37.6.4 diff -u -r1.37.6.3 -r1.37.6.4 --- squid3/src/external_acl.cc 5 Jan 2007 16:59:18 -0000 1.37.6.3 +++ squid3/src/external_acl.cc 21 Mar 2007 08:55:12 -0000 1.37.6.4 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.37.6.3 2007/01/05 16:59:18 hno Exp $ + * $Id: external_acl.cc,v 1.37.6.4 2007/03/21 08:55:12 amosjeffries Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -779,7 +779,7 @@ #endif case _external_acl_format::EXT_ACL_SRC: - str = INET_NTOA(ch->src_addr); + str = ch->src_addr.NtoA(buf,sizeof(buf)); break; case _external_acl_format::EXT_ACL_SRCPORT: Index: squid3/src/forward.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/forward.cc,v retrieving revision 1.35.4.9 retrieving revision 1.35.4.10 diff -u -r1.35.4.9 -r1.35.4.10 --- squid3/src/forward.cc 1 Mar 2007 09:25:46 -0000 1.35.4.9 +++ squid3/src/forward.cc 21 Mar 2007 08:55:12 -0000 1.35.4.10 @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.35.4.9 2007/03/01 09:25:46 amosjeffries Exp $ + * $Id: forward.cc,v 1.35.4.10 2007/03/21 08:55:12 amosjeffries Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -191,7 +191,7 @@ ACLChecklist ch; ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_port = request->my_port; + ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); ch.accessList = cbdataReference(Config.accessList.miss); /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ @@ -1152,7 +1152,7 @@ { ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_port = request->my_port; + ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); } @@ -1167,7 +1167,7 @@ if (request) { ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_port = request->my_port; + ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); } Index: squid3/src/neighbors.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/neighbors.cc,v retrieving revision 1.23.4.9 retrieving revision 1.23.4.10 diff -u -r1.23.4.9 -r1.23.4.10 --- squid3/src/neighbors.cc 1 Mar 2007 09:25:47 -0000 1.23.4.9 +++ squid3/src/neighbors.cc 21 Mar 2007 08:55:12 -0000 1.23.4.10 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.23.4.9 2007/03/01 09:25:47 amosjeffries Exp $ + * $Id: neighbors.cc,v 1.23.4.10 2007/03/21 08:55:12 amosjeffries Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -185,7 +185,7 @@ checklist.my_addr = request->my_addr; - checklist.my_port = request->my_port; + checklist.my_addr.SetPort(request->my_port); checklist.request = HTTPMSGLOCK(request); Index: squid3/src/tunnel.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tunnel.cc,v retrieving revision 1.13.4.3 retrieving revision 1.13.4.4 diff -u -r1.13.4.3 -r1.13.4.4 --- squid3/src/tunnel.cc 5 Jan 2007 16:59:40 -0000 1.13.4.3 +++ squid3/src/tunnel.cc 21 Mar 2007 08:55:12 -0000 1.13.4.4 @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.13.4.3 2007/01/05 16:59:40 hno Exp $ + * $Id: tunnel.cc,v 1.13.4.4 2007/03/21 08:55:12 amosjeffries Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -595,7 +595,7 @@ ACLChecklist ch; ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; - ch.my_port = request->my_port; + ch.my_addr.SetPort(request->my_port); ch.request = HTTPMSGLOCK(request); ch.accessList = cbdataReference(Config.accessList.miss); /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */