Re: Errors when trying to use AuthAny.pm

2001-08-01 Thread Doug MacEachern


> > The error log message is:
> > [Wed Jul 11 09:04:59 2001] [error] (2)No such file or directory:
> > access to /tools/ failed for nr2-216-196-142-76.fuse.net, reason:
> > User not known to the underlying authentication module

question is where does this error message come from?  its not from apache
or mod_perl or AuthAny.pm.  you must have some sort of custom auth module
installed.




Re: Errors when trying to use AuthAny.pm

2001-07-13 Thread Ken Y. Clark

On Wed, 11 Jul 2001, Justin Rains wrote:

> Date: Wed, 11 Jul 2001 07:04:43 -0700 (PDT)
> From: Justin Rains <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Errors when trying to use AuthAny.pm
>
> Hi all. I am relatively new to mod_perl so try to bear with me.
> I am trying to use the AuthAny.pm module to provide some basic
> authentication. First off.. Do I put it in the same directory as
> Registry.pm? That is where I have it now. In my httpd.conf file
> I put the following in:
>
> 
> AuthName Test
> AuthType Basic
> PerlAuthenHandler AuthAny
> require valid-user
> 
> 
>
> I am running on a cobalt raq 3. Here is what I have in AuthAny.pm:
>
> package Apache::AuthAny;
> # file: Apache/AuthAny.pm
>
>
> use strict;
> use Apache::Constants qw(:common);
>
>
> sub handler {
> my $r = shift;
>
> my($res, $sent_pw) = $r->get_basic_auth_pw;
> return $res if $res != OK;
>
>
> my $user = $r->connection->user;
> unless($user and $sent_pw) {
> $r->note_basic_auth_failure;
> $r->log_reason("Both a username and password must be
> provided", $r->filename);
> return AUTH_REQUIRED;
> }
>
>
> return OK;
> }
>
>
> 1;
> __END__
>
> The error log message is:
> [Wed Jul 11 09:04:59 2001] [error] (2)No such file or directory:
> access to /tools/ failed for nr2-216-196-142-76.fuse.net, reason:
> User not known to the underlying authentication module
>
> Am I missing something here? I am using the standard apache that
> came with the raq.
>
> Thanks for any help!
> Justin
>
> ==
> Justin Rains
> WSI.com Consulting
> http://www.wsicnslt.com/

Justin!

Wassup?  Welcome to mod_perl!  It's good to see your name on the list.
Since no one seems to have answered your question, I'll give it a
shot.  The only thing I can come up with right now is that you might
have mistyped the  directive.  You have:

PerlAuthenHandler AuthAny

And the Eagle book (page 283) has:

PerlAuthenHandler Apache::AuthAny

Other than that, I can't really see a problem.  I pasted your code
into my own module (not in the Apache namespace, however), and it all
worked without a problem.

FWIW, I tend to carve out my own namespaces and place my Apache Perl
modules into a library path that gets a use() in a startup file.  To
be more explicit, I'll put my stuff into a directory like
"/usr/local/apache/lib/perl."  Then in my httpd.conf, I'll add a line
line like "PerlRequire conf/perlstartup.pl" (where "conf" is relative
to the server root, or just whereever you want to put it).  My Perl
startup file then uses all the modules I've written, like so:

#!/usr/bin/perl
# file: perlstartup.pl

use lib '/usr/local/apache/lib/perl';

use Foo::Bar;
use Foo::Baz;
use Foo::AuthAny;

1;

HTH!

ky