Commit 9fd6504d authored by Ad Schellevis's avatar Ad Schellevis

(proxy) auth, don't quit when squid sends an empty string

parent e9369b5c
...@@ -36,7 +36,9 @@ openlog("squid", LOG_ODELAY, LOG_AUTH); ...@@ -36,7 +36,9 @@ openlog("squid", LOG_ODELAY, LOG_AUTH);
$authFactory = new \OPNsense\Auth\AuthenticationFactory(); $authFactory = new \OPNsense\Auth\AuthenticationFactory();
$f = fopen("php://stdin", "r"); $f = fopen("php://stdin", "r");
while ($line = fgets($f)) { while (!(feof($f))) {
$line = fgets($f);
if ($line) {
$fields = explode(' ', trim($line)); $fields = explode(' ', trim($line));
$username = rawurldecode($fields[0]); $username = rawurldecode($fields[0]);
$password = rawurldecode($fields[1]); $password = rawurldecode($fields[1]);
...@@ -79,6 +81,7 @@ while ($line = fgets($f)) { ...@@ -79,6 +81,7 @@ while ($line = fgets($f)) {
syslog(LOG_WARNING, "user '{$username}' could not authenticate.\n"); syslog(LOG_WARNING, "user '{$username}' could not authenticate.\n");
fwrite(STDOUT, "ERR\n"); fwrite(STDOUT, "ERR\n");
} }
}
} }
closelog(); closelog();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment