You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gordon M Lack <gm...@ggr.co.uk> on 2005/11/22 16:44:44 UTC

PerlAuthenHandler failure [mp 2.0.2]

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

   Has anyone managed to get a PerlAuthenHandler to work with
mod_perl2.0.2?

   I'm having problems getting PerlAuthenHandler to work in a .htaccess
file. It gets called, but then *all* other handlers in the directory
seem to be lost.

   Almost as if return OK from PerlAuthenHandler short-cuts to the
PerlResponseHandler?

   This happens for the equivalent build on both Solaris and Linux
systems.


   With this .htaccess file:

==========
PerlAccessHandler GML::Reporter
PerlAuthenHandler GML::Reporter
PerlAuthzHandler GML::Reporter
require group one_i_am_in
==========

   and GML::Reporter code:

==========
package GML::Reporter;

# Dummy handler - just reports it has been called.
# History etc. is at the end
##################################################################

use strict;

use mod_perl2;
use Apache2::Const qw( OK DONE DECLINED );
use Apache2::Log ();
use ModPerl::Util ();

use vars qw ( $VERSION );
$VERSION = '0.01';

our %ok_stage = (
   'PerlAccessHandler' => OK,
   'PerlAuthenHandler' => OK,
   'PerlAuthzHandler' => OK,
);

########## handler ###############################################
# This is where we start at both the authenticate and authorize stages
##################################################################
#
sub handler {
   my $r = shift;

   my $log = $r->log();

   my $call_stage = ModPerl::Util::current_callback();
   $log->warn("Handling >$call_stage<");

   return $ok_stage{$call_stage} if (exists $ok_stage{$call_stage});

# If we get here something odd has happened
#
   $log->error(sprintf("%s called at %s stage!", __PACKAGE__, $call_stage));
   return DECLINED;
}

1;
==========

the error_log on accessing a file in the directory containing the
.htaccess file reports:

[Tue Nov 22 14:30:27 2005] [warn] [client ...] Handling >PerlAccessHandler<
[Tue Nov 22 14:30:27 2005] [warn] [client ...] Handling >PerlAuthenHandler<


  NOTE THAT PerlAuthzHandler is not called!  Likewise, once
PerlAuthenHandler has been called:

a) the index.html file I am accessing is sent back as type text/plain
   (with no .htaccess it is text/html)

b) if I access the directory (rather than index.html) the error_log reports:

[Tue Nov 22 15:14:58 2005] [error] [client ...]
   Attempt to serve directory: /local/...../htdocs/BAtest/

   (with no .htaccess the index.html file is served, as "Options Indexes"
    is on).

   It looks as if once I enter a PerlAuthenHandler all other info about
the call is lost.


2. Used Components and their Configuration:

*** mod_perl version 2.000002

*** using /local/tstweb/apache/installs/2.0.55/mp_libs/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_AP_PREFIX   => /local/tstweb/apache/installs/2.0.55
  MP_COMPAT_1X   => 0
  MP_DEBUG       => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_TRACE       => 1
  MP_USE_DSO     => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

 -L/local/tstweb/apache/installs/2.0.55/lib -laprutil-0 -lgdbm -ldb-4.2 -lexpat
 -L/local/tstweb/apache/installs/2.0.55/lib -lapr-0 -lrt -lm -lsocket -lnsl -lresolv  -lpthread -ldl



*** /XYZ/deptx/tools/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris-thread-multi
    uname='sunos phu638.um.us.sbphrd.com 5.6 generic_105181-03 sun4u sparc sunw,ultra-4 '
    config_args='-dE'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -I/XYZ/deptx/tools/include -I/XYZ/deptx/common/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-D_REENTRANT -I/XYZ/deptx/tools/include -I/XYZ/deptx/common/include'
    ccversion='Forte Developer 7 C 5.4 2002/03/09', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-L/XYZ/deptx/tools/lib -R/XYZ/deptx/tools/lib -L/usr/ccs/lib '
    libpth=/XYZ/deptx/tools/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lpthread -lc
    perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/XYZ/deptx/tools/lib -R/XYZ/deptx/tools/lib -L/usr/ccs/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under solaris
  Compiled at Jul 28 2004 07:08:42
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /XYZ/deptx/tools/lib/perl5/5.8.5
    /XYZ/deptx/common/lib/perl5/5.8.5
    /XYZ/deptx/tools/lib/perl5/site_perl/5.8.5
    /XYZ/deptx/common/lib/perl5/site_perl/5.8.5
    /XYZ/deptx/common/lib/perl5/site_perl
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.05
ExtUtils::MakeMaker: 6.17
LWP                : 5.800
mod_perl           : -
mod_perl2          : 2.000002, 2.000002


3. This is the core dump trace: (if you get a core dump):

  [CORE TRACE COMES HERE]

This report was generated by ../bin/mp2bug on Tue Nov 22 15:10:00 2005 GMT.

-------------8<---------- End Bug Report --------------8<----------

Note: Complete the rest of the details and post this bug report to
modperl <at> perl.apache.org. To subscribe to the list send an empty
email to modperl-subscribe@perl.apache.org.
-------- Gordon Lack --------------- gml4410@ggr.co.uk  ------------
This message *may* reflect my personal opinion.  It is *not* intended
to reflect those of my employer, or anyone else.


Re: PerlAuthenHandler failure [mp 2.0.2]

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>    It also makes no difference if I move the .htaccess file out of the
> way and put the directives into a <Directory> clause in the server
> config.

if you can do a quick setup using

  http://people.apache.org/~geoff/bug-reporting-skeleton-mp2.tar.gz

I'd be happy to look at it.  otherwise, it's been pushed onto the end of my
queue :)

--Geoff

Re: PerlAuthenHandler failure [mp 2.0.2]

Posted by Gordon Lack <gm...@ggr.co.uk>.
> > ==========
> > PerlAccessHandler GML::Reporter
> > PerlAuthenHandler GML::Reporter
> 
> your authen handler ought to be setting $r->user to some meaningful value.
> it probably won't affect things, but add it anyway :)

   The real code does set this (it also sets $r->ap_auth_type and
$r->auth_name).  I'm just using this GML::Reporter module as it shows
exactly the same problem and doesn't really do anything (in particular,
it doesn't modify the request record).  (The real code is long and very
specific to my server environment).

   I'm actually porting the real code from mod_perl v1, where it all
works OK, and has done for several years.

   I'm now setting it to 'guest'.  Makes no difference.  It does set it,
as 'guest' shows up in the access log in the %u value.


> > PerlAuthzHandler GML::Reporter
> > require group one_i_am_in
> 
> are things better if you
> 
>   require valid-user

   No.  That's what I actually started with.

   It also makes no difference if I move the .htaccess file out of the
way and put the directives into a <Directory> clause in the server
config.


Re: PerlAuthenHandler failure [mp 2.0.2]

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
offhand I don't see the problem immediately.  but here are some questions

> ==========
> PerlAccessHandler GML::Reporter
> PerlAuthenHandler GML::Reporter

your authen handler ought to be setting $r->user to some meaningful value.
it probably won't affect things, but add it anyway :)

> PerlAuthzHandler GML::Reporter
> require group one_i_am_in

are things better if you

  require valid-user

?

--Geoff