pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/p5-Apache2-AuthCookieDBI Add a local fix to make t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6afe9af1abb7
branches:  trunk
changeset: 649649:6afe9af1abb7
user:      he <he%pkgsrc.org@localhost>
date:      Tue Apr 07 08:06:14 2015 +0000

description:
Add a local fix to make this work with non-MySQL backends:

Quoting database identifiers with backticks as is done in 2.17 is
not portable, and only works with a MySQL backend.  Instead, use
the DBI quote_identifier method as hinted in
https://rt.cpan.org/Public/Bug/Display.html?id=101561

Bump PKGREVISION to 1.

diffstat:

 www/p5-Apache2-AuthCookieDBI/Makefile                                   |   3 +-
 www/p5-Apache2-AuthCookieDBI/distinfo                                   |   3 +-
 www/p5-Apache2-AuthCookieDBI/patches/patch-lib_Apache2_AuthCookieDBI.pm |  69 ++++++++++
 3 files changed, 73 insertions(+), 2 deletions(-)

diffs (97 lines):

diff -r 9ea1361a62ff -r 6afe9af1abb7 www/p5-Apache2-AuthCookieDBI/Makefile
--- a/www/p5-Apache2-AuthCookieDBI/Makefile     Tue Apr 07 05:13:45 2015 +0000
+++ b/www/p5-Apache2-AuthCookieDBI/Makefile     Tue Apr 07 08:06:14 2015 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.13 2014/11/23 07:06:28 mef Exp $
+# $NetBSD: Makefile,v 1.14 2015/04/07 08:06:14 he Exp $
 #
 
 DISTNAME=      Apache2-AuthCookieDBI-2.17
+PKGREVISION=   1
 PKGNAME=       p5-${DISTNAME}
 CATEGORIES=    www perl5
 MASTER_SITES=  ${MASTER_SITE_PERL_CPAN:=Apache2/}
diff -r 9ea1361a62ff -r 6afe9af1abb7 www/p5-Apache2-AuthCookieDBI/distinfo
--- a/www/p5-Apache2-AuthCookieDBI/distinfo     Tue Apr 07 05:13:45 2015 +0000
+++ b/www/p5-Apache2-AuthCookieDBI/distinfo     Tue Apr 07 08:06:14 2015 +0000
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.5 2014/11/23 07:06:28 mef Exp $
+$NetBSD: distinfo,v 1.6 2015/04/07 08:06:14 he Exp $
 
 SHA1 (Apache2-AuthCookieDBI-2.17.tar.gz) = 9c99dc4aef039c949a1984aa9f35ae6d2c0e0e5d
 RMD160 (Apache2-AuthCookieDBI-2.17.tar.gz) = 834ee7de6c48ddb23082719503db796b6e00c188
 Size (Apache2-AuthCookieDBI-2.17.tar.gz) = 41911 bytes
+SHA1 (patch-lib_Apache2_AuthCookieDBI.pm) = c2971f36a873de59a13a8cc413fbe243f86b16ea
diff -r 9ea1361a62ff -r 6afe9af1abb7 www/p5-Apache2-AuthCookieDBI/patches/patch-lib_Apache2_AuthCookieDBI.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/p5-Apache2-AuthCookieDBI/patches/patch-lib_Apache2_AuthCookieDBI.pm   Tue Apr 07 08:06:14 2015 +0000
@@ -0,0 +1,69 @@
+$NetBSD: patch-lib_Apache2_AuthCookieDBI.pm,v 1.1 2015/04/07 08:06:14 he Exp $
+
+Quoting database identifiers with backticks as is done in 2.17 is
+not portable, and only works with a MySQL backend.  Instead, use
+the DBI quote_identifier method as hinted in
+https://rt.cpan.org/Public/Bug/Display.html?id=101561
+
+--- lib/Apache2/AuthCookieDBI.pm.orig  2012-12-06 03:41:41.000000000 +0000
++++ lib/Apache2/AuthCookieDBI.pm
+@@ -615,12 +615,16 @@ sub _get_crypted_password {
+ 
+     my $crypted_password = EMPTY_STRING;
+ 
++    my $PasswordField = $dbh->quote_identifier($c{'DBI_PasswordField'});
++    my $UsersTable = $dbh->quote_identifier($c{'DBI_UsersTable'});
++    my $UserField = $dbh->quote_identifier($c{'DBI_UserField'});
++
+     my $sql_query = <<"SQL";
+-      SELECT `$c{'DBI_PasswordField'}`
+-      FROM `$c{'DBI_UsersTable'}`
+-      WHERE `$c{'DBI_UserField'}` = ?
+-      AND (`$c{'DBI_PasswordField'}` != ''
+-      AND `$c{'DBI_PasswordField'}` IS NOT NULL)
++      SELECT $PasswordField
++      FROM $UsersTable
++      WHERE $UserField = ?
++      AND ($PasswordField != ''
++      AND $PasswordField IS NOT NULL)
+ SQL
+     my $sth = $dbh->prepare_cached($sql_query);
+     $sth->execute($user);
+@@ -964,11 +968,15 @@ sub group {
+     my $dbh = $class->_dbi_connect($r) || return Apache2::Const::SERVER_ERROR;
+ 
+     # Now loop through all the groups to see if we're a member of any:
++    my $DBI_GroupUserField = $dbh->quote_identifier($c{'DBI_GroupUserField'});
++    my $DBI_GroupsTable = $dbh->quote_identifier($c{'DBI_GroupsTable'});
++    my $DBI_GroupField = $dbh->quote_identifier($c{'DBI_GroupField'});
++
+     my $sth = $dbh->prepare_cached( <<"EOS" );
+-SELECT `$c{'DBI_GroupUserField'}`
+-FROM `$c{'DBI_GroupsTable'}`
+-WHERE `$c{'DBI_GroupField'}` = ?
+-AND `$c{'DBI_GroupUserField'}` = ?
++SELECT $DBI_GroupUserField
++FROM $DBI_GroupsTable
++WHERE $DBI_GroupField = ?
++AND $DBI_GroupUserField = ?
+ EOS
+     foreach my $group (@groups) {
+         $sth->execute( $group, $user );
+@@ -999,10 +1007,14 @@ sub user_is_active {
+     }
+ 
+     my $dbh = $class->_dbi_connect($r) || return;
++    my $ActiveFieldName = $dbh->quote_identifier($active_field_name);
++    my $DBI_UsersTable = $dbh->quote_identifier($c{'DBI_UsersTable'});
++    my $DBI_UserField  = $dbh->quote_identifier($c{'DBI_UserField'});
++
+     my $sql_query = <<"SQL";
+-      SELECT `$active_field_name`
+-      FROM `$c{'DBI_UsersTable'}`
+-      WHERE `$c{'DBI_UserField'}` = ?
++      SELECT $ActiveFieldName
++      FROM $DBI_UsersTable
++      WHERE $DBI_UserField = ?
+ SQL
+ 
+     my $sth = $dbh->prepare_cached($sql_query);



Home | Main Index | Thread Index | Old Index