From f0e8694085c8947da318fef8ca0aed9d4fbb24b7 Mon Sep 17 00:00:00 2001 From: Cheng-Lung Sung Date: Sat, 23 Oct 2004 08:13:38 +0000 Subject: [PATCH] - update to 1.00 - make it run with mod_perl2 Approved by: co-mentor (vanilla) --- www/p5-Apache-AuthenCache/Makefile | 16 +++- www/p5-Apache-AuthenCache/distinfo | 4 +- .../files/patch-AuthenCache.pm | 79 +++++++++++++++++++ .../files/patch-Makefile.PL | 16 ++++ 4 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 www/p5-Apache-AuthenCache/files/patch-AuthenCache.pm create mode 100644 www/p5-Apache-AuthenCache/files/patch-Makefile.PL diff --git a/www/p5-Apache-AuthenCache/Makefile b/www/p5-Apache-AuthenCache/Makefile index 95d08af0fc05..7114a813d21f 100644 --- a/www/p5-Apache-AuthenCache/Makefile +++ b/www/p5-Apache-AuthenCache/Makefile @@ -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 diff --git a/www/p5-Apache-AuthenCache/distinfo b/www/p5-Apache-AuthenCache/distinfo index 9d159b9ed77e..a9af459967af 100644 --- a/www/p5-Apache-AuthenCache/distinfo +++ b/www/p5-Apache-AuthenCache/distinfo @@ -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 diff --git a/www/p5-Apache-AuthenCache/files/patch-AuthenCache.pm b/www/p5-Apache-AuthenCache/files/patch-AuthenCache.pm new file mode 100644 index 000000000000..00df14fbe007 --- /dev/null +++ b/www/p5-Apache-AuthenCache/files/patch-AuthenCache.pm @@ -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"); diff --git a/www/p5-Apache-AuthenCache/files/patch-Makefile.PL b/www/p5-Apache-AuthenCache/files/patch-Makefile.PL new file mode 100644 index 000000000000..3196bdbba425 --- /dev/null +++ b/www/p5-Apache-AuthenCache/files/patch-Makefile.PL @@ -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', }, + );