From: hno <> Date: Sat, 28 Jun 2003 02:54:45 +0000 (+0000) Subject: Minor refactoring to C++, and renamed error to message in preparation X-Git-Tag: SQUID_3_0_PRE1~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7bd27db394fea45dc08083aaa5a1a2070687ac7;p=thirdparty%2Fsquid.git Minor refactoring to C++, and renamed error to message in preparation of later merge. --- diff --git a/src/ExternalACLEntry.cc b/src/ExternalACLEntry.cc index 486b2cc0f9..bcf9494997 100644 --- a/src/ExternalACLEntry.cc +++ b/src/ExternalACLEntry.cc @@ -1,6 +1,6 @@ /* - * $Id: ExternalACLEntry.cc,v 1.1 2003/05/20 12:17:38 robertc Exp $ + * $Id: ExternalACLEntry.cc,v 1.2 2003/06/27 20:54:45 hno Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -76,16 +76,12 @@ ExternalACLEntry::ExternalACLEntry() lru.next = lru.prev = NULL; result = 0; date = 0; - user = NULL; - error = NULL; def = NULL; } ExternalACLEntry::~ExternalACLEntry() { safe_free(key); - safe_free(user); - safe_free(error); } void @@ -93,14 +89,8 @@ ExternalACLEntry::update(ExternalACLEntryData const &someData) { date = squid_curtime; result = someData.result; - safe_free(user); - safe_free(error); - - if (someData.user) - user = xstrdup(someData.user); - - if (someData.error) - error = xstrdup(someData.error); + user = someData.user; + message = someData.message; tag = someData.tag; } diff --git a/src/ExternalACLEntry.h b/src/ExternalACLEntry.h index 325a58c9e9..b7ab27a1ca 100644 --- a/src/ExternalACLEntry.h +++ b/src/ExternalACLEntry.h @@ -1,6 +1,6 @@ /* - * $Id: ExternalACLEntry.h,v 1.1 2003/05/20 12:17:38 robertc Exp $ + * $Id: ExternalACLEntry.h,v 1.2 2003/06/27 20:54:45 hno Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -55,12 +55,11 @@ class ExternalACLEntryData { public: - ExternalACLEntryData() : result (-1) , user(NULL) , error (NULL){} + ExternalACLEntryData() : result (-1) {} - // ExternalACLEntryData(int anInt, char const *aUser, char const *anError) : result (anInt), user(aUser),error(anError) {} int result; - char const *user; - char const *error; + String user; + String message; String tag; }; @@ -85,8 +84,8 @@ public: dlink_node lru; int result; time_t date; - char *user; - char *error; + String user; + String message; String tag; external_acl *def; diff --git a/src/cf.data.pre b/src/cf.data.pre index 280aecaf76..e6f4979f5b 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.324 2003/06/19 21:28:50 wessels Exp $ +# $Id: cf.data.pre,v 1.325 2003/06/27 20:54:45 hno Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1803,9 +1803,9 @@ DOC_START Defined keywords: user= The users name (login) - error= Error description (only defined for ERR results) + message= Message describing the reason tag= Apply a tag to a request (for both ERR and OK results) - Only sets a tag, does not alter existing tags. + Only sets a tag, does not alter existing tags. Keyword values need to be enclosed in quotes if they may contain whitespace, or the whitespace escaped using \. Any diff --git a/src/external_acl.cc b/src/external_acl.cc index d675fbc94d..cba6d61295 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.44 2003/06/19 19:07:21 hno Exp $ + * $Id: external_acl.cc,v 1.45 2003/06/27 20:54:45 hno Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -590,11 +590,11 @@ aclMatchExternal(external_acl_data *acl, ACLChecklist * ch) * Register the username for logging purposes */ - if (entry->user) { - xstrncpy(ch->rfc931, entry->user, USER_IDENT_SZ); + if (entry->user.size()) { + xstrncpy(ch->rfc931, entry->user.buf(), USER_IDENT_SZ); if (cbdataReferenceValid(ch->conn())) - xstrncpy(ch->conn()->rfc931, entry->user, USER_IDENT_SZ); + xstrncpy(ch->conn()->rfc931, entry->user.buf(), USER_IDENT_SZ); } if (ch->request && !ch->request->tag.size()) @@ -857,7 +857,7 @@ free_externalAclState(void *data) * Keywords: * * user= The users name (login) - * error= Error description (only defined for ERR results) + * message= Message describing the reason * tag= A string tag to be applied to the request that triggered the acl match. * applies to both OK and ERR responses. * Won't override existing request tags. @@ -901,8 +901,10 @@ externalAclHandleReply(void *data, char *reply) if (strcmp(token, "user") == 0) entryData.user = value; + else if (strcmp(token, "message") == 0) + entryData.message = value; else if (strcmp(token, "error") == 0) - entryData.error = value; + entryData.message = value; } } }