--------------------- PatchSet 5290 Date: 2002/10/08 00:51:35 Author: rbcollins Branch: rbcollins_cxxtest Tag: (none) Log: extract method - icpDenyAccess Members: src/icp_v2.cc:1.1.2.9->1.1.2.10 src/icp_v3.cc:1.1.2.9->1.1.2.10 src/protos.h:1.63.2.13->1.63.2.14 Index: squid/src/icp_v2.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icp_v2.cc,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -r1.1.2.9 -r1.1.2.10 --- squid/src/icp_v2.cc 8 Oct 2002 00:40:42 -0000 1.1.2.9 +++ squid/src/icp_v2.cc 8 Oct 2002 00:51:35 -0000 1.1.2.10 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.cc,v 1.1.2.9 2002/10/08 00:40:42 rbcollins Exp $ + * $Id: icp_v2.cc,v 1.1.2.10 2002/10/08 00:51:35 rbcollins Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -228,6 +228,22 @@ icpUdpSend(fd, from, reply, icpLogFromICPCode(opcode), 0); } +void +icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd) +{ + debug(12, 2) ("icpDenyAccess: Access Denied for %s by %s.\n", + inet_ntoa(from->sin_addr), AclMatchedName); + if (clientdbCutoffDenied(from->sin_addr)) { + /* + * count this DENIED query in the clientdb, even though + * we're not sending an ICP reply... + */ + clientdbUpdate(from->sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0); + } else { + icpCreateAndSend(ICP_DENIED, 0, url, reqnum, 0, fd, from); + } +} + static void doV2Query(int fd, struct sockaddr_in from, char *buf, icp_common_t header) { @@ -255,17 +271,7 @@ checklist.request = icp_request; allow = aclCheckFast(Config.accessList.icp, &checklist); if (!allow) { - debug(12, 2) ("icpHandleIcpV2: Access Denied for %s by %s.\n", - inet_ntoa(from.sin_addr), AclMatchedName); - if (clientdbCutoffDenied(from.sin_addr)) { - /* - * count this DENIED query in the clientdb, even though - * we're not sending an ICP reply... - */ - clientdbUpdate(from.sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0); - } else { - icpCreateAndSend(ICP_DENIED, 0, url, header.reqnum, 0, fd, &from); - } + icpDenyAccess (&from, url, header.reqnum, fd); requestDestroy(icp_request); return; } Index: squid/src/icp_v3.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icp_v3.cc,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -r1.1.2.9 -r1.1.2.10 --- squid/src/icp_v3.cc 8 Oct 2002 00:40:42 -0000 1.1.2.9 +++ squid/src/icp_v3.cc 8 Oct 2002 00:51:35 -0000 1.1.2.10 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.cc,v 1.1.2.9 2002/10/08 00:40:42 rbcollins Exp $ + * $Id: icp_v3.cc,v 1.1.2.10 2002/10/08 00:51:35 rbcollins Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -72,17 +72,7 @@ checklist.request = icp_request; allow = aclCheckFast(Config.accessList.icp, &checklist); if (!allow) { - debug(12, 2) ("icpHandleIcpV3: Access Denied for %s by %s.\n", - inet_ntoa(from.sin_addr), AclMatchedName); - if (clientdbCutoffDenied(from.sin_addr)) { - /* - * count this DENIED query in the clientdb, even though - * we're not sending an ICP reply... - */ - clientdbUpdate(from.sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0); - } else { - icpCreateAndSend (ICP_DENIED, 0, url, header.reqnum,0,fd,&from); - } + icpDenyAccess (&from, url, header.reqnum, fd); requestDestroy(icp_request); return; } Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.63.2.13 retrieving revision 1.63.2.14 diff -u -r1.63.2.13 -r1.63.2.14 --- squid/src/protos.h 8 Oct 2002 00:40:42 -0000 1.63.2.13 +++ squid/src/protos.h 8 Oct 2002 00:51:35 -0000 1.63.2.14 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.63.2.13 2002/10/08 00:40:42 rbcollins Exp $ + * $Id: protos.h,v 1.63.2.14 2002/10/08 00:51:35 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -541,6 +541,7 @@ SQUIDCEXTERN int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int); SQUIDCEXTERN log_type icpLogFromICPCode(icp_opcode opcode); +void icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd); SQUIDCEXTERN PF icpHandleUdp; SQUIDCEXTERN PF icpUdpSendQueue; SQUIDCEXTERN PF httpAccept;