From: Amos Jeffries Date: Thu, 8 Oct 2015 12:22:22 +0000 (-0700) Subject: Minor edits after audit X-Git-Tag: SQUID_4_0_1~5^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ff6370ba01239e560cd239cbe706d04b074dcb7;p=thirdparty%2Fsquid.git Minor edits after audit --- diff --git a/src/AccessLogEntry.cc b/src/AccessLogEntry.cc index 22ca54ab83..ed9a410f69 100644 --- a/src/AccessLogEntry.cc +++ b/src/AccessLogEntry.cc @@ -62,6 +62,9 @@ AccessLogEntry::~AccessLogEntry() safe_free(headers.adapted_request); HTTPMSGUNLOCK(adapted_request); + safe_free(lastAclName); + safe_free(lastAclData); + HTTPMSGUNLOCK(reply); HTTPMSGUNLOCK(request); #if ICAP_CLIENT diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index cce7425390..b3020746c2 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -39,8 +39,14 @@ class AccessLogEntry: public RefCountable public: typedef RefCount Pointer; - AccessLogEntry() : url(NULL), tcpClient(), reply(NULL), request(NULL), - adapted_request(NULL) {} + AccessLogEntry() : + url(nullptr), + lastAclName(nullptr), + lastAclData(nullptr), + reply(nullptr), + request(nullptr), + adapted_request(nullptr) + {} ~AccessLogEntry(); /// Fetch the client IP log string into the given buffer. @@ -203,17 +209,14 @@ public: { public: - Private() : method_str(NULL), lastAclName(NULL), lastAclData(NULL) {} - ~Private() { - safe_free(lastAclName); - safe_free(lastAclData); - } + Private() : method_str(NULL) {} const char *method_str; - const char *lastAclName; ///< string for external_acl_type %ACL format code - const char *lastAclData; ///< string for external_acl_type %DATA format code - } _private; + + const char *lastAclName; ///< string for external_acl_type %ACL format code + const char *lastAclData; ///< string for external_acl_type %DATA format code + HierarchyLogEntry hier; HttpReply *reply; HttpRequest *request; //< virgin HTTP request diff --git a/src/ExternalACL.h b/src/ExternalACL.h index 1299c017ba..4bd3d4c78e 100644 --- a/src/ExternalACL.h +++ b/src/ExternalACL.h @@ -51,7 +51,7 @@ public: virtual void parse(); virtual int match(ACLChecklist *checklist); /* This really should be dynamic based on the external class defn */ - virtual bool requiresAleXXX() const {return true;} + virtual bool requiresAle() const {return true;} virtual bool requiresRequest() const {return true;} /* when requiresRequest is made dynamic, review this too */ diff --git a/src/acl/Acl.cc b/src/acl/Acl.cc index 7da4f15b8e..91449e442b 100644 --- a/src/acl/Acl.cc +++ b/src/acl/Acl.cc @@ -153,7 +153,7 @@ ACL::matches(ACLChecklist *checklist) const AclMatchedName = name; int result = 0; - if (!checklist->hasAleXXX() && requiresAleXXX()) { + if (!checklist->hasAle() && requiresAle()) { debugs(28, DBG_IMPORTANT, "WARNING: " << name << " ACL is used in " << "context without an ALE state. Assuming mismatch."); } else if (!checklist->hasRequest() && requiresRequest()) { @@ -371,7 +371,7 @@ aclCacheMatchFlush(dlink_list * cache) } bool -ACL::requiresAleXXX() const +ACL::requiresAle() const { return false; } diff --git a/src/acl/Acl.h b/src/acl/Acl.h index 9104ab6242..56904f108c 100644 --- a/src/acl/Acl.h +++ b/src/acl/Acl.h @@ -142,7 +142,7 @@ private: virtual int match(ACLChecklist *checklist) = 0; // XXX: missing const /// whether our (i.e. shallow) match() requires checklist to have a AccessLogEntry - virtual bool requiresAleXXX() const; + virtual bool requiresAle() const; /// whether our (i.e. shallow) match() requires checklist to have a request virtual bool requiresRequest() const; /// whether our (i.e. shallow) match() requires checklist to have a reply diff --git a/src/acl/Checklist.h b/src/acl/Checklist.h index 025e3a5e6e..aa07cf5e45 100644 --- a/src/acl/Checklist.h +++ b/src/acl/Checklist.h @@ -163,7 +163,7 @@ public: // for ACL::checklistMatches to use virtual bool hasRequest() const = 0; virtual bool hasReply() const = 0; - virtual bool hasAleXXX() const = 0; + virtual bool hasAle() const = 0; /// change the current ACL list /// \return a pointer to the old list value (may be nullptr) diff --git a/src/acl/FilledChecklist.h b/src/acl/FilledChecklist.h index 211fc5adba..c8ff41c1f5 100644 --- a/src/acl/FilledChecklist.h +++ b/src/acl/FilledChecklist.h @@ -62,7 +62,7 @@ public: // ACLChecklist API virtual bool hasRequest() const { return request != NULL; } virtual bool hasReply() const { return reply != NULL; } - virtual bool hasAleXXX() const { return al != NULL; } + virtual bool hasAle() const { return al != NULL; } public: Ip::Address src_addr; diff --git a/src/external_acl.cc b/src/external_acl.cc index 86338a4472..9c643b505f 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -718,8 +718,8 @@ makeExternalAclKey(ACLFilledChecklist * ch, external_acl_data * acl_data) if (t->type == Format::LFT_EXT_ACL_NAME) { // setup for %ACL - safe_free(ch->al->_private.lastAclName); - ch->al->_private.lastAclName = xstrdup(acl_data->name); + safe_free(ch->al->lastAclName); + ch->al->lastAclName = xstrdup(acl_data->name); } if (t->type == Format::LFT_EXT_ACL_DATA) { @@ -741,7 +741,7 @@ makeExternalAclKey(ACLFilledChecklist * ch, external_acl_data * acl_data) } } - ch->al->_private.lastAclData = sb.c_str(); + ch->al->lastAclData = xstrdup(sb.c_str()); } #if USE_IDENT diff --git a/src/format/Format.cc b/src/format/Format.cc index addc60ba8d..5553990f33 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -1288,11 +1288,11 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS break; case LFT_EXT_ACL_NAME: - out = al->_private.lastAclName; + out = al->lastAclName; break; case LFT_EXT_ACL_DATA: - out = al->_private.lastAclData; + out = al->lastAclData; break; }