perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Arnold <darn...@northcoast.com>
Subject Anonymous login with Stein
Date Thu, 01 Jul 2004 21:02:33 GMT
All,

I have this in my httpd.conf:

<Location /protected>
        PerlOptions +GlobalRequest
        AuthName Anonymous
        AuthType Basic
        PerlAuthenHandler Apache::AuthAnon
        require valid-user
        PerlSetVar Anonymous anonymous|anybody
</Location>

Here is the handler:

package Apache::AuthAnon;
# file: Apache/AuthAnon.pm

use strict;
use Apache::Constants qw(:common);

my $email_pat='[.\w-]+\@\w+\.[.\w]*[^.]';
my $anon_id="anonymous";

sub handler {
    my $r=shift;

    my($res,$sent_pwd)=$r->get_basic_auth_pw;
    return $res if $res!=OK;

    my $user=lc $r->connection->user;
    my $reason="";

    my $check_id=$r->dir_config("Anonymous") || $anon_id;

    $reason="user did not enter a valid anonymous username: "
        unless $user=~/^$check_id/i;

    $reason="user did not enter an email address password: "
        unless $sent_pwd=~/^$email_pat$/o;

    if ($reason) {
        $r->note_basic_auth_failure;
        $r->log_reason($reason,$r->filename);
        return AUTH_REQUIRED;
    }

    $r->notes(AuthAnonPassword=>$sent_pwd);

    return OK;
}

1;
__END__

When I attempt to access the location (username: anonymous, password:
darnold@northcoast.com) I get this in my error_log:

[Thu Jul 01 13:38:30 2004] [error] [client 127.0.0.1] Usage:
Apache::RequestRec::notes(obj, val=NULL) at
/home/darnold/modperl/Apache/AuthAnon.pm line 33.\n

If I comment this line of code:

#    $r->notes(AuthAnonPassword=>$sent_pwd);

Then I get this in my error_log:

/darnold/modperl/Apache/AuthAnon.pm line 33.\n
[Thu Jul 01 13:55:30 2004] [error] [client 127.0.0.1] Undefined subroutine
&Apache::AuthAnon::handler called.\n

Can someone explain what is going on and provide a workaround?



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message