Is there a mod_perl bugs database? I am having a problem and I want to
make sure it isn't a bug in mod_perl that's fixed in a recent release.

Thanks.

-Todd

P.S. The bug is that $r->connection->user() is not set when I return OK
from my PerlAuthenHandler. I have to set it manually. Why would that be?

package Apache::CheckPass;

## Usage: PerlAuthenHandler Apache::CheckPass

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

sub handler {

    my $r = shift;

    $r->notes('CheckPass' => 'Ran!');

    my $authen = new HTTPD::Authen::Basic();
    my @info = $authen->parse($r->header_in('Authorization'));

    $r->notes('USERNAME' => $info[0]);
    $r->notes('AUTH' => 1);

    #return OK if checkpass($r->notes('REALM'), @info);
    if (checkpass($r->notes('REALM'), @info)) {
        $r->notes('CheckPass' => 'Verified!');
        $r->connection->user($info[0]);
        return OK;
    }

    $r->auth_name($r->notes('REALM'));
    $r->note_basic_auth_failure;
    return AUTH_REQUIRED;

}

sub checkpass {

    my $realm = shift;
    my $username = shift;
    my $password = shift;

    my $db = HTTPD::RealmManager->open(-realm => $realm,
                                       -config_file => '/etc/httpd/conf/realms.conf',
                                       -writable => 0,
                                       -server   => 'apache');

    return $db->passwd(-user=>$username,-password=>$password);

}


1;


Reply via email to