[derek@techie.com: Re: [squid-users] proxy auth user name in custom error messages]

From: Adrian Chadd <adrian@dont-contact.us>
Date: Tue, 27 Feb 2007 13:54:56 +0800

Here's a patch to expose the log username in an error page.

(and "unkown method" should be fixed too. :)

Adrian

----- Forwarded message from Derek Evans <derek@techie.com> -----

Date: Mon, 26 Feb 2007 23:43:14 -0500
From: Derek Evans <derek@techie.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
To: Adrian Chadd <adrian@creative.net.au>
Subject: Re: [squid-users] proxy auth user name in custom error messages

Adrian Chadd said the following on 26/02/2007 6:35 PM:
>On Mon, Feb 26, 2007, Derek Evans wrote:
>
>Probably been forgotten - most of us work on Squid in our spare time and
>we haven't been all that great keeping wishlists in our head.

Thanks for all your hard work in your spare time. I know what it's like. :D

>
>Coming up with a patch to squid-2.6 shouldn't be difficult at all.
>If someone comes up with a patch then I'll include it into squid-2.6.

I've been a squid user for years but never bothered to look at the
source until today. A little digging and I found where to implement.

Attached is a patch to errorpage.c in squid-2.6.STABLE9. It adds a %n
tag to show the proxy auth username in custom error messages. My C is
old and rusty so please make sure it's ok. I've tested with and without
proxy auth and it works as expected.

Cheers!
Derek

--- errorpage.c 2007-02-26 23:30:26.000000000 -0500
+++ errorpage.c.new 2007-02-26 23:29:45.000000000 -0500
@@ -431,6 +431,7 @@
  * L - HREF link for more info/contact x
  * M - Request Method x
  * m - Error message returned by external Auth. x
+ * n - Proxy Auth username x
  * o - Error message returned by external ACL x
  * p - URL port # x
  * P - Protocol x
@@ -528,6 +529,12 @@
     case 'M':
         p = r ? RequestMethodStr[r->method] : "[unkown method]";
         break;
+ case 'n':
+ if (err->auth_user_request) {
+ p = authscheme_list[err->auth_user_request->auth_user->auth_module - 1].authUserUsername(err->auth_user_request->auth_user);
+ } else
+ p = "[not available]";
+ break;
     case 'o':
         p = external_acl_message;
         if (!p)

----- End forwarded message -----

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $25/pm entry-level bandwidth-capped VPSes available in WA -
Received on Mon Feb 26 2007 - 22:46:57 MST

This archive was generated by hypermail pre-2.1.9 : Thu Mar 01 2007 - 12:00:02 MST