From: Amos Jeffries Date: Sat, 4 May 2013 11:57:43 +0000 (-0600) Subject: Bug 3827: Remove AccessLogEntry::cache.authuser X-Git-Tag: SQUID_3_4_0_1~173 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0e8c76f93274e7b0e14614a403ee7f0e4ee7f99;p=thirdparty%2Fsquid.git Bug 3827: Remove AccessLogEntry::cache.authuser --- diff --git a/src/AccessLogEntry.cc b/src/AccessLogEntry.cc index dd02362e78..4eb2384411 100644 --- a/src/AccessLogEntry.cc +++ b/src/AccessLogEntry.cc @@ -37,7 +37,6 @@ AccessLogEntry::~AccessLogEntry() #endif safe_free(headers.reply); - safe_free(cache.authuser); safe_free(headers.adapted_request); HTTPMSGUNLOCK(adapted_request); diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index bf2a627397..bba7d3d59a 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -153,7 +153,6 @@ public: code (LOG_TAG_NONE), msec(0), rfc931 (NULL), - authuser (NULL), extuser(NULL), #if USE_SSL ssluser(NULL), @@ -172,7 +171,6 @@ public: LogTags code; int msec; const char *rfc931; - const char *authuser; const char *extuser; #if USE_SSL diff --git a/src/client_side.cc b/src/client_side.cc index 07d2f39d0b..2d11315498 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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? diff --git a/src/format/Format.cc b/src/format/Format.cc index b8ce1b0f83..4ea43ff474 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -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: diff --git a/src/log/FormatHttpdCombined.cc b/src/log/FormatHttpdCombined.cc index b0968ce5b7..ada83c521e 100644 --- a/src/log/FormatHttpdCombined.cc +++ b/src/log/FormatHttpdCombined.cc @@ -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); } diff --git a/src/log/FormatHttpdCommon.cc b/src/log/FormatHttpdCommon.cc index 2f6a85e4e0..f1c6e9a94f 100644 --- a/src/log/FormatHttpdCommon.cc +++ b/src/log/FormatHttpdCommon.cc @@ -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" @@ -43,7 +44,11 @@ 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]; diff --git a/src/log/FormatSquidIcap.cc b/src/log/FormatSquidIcap.cc index 928dae31e1..71d71f5101 100644 --- a/src/log/FormatSquidIcap.cc +++ b/src/log/FormatSquidIcap.cc @@ -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); diff --git a/src/log/FormatSquidNative.cc b/src/log/FormatSquidNative.cc index 29547da488..af8bff1257 100644 --- a/src/log/FormatSquidNative.cc +++ b/src/log/FormatSquidNative.cc @@ -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);