Пишу вот такой код#!/usr/bin/perl -w
use DBI;
use strict;
my $db_host = 'localhost';
my $db_name = 'squiddb';
my $db_login = 'dre';
my $db_password = '';
my $sth;
my $dbh;
my $uid;
my $login;
my $password;
my $disabled;
my $limout;
my $p_auth;
&connect_db();
while(<STDIN>)
{
print 'OK';
# ($login,$password) = split(" ");
# $sth = $dbh -> prepare("select people_id from accounts where uname='$login'");
# $sth -> execute() or die $sth -> errstr();
# $uid = $sth -> fetchrow_array();
# $sth -> finish();
# if($uid ne "")
# {
# $sth = $dbh -> prepare("select disabled,limout,p_auth from people where id='$uid'");
# $sth -> execute() or die $sth -> errstr();
# ($disabled,$limout,$p_auth) = $sth -> fetchrow_array();
# $sth -> finish();
# $sth = $dbh -> prepare("select password from passwords where user_id='$uid'");
# $sth -> execute() or die $sth -> errstr();
# $pwd = $sth -> fetchrow_array();
# $sth -> finish();
# if($p_auth == 1)
# {
# if($disabled == 1) {print "ERR\n";next;}
# if($limout == 1) {print "ERR\n";next;}
# if($pwd == $password){ print "OK\n";}
# else{ print "ERR\n";next;}
# }
# else{
# if($limout == 1) {print "ERR\n";next;}
# if($disabled == 1) {print "ERR\n";next;}
# print "OK\n";
# }
# }
}
&disconnect_db();
sub connect_db {
$dbh = DBI -> connect('dbi:Pg:dbname='.$db_name, $db_login, $db_password) || die $dbh -> errstr();
}
sub disconnect_db {
$dbh -> disconnect();
exit;
}
В результате получается всегда ОК,но авторизация не проходит :(
Вот лог squid'а
1178621981.438 20 192.168.51.220 TCP_DENIED/407 1759 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178622034.062 58 192.168.51.220 TCP_DENIED/407 1759 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178623014.730 276 192.168.51.220 TCP_DENIED/407 1761 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178623069.391 42 192.168.51.220 TCP_DENIED/407 1761 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178623190.143 13 192.168.51.220 TCP_DENIED/407 1761 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178623226.627 14 192.168.51.220 TCP_DENIED/407 1761 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178623256.492 14 192.168.51.220 TCP_DENIED/407 1761 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html
1178624179.919 46 192.168.51.220 TCP_DENIED/407 1782 GET http://updates.agnitum.com/update_pro40/update2.aus? - NONE/- text/html
1178633686.500 0 192.168.4.39 TCP_DENIED/407 1785 GET http://crl.microsoft.com/pki/crl/products/WHQLPCA.crl - NONE/- text/html
1178710591.448 118 192.168.51.220 TCP_DENIED/407 1782 GET http://updates.agnitum.com/update_pro40/update2.aus? - NONE/- text/html
1178874589.130 2 192.168.51.220 TCP_DENIED/407 1761 GET http://community.livejournal.com/zhaba_elite/ - NONE/- text/html