--- helpers/basic_auth/DB/squid_db_auth.in 2010-05-30 15:21:12.000000000 +0200 +++ helpers/basic_auth/DB/squid_db_auth.in.dlucio 2010-06-01 19:48:32.000000000 +0200 @@ -1,5 +1,5 @@ #!@PERL@ -use strict; +#use strict; use DBI; use Getopt::Long; use Pod::Usage; @@ -26,6 +26,7 @@ my $isjoomla = 0; my $debug = 0; my $hashsalt = undef; +my $sql = undef; =pod @@ -85,6 +86,11 @@ Tells helper that user database is Joomla DB. So their unusual salt hashing is understood. +=item B<--sql> + +Tells the helper that this query will be used. Remember to use ? +(question mark) in a sentence search username like: "WHERE user = ?" + =back =cut @@ -102,6 +108,7 @@ 'joomla' => \$isjoomla, 'debug' => \$debug, 'salt=s' => \$hashsalt, + 'sql=s' => \$sql, ); my ($_dbh, $_sth); @@ -124,8 +131,15 @@ return undef; } my $sql_query; - $sql_query = "SELECT $db_passwdcol FROM $db_table WHERE $db_usercol = ?" . ($db_cond ne "" ? " AND $db_cond" : ""); + if (!defined $sql) { + $sql_query = "SELECT $db_passwdcol FROM $db_table WHERE $db_usercol = ?" . ($db_cond ne "" ? " AND $db_cond" : ""); + } + else{ + $sql_query = $sql; + } + $_sth = $_dbh->prepare($sql_query) || die; + return $_sth; }