]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Moved 'miss_access' ACL check to fwdStart()
authorwessels <>
Tue, 14 Jul 1998 12:12:58 +0000 (12:12 +0000)
committerwessels <>
Tue, 14 Jul 1998 12:12:58 +0000 (12:12 +0000)
src/asn.cc
src/client_side.cc
src/forward.cc
src/net_db.cc
src/peer_digest.cc
src/protos.h
src/urn.cc

index e0db099ec5b8648eaa76fe6c4d6d5d52b38a6a1a..016c0d3150b0b78e387bad53bfc6b35e40fa48f9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: asn.cc,v 1.39 1998/06/04 18:57:07 wessels Exp $
+ * $Id: asn.cc,v 1.40 1998/07/14 06:12:58 wessels Exp $
  *
  * DEBUG: section 53    AS Number handling
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -182,7 +182,7 @@ asnCacheStart(int as)
     if ((e = storeGet(k)) == NULL) {
        e = storeCreateEntry(asres, asres, 0, METHOD_GET);
        storeClientListAdd(e, asState);
-       fwdStart(-1, e, asState->request);
+       fwdStart(-1, e, asState->request, any_addr);
     } else {
        storeLockObject(e);
        storeClientListAdd(e, asState);
index c19b0e7de52706db2fc29ace45e54ccda187c549..fd7b5c4f9b89b4abbb46bebfb64ef670671e5ee3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.344 1998/07/09 19:21:00 rousskov Exp $
+ * $Id: client_side.cc,v 1.345 1998/07/14 06:12:58 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -269,7 +269,8 @@ clientProcessExpired(void *data)
     entry->refcount++;         /* EXPIRED CASE */
     http->entry = entry;
     http->out.offset = 0;
-    fwdStart(http->conn->fd, http->entry, http->request);
+    fwdStart(http->conn->fd, http->entry, http->request,
+       http->conn->peer.sin_addr);
     /* Register with storage manager to receive updates when data comes in. */
     if (entry->store_status == STORE_ABORTED)
        debug(33, 0) ("clientProcessExpired: entry->swap_status == STORE_ABORTED\n");
@@ -1996,28 +1997,12 @@ clientProcessMiss(clientHttpRequest * http)
        errorAppendEntry(http->entry, err);
        return;
     }
-    /*
-     * Check if this host is allowed to fetch MISSES from us (miss_access)
-     */
-    memset(&ch, '\0', sizeof(aclCheck_t));
-    ch.src_addr = http->conn->peer.sin_addr;
-    ch.request = r;
-    answer = aclCheckFast(Config.accessList.miss, &ch);
-    if (answer == 0) {
-       http->al.http.code = HTTP_FORBIDDEN;
-       err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
-       err->request = requestLink(r);
-       err->src_addr = http->conn->peer.sin_addr;
-       http->entry = clientCreateStoreEntry(http, r->method, 0);
-       errorAppendEntry(http->entry, err);
-       return;
-    }
     assert(http->out.offset == 0);
     http->entry = clientCreateStoreEntry(http, r->method, r->flags);
     http->entry->refcount++;
     if (http->flags.internal)
        r->protocol = PROTO_INTERNAL;
-    fwdStart(http->conn->fd, http->entry, r);
+    fwdStart(http->conn->fd, http->entry, r, http->conn->peer.sin_addr);
 }
 
 static clientHttpRequest *
index aa1b991b137abe5223dd65f52851dbad4007224e..787e66997087999adea66406305222ea20214926 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.16 1998/07/13 21:37:15 wessels Exp $
+ * $Id: forward.cc,v 1.17 1998/07/14 06:12:59 wessels Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -310,39 +310,52 @@ fwdDispatch(FwdState * fwdState)
 /* PUBLIC FUNCTIONS */
 
 void
