Craig,

Craig Dunigan wrote:
On Wed, 13 Feb 2008, Neil A. Hillard wrote:

Hi,

I've been having a dabble, using a perl module to handle some of our authentication requirements. I have the perl auth handler working successfully but the username is not logged in access_log.

I have the following code in my perl module:

my $username = "test_user";
$r->user($username);

return OK;

I can see from my PHP script that the REMOTE_USER variable has been set successfully.

I am using the following LogFormat for access_log:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

Any pointers as to how I can get the username logged in access_log?

Many thanks in advance,


                Neil.



I found it necessary to do the following in my Perl auth handler as well as $r->user($username) (assuming Apache2 API):

$r->subprocess_env('REMOTE_USER' => $username);

$r->set_basic_credentials($username, $password);

Bingo - that's the one. As password doesn't make sense I've set it to "" and it works a treat.


I can't exactly recall the reasons, something about which process (parent or child) writes the environment variables vs. which process does the logging, or perhaps the order in which Apache sets variables and writes to the log. Or perhaps it was just overkill on my part, not wanting to miss anything. But it's working for me.

Many thanks,


                                Neil.

--
Neil Hillard                    [EMAIL PROTECTED]
AgustaWestland                  http://www.whl.co.uk/

Disclaimer: This message does not necessarily reflect the
            views of Westland Helicopters Ltd.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to