]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Minor refactoring to C++, and renamed error to message in preparation
authorhno <>
Sat, 28 Jun 2003 02:54:45 +0000 (02:54 +0000)
committerhno <>
Sat, 28 Jun 2003 02:54:45 +0000 (02:54 +0000)
of later merge.

src/ExternalACLEntry.cc
src/ExternalACLEntry.h
src/cf.data.pre
src/external_acl.cc

index 486b2cc0f986083b30a50154fe4f4ea96475d2c8..bcf9494997b184a3bfaeee7efed8bf7dfcff21d7 100644 (file)
@@ -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;
 }
index 325a58c9e94b744f7c7c09b88d6fba09adcf5db1..b7ab27a1caf0bd7fb71451ecacf99c7a2fdee799 100644 (file)
@@ -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;
 
index 280aecaf76aef38cfa5184250c9348d074c4d674..e6f4979f5bb9542c51f0b174b00e2099c56e768e 100644 (file)
@@ -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
index d675fbc94d6fd1bdc3269273b8856cd6c450df60..cba6d612959a407289c85119b0a0dc85a974443e 100644 (file)
@@ -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;
             }
         }
     }