-fwdStart(int fd, StoreEntry * entry, request_t * request)
+fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr peer_addr)
 {
     FwdState *fwdState;
-    debug(17, 3) ("fwdStart: '%s'\n", storeUrl(entry));
-    entry->mem_obj->request = requestLink(request);
-    entry->mem_obj->fd = fd;
-    switch (request->protocol) {
+    aclCheck_t ch;
+    int answer;
+    ErrorState *err;
+    /*      
+     * Check if this host is allowed to fetch MISSES from us (miss_access)
+     */
+    memset(&ch, '\0', sizeof(aclCheck_t));  
+    ch.src_addr = peer_addr;
+    ch.request = r;
+    answer = aclCheckFast(Config.accessList.miss, &ch);
+    if (answer == 0) {
+        err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
+        err->request = requestLink(r);
+        err->src_addr = peer_addr;
+        errorAppendEntry(e, err);
+        return;
+    }
+    debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
+    e->mem_obj->request = requestLink(r);
+    e->mem_obj->fd = fd;
+    switch (r->protocol) {
     /*
      * Note, don't create fwdState for these requests
      */
     case PROTO_INTERNAL:
-       internalStart(request, entry);
+       internalStart(r, e);
        return;
     case PROTO_CACHEOBJ:
-       cachemgrStart(fd, request, entry);
+       cachemgrStart(fd, r, e);
        return;
     default:
        break;
     }
     fwdState = memAllocate(MEM_FWD_STATE);
     cbdataAdd(fwdState, MEM_FWD_STATE);
-    fwdState->entry = entry;
+    fwdState->entry = e;
     fwdState->client_fd = fd;
     fwdState->server_fd = -1;
-    fwdState->request = requestLink(request);
+    fwdState->request = requestLink(r);
     fwdState->start = squid_curtime;
-    storeLockObject(entry);
-    storeRegisterAbort(entry, fwdAbort, fwdState);
-    peerSelect(request,
-       entry,
-       fwdStartComplete,
-       fwdStartFail,
-       fwdState);
+    storeLockObject(e);
+    storeRegisterAbort(e, fwdAbort, fwdState);
+    peerSelect(r, e, fwdStartComplete, fwdStartFail, fwdState);
 }
 
 /* This is called before reading data from the server side to
index f224e55a73cc471850353a34d1f6ed31c7f28923..00a2b45933551143f98311d234b1b6f3b476ffd8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.cc,v 1.115 1998/06/04 19:50:48 wessels Exp $
+ * $Id: net_db.cc,v 1.116 1998/07/14 06:13:00 wessels Exp $
  *
  * DEBUG: section 37    Network Measurement Database
  * AUTHOR: Duane Wessels
@@ -1065,7 +1065,7 @@ netdbExchangeStart(void *data)
     storeClientCopy(ex->e, ex->seen, ex->used, ex->buf_sz,
        ex->buf, netdbExchangeHandleReply, ex);
     EBIT_SET(ex->r->flags, REQ_LOOPDETECT);    /* cheat! -- force direct */
-    fwdStart(-1, ex->e, ex->r);
+    fwdStart(-1, ex->e, ex->r, any_addr);
 #endif
 }
 
index 80b6bc894fa2f5090bdcc19e741166ffe3021639..a9017b2bf315b5427105f333e0b22e21540a860a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.39 1998/06/30 15:08:10 rousskov Exp $
+ * $Id: peer_digest.cc,v 1.40 1998/07/14 06:13:00 wessels Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -291,7 +291,7 @@ peerDigestRequest(peer * p)
     fetch->offset = 0;
     debug(72, 3) ("peerDigestRequest: forwarding to fwdStart...\n");
     /* push towards peer cache */
-    fwdStart(-1, e, req);
+    fwdStart(-1, e, req, any_addr);
     storeClientCopy(e, 0, 0, SM_PAGE_SIZE, memAllocate(MEM_4K_BUF),
        peerDigestFetchReply, fetch);
 }
index 1182b8a43e8ffbc6e5dd64df0a0547901c43e0be..7c108ff3c5aa94da789f02adf399f36b60b8aa1d 100644 (file)
@@ -588,7 +588,7 @@ extern void peerSelectInit(void);
 extern EVH peerDigestInit;
 
 /* forward.c */
-extern void fwdStart(int, StoreEntry *, request_t *);
+extern void fwdStart(int, StoreEntry *, request_t *, struct in_addr);
 extern int fwdAbortFetch(StoreEntry * entry);
 extern DEFER fwdCheckDeferRead;
 extern void fwdFail(FwdState *, int, http_status, int);
index 0b595535a09d82b0911ae4fc25795e8ca62006c5..9e6fdd3a96ff506f2095093cdd15ce4ac3d901d7 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  *
- * $Id: urn.cc,v 1.36 1998/06/05 21:25:52 rousskov Exp $
+ * $Id: urn.cc,v 1.37 1998/07/14 06:13:01 wessels Exp $
  *
  * DEBUG: section 52    URN Parsing
  * AUTHOR: Kostas Anagnostakis
@@ -143,7 +143,7 @@ urnStart(request_t * r, StoreEntry * e)
     if ((urlres_e = storeGet(k)) == NULL) {
        urlres_e = storeCreateEntry(urlres, urlres, 0, METHOD_GET);
        storeClientListAdd(urlres_e, urnState);
-       fwdStart(-1, urlres_e, urlres_r);
+       fwdStart(-1, urlres_e, urlres_r, any_addr);
     } else {
        storeLockObject(urlres_e);
        storeClientListAdd(urlres_e, urnState);