George george at
Mon Sep 24 11:51:37 BST 2007

Hello All,

I'm having a problem with modperl and I can't figure out if it's my 
stupiditry or modperls'.  I'd love somebody with some modperl foo to 
give me a hand.

First, the config:

rembox# cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)

rembox# rpm -qa | egrep 'http|mod_perl'

rembox# cat /etc/httpd/conf.d/perl.conf | egrep -v "^#"
LoadModule perl_module modules/

Alias /perlremedy /opt/arsperl/scripts/htdocs/

PerlModule ModPerl::Registry
PerlSwitches -I/opt/arsperl/scripts/htdocs/sec/
PerlModule Apache::compat

<Directory /opt/arsperl/scripts/htdocs/*.pl>
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      Options ExecCGI
      PerlOptions +ParseHeaders

<Directory /opt/arsperl/scripts/htdocs/sec/>
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      PerlAuthenHandler My::AuthTest
      Options ExecCGI
      PerlOptions +ParseHeaders +GlobalRequest

      AuthType Basic
      AuthName "Remedy access"
      Require valid-user

<Location /perl-status>
     SetHandler perl-script
     PerlResponseHandler Apache::Status
     Order deny,allow
     Deny from all
     Allow from

Here's the contents of My::AuthTest:

package My::AuthTest;
use Data::Dumper;
use Apache::Access;
use Apache::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED);
use strict;

sub handler {
         my $r = shift ;
         open (FOO, ">/tmp/");

         # get the client-supplied credentials
         my $username = $r->user;
         my ($status, $password) = $r->get_basic_auth_pw;

         print FOO Dumper($username);
         print FOO Dumper($password);
         print FOO Dumper($status);

         close FOO;

         # only continue if Apache says everything is OK
         return $status unless $status == Apache::OK;

	# Until we figure how to get the username, lets just return OK.
	return Apache::OK;



That handler lets the auth through so it's somewhat working.  The 
problem is $username is undef so I can't actually test a login or 
anything.  If I try get access to it from a script that's run after the 
auth (ie, the actual request), then it's not blank and I can see the 
username.  I've also tried $r->connection->user;

I've read a whole bunch of the docs, but what seems to be provided by 
RedHat bears to reference to what's on the interweb.

Can somebody tell me what I'm missing?



More information about the mailing list