Re: Bugs database?

2000-10-13 Thread Todd Chapman


Gotcha. And the reason I don't call $r->get_basic_auth_pw() is I can't
live on the CVS edge.

[Quoting conversation from a few weeks ago]


> my ($res,$password) = $r->get_basic_auth_pw;

this will core dump if AuthName is not set in the configuration file.
not with the current cvs though, see previous message.

>$r->note_basic_auth_failure;

this won't work right unless you've set $r->auth_name($val)


Thanks for your help.


-Todd

On Fri, 13 Oct 2000, Doug MacEachern wrote:

> On Tue, 10 Oct 2000, Todd Chapman wrote:
> 
> > 
> > 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.
> 
> known bugs are listed in the ToDo file.
>  
> > 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?
> 
> it's not a bug, it's because you're not calling $r->get_basic_auth_pw(),
> which you should do instead of this:
> 
> > my $authen = new HTTPD::Authen::Basic();
> > my @info = $authen->parse($r->header_in('Authorization'));
> 
> otherwise, you need to set $r->connection->user yourself.
> 





Re: Bugs database?

2000-10-13 Thread Doug MacEachern

On Tue, 10 Oct 2000, Todd Chapman wrote:

> 
> 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.

known bugs are listed in the ToDo file.
 
> 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?

it's not a bug, it's because you're not calling $r->get_basic_auth_pw(),
which you should do instead of this:

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

otherwise, you need to set $r->connection->user yourself.




Bugs database?

2000-10-10 Thread Todd Chapman


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;