]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3827: Remove AccessLogEntry::cache.authuser
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 7 May 2013 08:48:36 +0000 (02:48 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 7 May 2013 08:48:36 +0000 (02:48 -0600)
src/AccessLogEntry.cc
src/AccessLogEntry.h
src/client_side.cc
src/format/Format.cc
src/log/FormatHttpdCombined.cc
src/log/FormatHttpdCommon.cc
src/log/FormatSquidIcap.cc
src/log/FormatSquidNative.cc

index 4595c99b4ca032362f5736231fe3fdac9ada80a6..3e721d9642fe850e422cfacffc2c0deebb9ff42b 100644 (file)
@@ -37,7 +37,6 @@ AccessLogEntry::~AccessLogEntry()
 #endif
 
     safe_free(headers.reply);
-    safe_free(cache.authuser);
 
     safe_free(headers.adapted_request);
     HTTPMSGUNLOCK(adapted_request);
index 96e2ab7ce5d23bf8592cbe9acc6d8b3d6ba9c930..51ad75138b7618f640ef9489c77c2faa39cfdbf9 100644 (file)
@@ -151,7 +151,6 @@ public:
                 code (LOG_TAG_NONE),
                 msec(0),
                 rfc931 (NULL),
-                authuser (NULL),
                 extuser(NULL),
 #if USE_SSL
                 ssluser(NULL),
@@ -170,7 +169,6 @@ public:
         log_type code;
         int msec;
         const char *rfc931;
-        const char *authuser;
         const char *extuser;
 #if USE_SSL
 
index de185fcab48c429d0870d31afd04a521f2f8725b..905eaae2d6ea42c0cf14167ad363205c9bdab1a6 100644 (file)
@@ -618,13 +618,6 @@ prepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry::Pointer &aLo
         aLogEntry->cache.requestSize += request->content_length;
     aLogEntry->cache.extuser = request->extacl_user.termedBuf();
 
-#if USE_AUTH
-    if (request->auth_user_request != NULL) {
-        if (request->auth_user_request->username())
-            aLogEntry->cache.authuser = xstrdup(request->auth_user_request->username());
-    }
-#endif
-
     // Adapted request, if any, inherits and then collects all the stats, but
     // the virgin request gets logged instead; copy the stats to log them.
     // TODO: avoid losses by keeping these stats in a shared history object?
index 260c02fdae2aecac55377d8a22b91608118a4743..de3f68ca5cc3a682ff499e51cba62cb1b7cda4df 100644 (file)
@@ -760,7 +760,10 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             break;
 
         case LFT_USER_NAME:
-            out = strOrNull(al->cache.authuser);
+#if USE_AUTH
+            if (al->request && al->request->auth_user_request != NULL)
+                out = strOrNull(al->request->auth_user_request->username());
+#endif
             if (!out)
                 out = strOrNull(al->cache.extuser);
 #if USE_SSL
@@ -772,7 +775,10 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             break;
 
         case LFT_USER_LOGIN:
-            out = strOrNull(al->cache.authuser);
+#if USE_AUTH
+            if (al->request && al->request->auth_user_request != NULL)
+                out = strOrNull(al->request->auth_user_request->username());
+#endif
             break;
 
         case LFT_USER_IDENT:
index 088a4bbcb5685b23be237c2bf2db3b42de837fd6..1c2cb56f1afd0db3863d118c47b0bea45475cbf7 100644 (file)
@@ -45,13 +45,15 @@ void
 Log::Format::HttpdCombined(const AccessLogEntry::Pointer &al, Logfile * logfile)
 {
     const char *user_ident = ::Format::QuoteUrlEncodeUsername(al->cache.rfc931);
-
-    const char *user_auth = ::Format::QuoteUrlEncodeUsername(al->cache.authuser);
-
+    const char *user_auth = NULL;
     const char *referer = NULL;
     const char *agent = NULL;
 
     if (al->request) {
+#if USE_AUTH
+        if (al->request->auth_user_request != NULL)
+            user_auth = ::Format::QuoteUrlEncodeUsername(al->request->auth_user_request->username());
+#endif
         referer = al->request->header.getStr(HDR_REFERER);
         agent = al->request->header.getStr(HDR_USER_AGENT);
     }
index f9270d6980a052cd0e4c24e8f456ad5149f2a915..0ebacb0f0f2a83807260741381a06ca3cc195157 100644 (file)
@@ -35,6 +35,7 @@
 #include "format/Quoting.h"
 #include "format/Token.h"
 #include "globals.h"
+#include "HttpRequest.h"
 #include "log/File.h"
 #include "log/Formats.h"
 #include "SquidConfig.h"
 void
 Log::Format::HttpdCommon(const AccessLogEntry::Pointer &al, Logfile * logfile)
 {
-    const char *user_auth = ::Format::QuoteUrlEncodeUsername(al->cache.authuser);
+    const char *user_auth = NULL;
+#if USE_AUTH
+    if (al->request && al->request->auth_user_request != NULL)
+        user_auth = ::Format::QuoteUrlEncodeUsername(al->request->auth_user_request->username());
+#endif
     const char *user_ident = ::Format::QuoteUrlEncodeUsername(al->cache.rfc931);
 
     char clientip[MAX_IPSTRLEN];
index 928dae31e1b67748243d814f554193815cc65242..71d71f510154f654ba8e9b2422e083d58c6a0dbf 100644 (file)
@@ -59,7 +59,10 @@ Log::Format::SquidIcap(const AccessLogEntry::Pointer &al, Logfile * logfile)
             client = al->cache.caddr.NtoA(clientbuf, MAX_IPSTRLEN);
     }
 
-    user = ::Format::QuoteUrlEncodeUsername(al->cache.authuser);
+#if USE_AUTH
+    if (al->request != NULL && al->request->auth_user_request != NULL)
+        user = ::Format::QuoteUrlEncodeUsername(al->request->auth_user_request->username());
+#endif
 
     if (!user)
         user = ::Format::QuoteUrlEncodeUsername(al->cache.extuser);
index b90153338a574142c5f311acb90ac2d6a67b5322..4ebfa8bbed6c5097e4508d4880919edecc7f9812 100644 (file)
@@ -35,6 +35,7 @@
 #include "format/Quoting.h"
 #include "format/Token.h"
 #include "globals.h"
+#include "HttpRequest.h"
 #include "log/File.h"
 #include "log/Formats.h"
 #include "SquidConfig.h"
@@ -45,7 +46,12 @@ Log::Format::SquidNative(const AccessLogEntry::Pointer &al, Logfile * logfile)
 {
     char hierHost[MAX_IPSTRLEN];
 
-    const char *user = ::Format::QuoteUrlEncodeUsername(al->cache.authuser);
+    const char *user = NULL;
+
+#if USE_AUTH
+    if (al->request && al->request->auth_user_request != NULL)
+        user = ::Format::QuoteUrlEncodeUsername(al->request->auth_user_request->username());
+#endif
 
     if (!user)
         user = ::Format::QuoteUrlEncodeUsername(al->cache.extuser);