- update to 1.00
- make it run with mod_perl2 Approved by: co-mentor (vanilla)
This commit is contained in:
parent
60cbd05b04
commit
f0e8694085
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=120019
4 changed files with 109 additions and 6 deletions
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= Apache-AuthenCache
|
||||
PORTVERSION= 0.05
|
||||
PORTVERSION= 1.00
|
||||
CATEGORIES= www perl5
|
||||
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
|
||||
MASTER_SITE_SUBDIR= Apache
|
||||
|
@ -15,13 +15,21 @@ PKGNAMEPREFIX= p5-
|
|||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= Perl module that implements authentication caching
|
||||
|
||||
BUILD_DEPENDS= ${SITE_PERL}/Tie/IxHash.pm:${PORTSDIR}/devel/p5-Tie-IxHash \
|
||||
${SITE_PERL}/IPC/Cache.pm:${PORTSDIR}/devel/p5-IPC-Cache \
|
||||
${SITE_PERL}/${PERL_ARCH}/mod_perl.pm:${PORTSDIR}/www/mod_perl
|
||||
BUILD_DEPENDS= ${SITE_PERL}/Time/Object.pm:${PORTSDIR}/devel/p5-Time-Object \
|
||||
${SITE_PERL}/IPC/Cache.pm:${PORTSDIR}/devel/p5-IPC-Cache
|
||||
RUN_DEPENDS= ${BUILD_DEPENDS}
|
||||
|
||||
.if defined(WITH_APACHE2)
|
||||
BUILD_DEPENDS+= ${LOCALBASE}/libexec/apache2/mod_perl.so:${PORTSDIR}/www/mod_perl2
|
||||
.else
|
||||
BUILD_DEPENDS+= ${LOCALBASE}/libexec/apache/libperl.so:${PORTSDIR}/www/mod_perl
|
||||
.endif
|
||||
|
||||
PERL_CONFIGURE= yes
|
||||
|
||||
MAN3= Apache::AuthenCache.3
|
||||
|
||||
post-patch:
|
||||
@${FIND} ${WRKSRC} -name "*.orig" -a -exec ${RM} -f {} \;
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
MD5 (Apache-AuthenCache-0.05.tar.gz) = d6d19a1dca46ad03c7504fbc8d435fca
|
||||
SIZE (Apache-AuthenCache-0.05.tar.gz) = 4686
|
||||
MD5 (Apache-AuthenCache-1.00.tar.gz) = 0353e14098906ddc5df9e48830e5e6c8
|
||||
SIZE (Apache-AuthenCache-1.00.tar.gz) = 9244
|
||||
|
|
79
www/p5-Apache-AuthenCache/files/patch-AuthenCache.pm
Normal file
79
www/p5-Apache-AuthenCache/files/patch-AuthenCache.pm
Normal file
|
@ -0,0 +1,79 @@
|
|||
--- AuthenCache.pm Tue Jun 24 02:44:48 2003
|
||||
+++ AuthenCache.pm Sat Oct 23 15:20:00 2004
|
||||
@@ -263,8 +263,26 @@
|
||||
|
||||
# Required libraries
|
||||
use strict;
|
||||
+BEGIN { local $@; eval { require Apache2; } }
|
||||
use mod_perl ();
|
||||
-use Apache::Constants qw(OK AUTH_REQUIRED DECLINED DONE);
|
||||
+use constant MP2 => $mod_perl::VERSION < 1.99 ? 0 : 1;
|
||||
+BEGIN {
|
||||
+ if (MP2) {
|
||||
+ require Apache2;
|
||||
+ require Apache::Access;
|
||||
+ require Apache::RequestRec;
|
||||
+ require Apache::RequestUtil;
|
||||
+ require Apache::RequestIO;
|
||||
+ require Apache::ServerUtil;
|
||||
+ require Apache::Const;
|
||||
+ Apache::Const->import(-compile => qw(OK AUTH_REQUIRED DECLINED DONE));
|
||||
+ require APR::Table;
|
||||
+ } else {
|
||||
+ require Apache;
|
||||
+ require Apache::Constants;
|
||||
+ Apache::Constants->import(qw(OK AUTH_REQUIRED DECLINED DONE));
|
||||
+ }
|
||||
+}
|
||||
use Apache::Log ();
|
||||
use Cache::FileCache;
|
||||
use Time::Object;
|
||||
@@ -294,14 +312,21 @@
|
||||
my $auth_name = $r->auth_name;
|
||||
|
||||
# Clear for paranoid security precautions
|
||||
- $r->notes('AuthenCache' => 'miss');
|
||||
+ my %notes = ('AuthenCache' => 'miss');
|
||||
+ if (MP2) {
|
||||
+ my $table = APR::Table::make($r->pool, 1);
|
||||
+ $table->set(%notes);
|
||||
+ $r->notes($table);
|
||||
+ } else {
|
||||
+ $r->notes(%notes);
|
||||
+ }
|
||||
|
||||
# Get response and password
|
||||
my($res, $passwd_sent) = $r->get_basic_auth_pw;
|
||||
return $res if $res; # e.g. HTTP_UNAUTHORIZED
|
||||
|
||||
# Get username
|
||||
- my $user_sent = $r->connection->user;
|
||||
+ my $user_sent = MP2 ? $r->user : $r->connection->user;
|
||||
# If the user left the username field blank, we must catch it and DECLINE
|
||||
# for the downstream handler
|
||||
unless ($user_sent) {
|
||||
@@ -373,7 +398,14 @@
|
||||
# } else {
|
||||
$r->log->debug("handler: user in cache and password matches; ",
|
||||
"returning OK and setting notes");
|
||||
- $r->notes('AuthenCache' => 'hit');
|
||||
+ %notes = ('AuthenCache' => 'hit');
|
||||
+ if (MP2) {
|
||||
+ my $table = APR::Table::make($r->pool, 1);
|
||||
+ $table->set(%notes);
|
||||
+ $r->notes($table);
|
||||
+ } else {
|
||||
+ $r->notes(%notes);
|
||||
+ }
|
||||
#}
|
||||
return OK;
|
||||
} # End if()
|
||||
@@ -406,7 +438,7 @@
|
||||
# The below test is dubious. I'm putting it in as a hack around the
|
||||
# problems with set_handlers not working quite right until 1.26 is
|
||||
# released (according to Doug MacEachern).
|
||||
- my $cache_result = $r->notes('AuthenCache');
|
||||
+ my $cache_result = MP2 ? $r->notes->get('AuthenCache') : $r->notes('AuthenCache');
|
||||
if ($cache_result eq 'hit') {
|
||||
$r->log->debug("manage_cache: upstream cache hit for username=",
|
||||
"$user_sent");
|
16
www/p5-Apache-AuthenCache/files/patch-Makefile.PL
Normal file
16
www/p5-Apache-AuthenCache/files/patch-Makefile.PL
Normal file
|
@ -0,0 +1,16 @@
|
|||
--- Makefile.PL Sat Oct 23 15:26:40 2004
|
||||
+++ Makefile.PL Sat Oct 23 15:27:02 2004
|
||||
@@ -4,10 +4,12 @@
|
||||
use Config qw(%Config);
|
||||
use ExtUtils::MakeMaker;
|
||||
|
||||
+eval { require Apache2 };
|
||||
+
|
||||
WriteMakefile
|
||||
(
|
||||
'NAME' => 'Apache::AuthenCache',
|
||||
'VERSION_FROM' => 'AuthenCache.pm',
|
||||
- 'PREREQ_PM' => { 'Apache' => '1.26', 'Cache::Cache' => '1.01' },
|
||||
+ 'PREREQ_PM' => { 'mod_perl' => '1.26', 'Cache::Cache' => '1.01', 'Time::Object' => '0' },
|
||||
'dist' => { 'COMPRESS' => 'gzip -9f', 'SUFFIX' => 'gz', },
|
||||
);
|
Loading…
Reference in a new issue