--------------------- PatchSet 2326 Date: 2001/05/13 11:28:36 Author: rbcollins Branch: generic_modules Tag: Z-rbcollins_filters_merge_generic_modules Log: finished shrinking aclCheck Members: src/acl.c:1.21.4.21->1.21.4.22 Index: squid/src/acl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/acl.c,v retrieving revision 1.21.4.21 retrieving revision 1.21.4.22 diff -u -r1.21.4.21 -r1.21.4.22 --- squid/src/acl.c 13 May 2001 09:49:51 -0000 1.21.4.21 +++ squid/src/acl.c 13 May 2001 11:28:36 -0000 1.21.4.22 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.21.4.21 2001/05/13 09:49:51 rbcollins Exp $ + * $Id: acl.c,v 1.21.4.22 2001/05/13 11:28:36 rbcollins Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -1997,52 +1997,32 @@ } debug(28, 3) ("aclCheck: checking '%s'\n", A->cfgline); allow = A->allow; - match = aclMatchAclList(A->acl_list, checklist, 0); - if (match==ACL_MATCH_NEED_LOOKUP) { + switch (match = aclMatchAclList(A->acl_list, checklist, 0)) { + case ACL_MATCH_NEED_LOOKUP: /* the current list needs to perform a lookup of some sort */ return; - } else if (match == ACL_MATCH_INSUFFICIENT_INFORMATION) { + break; + case ACL_MATCH_INSUFFICIENT_INFORMATION: /* There is not enough information in the checklist to determine a match * or non-match */ - allow=0; - } -#if 0 -#if USE_IDENT - if (checklist->state[ACL_IDENT] == ACL_LOOKUP_NEEDED) { - debug(28, 3) ("aclCheck: Doing ident lookup\n"); - if (cbdataValid(checklist->conn)) { - identStart(&checklist->conn->me, &checklist->conn->peer, - aclLookupIdentDone, checklist); - checklist->state[ACL_IDENT] = ACL_LOOKUP_PENDING; - return; - } else { - debug(28, 1) ("aclCheck: Can't start ident lookup. No client connection\n"); - cbdataUnlock(checklist->conn); - checklist->conn = NULL; - allow = 0; - match = -1; - } - } -#endif -#endif - /* - * We are done with this _acl_access entry. Either the request - * is allowed, denied, requires authentication, or we move on to - * the next entry. - */ - cbdataUnlock(A); - if (match) { + allow = ACCESS_DENIED; + case ACL_MATCH_FOUND: + cbdataUnlock(A); debug(28, 3) ("aclCheck: match found, returning %d\n", allow); aclCheckCallback(checklist, allow); return; + break; + case ACL_MATCH_NOTFOUND: + cbdataUnlock(A); + checklist->access_list = A->next; + /* + * Lock the next _acl_access entry + */ + if (A->next) + cbdataLock(A->next); + break; } - checklist->access_list = A->next; - /* - * Lock the next _acl_access entry - */ - if (A->next) - cbdataLock(A->next); } debug(28, 3) ("aclCheck: NO match found, returning %d\n", allow != ACCESS_DENIED ? ACCESS_DENIED : ACCESS_ALLOWED); aclCheckCallback(checklist, allow != ACCESS_DENIED ? ACCESS_DENIED : ACCESS_ALLOWED); @@ -2079,7 +2059,6 @@ aclCheck_t * aclChecklistCreate(const acl_access * A, request_t * request, const char *ident) { - int i; aclCheck_t *checklist; checklist = cbdataAlloc(aclCheck_t); memset (checklist, '\0', sizeof (aclCheck_t));