From: wessels <> Date: Sun, 30 Nov 1997 09:26:41 +0000 (+0000) Subject: From: BoB Miorelli X-Git-Tag: SQUID_3_0_PRE1~4451 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a0bd885f47014eb7bba6639c3030e236e584c99;p=thirdparty%2Fsquid.git From: BoB Miorelli I recently sent patches to fix the proxy_auth code in Squid 1.2.beta6. This context diff fixes the log file so that the authorized user name is logged if there is no ident header present. Also fixes the Common Log Format to properly log client IP address. --- diff --git a/src/access_log.cc b/src/access_log.cc index a2ddb2cfdb..0f13e30c84 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.11 1997/11/20 06:25:25 wessels Exp $ + * $Id: access_log.cc,v 1.12 1997/11/30 02:26:41 wessels Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -163,7 +163,7 @@ accessLogSquid(AccessLogEntry * al) static int accessLogCommon(AccessLogEntry * al) { - const char *client = dash_str; + const char *client = NULL; if (Config.onoff.log_fqdn) client = fqdncache_gethostbyaddr(al->cache.caddr, 0); if (client == NULL) @@ -181,19 +181,31 @@ accessLogCommon(AccessLogEntry * al) hier_strings[al->hier.code]); } +#define SKIP_BASIC_SZ 6 void accessLogLog(AccessLogEntry * al) { int x; int l; + char *t; + char *xbuf = NULL; if (LogfileStatus != LOG_ENABLE) return; if (al->url == NULL) al->url = dash_str; if (!al->http.content_type || *al->http.content_type == '\0') al->http.content_type = dash_str; - if (!al->cache.ident || *al->cache.ident == '\0') - al->cache.ident = dash_str; + if (!al->cache.ident || *al->cache.ident == '\0') { + t = mime_get_header(al->headers.request, "Proxy-authorization:"); + if (t == NULL) { + al->cache.ident = dash_str; + } else if (strlen(t) < SKIP_BASIC_SZ) { + al->cache.ident = dash_str; + } else { + al->cache.ident = xbuf = uudecode(t + SKIP_BASIC_SZ); + strtok((char *) al->cache.ident, ":"); /* remove password */ + } + } if (al->icp.opcode) al->private.method_str = icp_opcode_str[al->icp.opcode]; else @@ -223,6 +235,7 @@ accessLogLog(AccessLogEntry * al) xfree); if (x != DISK_OK) debug(46, 1) ("log_append: File write failed.\n"); + safe_free(xbuf); } void