[squid-users] HI, MY ACL HELPER need help

From: Rodrigo Gliksberg <rgliksberg_at_dedicado.com>
Date: Mon, 13 Apr 2009 16:20:15 -0300

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

regards
Received on Mon Apr 13 2009 - 19:20:27 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 17 2009 - 12:00:02 MDT