Subject: | missing code in 2.2 |
Date: | Thu, 19 Oct 2006 23:08:27 +0200 |
To: | bug-Apache2-AuthCookieDBImg [...] rt.cpan.org |
From: | Fabrice Renault <fab [...] stock.eu.org> |
Hello
there is missing code in 2.2
just a diff from 2.1 for working
but perhaps not complete
thanks for upload new version
with better modifs
ns4:/home/admin# diff -u Apache2-AuthCookieDBImg-2.2/lib/Apache2/AuthCookieDBImg.pm /usr/local/share/perl/5.8.4/Apache2/AuthCookieDBImg.pm
--- Apache2-AuthCookieDBImg-2.2/lib/Apache2/AuthCookieDBImg.pm 2006-03-31 18:01:57.000000000 +0200
+++ /usr/local/share/perl/5.8.4/Apache2/AuthCookieDBImg.pm 2006-10-19 21:59:43.902933696 +0200
@@ -534,7 +534,7 @@
# to keep cookie alive
#
# Extra data can be put in credential_2, _3, etc.
- # my @extra_data = @credentials;
+ my @extra_data = @credentials;
@Extra_Data = @credentials;
# get the configuration information.
@@ -583,6 +583,30 @@
# CSA Patch - New gen_key function for activity reset
# on cookies
+# Image Match Processing
+ #
+ if ( $c{DBI_imgwordfield} && $c{DBI_imgtable} && $c{DBI_imgkeyfield}) {
+
+ # Image word match goes in credential_2
+ my $imgword = shift @extra_data;
+ unless ( $imgword =~ /^.+$/ ) {
+ $r->log_error( "Apache2::AuthCookieDBImg: no image word supplied", $r->uri );
+ return undef;
+ }
+
+ # Retrieve from DB
+ # image key goes in credential_3 (that is what we lookup in the image DB)
+ my $sth = $dbh->prepare(qq[SELECT $c{ DBI_imgwordfield } FROM $c{ DBI_imgtable } WHERE $c{ DBI_imgkeyfield } = ?]);
+ $sth->execute( shift @extra_data );
+ my $dbword = $sth->fetchrow;
+ $dbword =~ s/\s+$//o;
+ unless ( $imgword eq $dbword) {
+ $r->log_error( "Apache2::AuthCookieDBImg: Image word '$imgword' did not match '$dbword'", $r->uri );
+ return undef;
+ }
+
+ }
+
#
return $self->gen_key($r, $user, \@Extra_Data);
}