Search squid archive

Re: HI, MY ACL HELPER need help

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

 



Rodrigo Gliksberg wrote:
hi all, i have acl helper to lookup user from db by ip.

include("db.php");

// loop
while (!feof(STDIN)) {
       $line = trim(fgets(STDIN));
       $ip = rawurldecode($line);
       checkIp($ip);

}


// Check db
function checkIp($ip) {

$ip = mysql_escape_string($ip);
$query = "SELECT * FROM `sessions`";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);

while ($row=mysql_fetch_array($result)) {

if ($row['ip'] == $ip) {
   fwrite(STDOUT, "OK user=".$row['username']."\n"); // sif user found
   return true;
}


}
fwrite(STDOUT, "ERR"."\n"); // no found


sleep(2);
}

and log helperhanlde read unexpected read from IPUYser #1, #2, etc 1 bytes
in some cases 16 bytes when return user,

this question how exact value to return, with quotes?

OK user="pepe"\n      ? no work
OK "user=pepe"\n        ? no work


no quotes, ensure utf8 or ASCII charset and url-encode any whitespace or special codes in values.

Amos
--
Please be using
  Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14
  Current Beta Squid 3.1.0.7

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux