mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
squidclamav: add helper patch.
This commit is contained in:
185
src/patches/squidclamav-5.11-squid-helper-protocol.patch
Normal file
185
src/patches/squidclamav-5.11-squid-helper-protocol.patch
Normal file
@@ -0,0 +1,185 @@
|
||||
diff -Nur squidclamav-5.11-vanilla/src/squidclamav.c squidclamav-5.11/src/squidclamav.c
|
||||
--- squidclamav-5.11-vanilla/src/squidclamav.c 2012-10-29 09:46:06.000000000 +0100
|
||||
+++ squidclamav-5.11/src/squidclamav.c 2014-06-02 15:19:05.463465297 +0200
|
||||
@@ -483,7 +483,7 @@
|
||||
aren't appropriate, then just echo back the line from stdin */
|
||||
if (buff_status == 1) {
|
||||
logit(log_file, "DEBUG Invalid input buffer, aborting: %s\n", sbuff);
|
||||
- puts("");
|
||||
+ puts("BH message=\"Invalid input buffer\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -496,7 +496,7 @@
|
||||
logit(log_file, "DEBUG No squidguard and no antivir check (TRUSTUSER match) for user: %s\n", in_buff.ident);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"TRUSTUSER match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -508,7 +508,7 @@
|
||||
logit(log_file, "DEBUG No squidguard and no antivir check (TRUSTCLIENT match) for address: %s/%s\n",in_buff.ipaddress, in_buff.fqdn);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"TRUSTCLIENT match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -520,7 +520,7 @@
|
||||
logit(log_file, "DEBUG No squidguard and no antivir check (WHITELIST match) for url: %s\n", in_buff.url);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"WHITLIST match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -536,7 +536,7 @@
|
||||
if ((sockd = dconnect ()) < 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't connect to Clamd daemon, fallback to Squid.\n");
|
||||
- puts("");
|
||||
+ puts("BH message=\"Cannot connect to clamd\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -546,7 +546,7 @@
|
||||
if (write (sockd, "zINSTREAM", 10) <= 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't write to Clamd socket.\n");
|
||||
- puts("");
|
||||
+ puts("BG message=\"Cannot write to clamd socket\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -614,8 +614,7 @@
|
||||
logit(log_file, "Squid Cache purged of url %s.\n", in_buff.url);
|
||||
}
|
||||
}
|
||||
- fprintf (stdout, "%s %s %s %s\n", urlredir,
|
||||
- in_buff.src_address, in_buff.ident, in_buff.method);
|
||||
+ fprintf (stdout, "OK status=302 url=\"%s\"\n", urlredir);
|
||||
fflush(stdout);
|
||||
xfree(urlredir);
|
||||
if (debug != 0)
|
||||
@@ -675,7 +674,7 @@
|
||||
continue operation (so that Squid still works!),
|
||||
we simply echo stdin to stdout - i.e. "bridge mode" :-) */
|
||||
if (bridge_mode == 1) {
|
||||
- puts("");
|
||||
+ puts("ERR message=\"brigde mode\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -685,7 +684,7 @@
|
||||
if (buff_status == -1) {
|
||||
if (debug > 2)
|
||||
logit(log_file, "DEBUG method is not GET skipping virus scan.\n");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"method is not GET skipping virus scan\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -699,7 +698,7 @@
|
||||
timeit(g_start, "Total");
|
||||
|
||||
/* no replacement for the URL was found */
|
||||
- puts("");
|
||||
+ puts("ERR message=\"ABORT match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
|
||||
@@ -750,7 +749,7 @@
|
||||
logit(log_file, "DEBUG HIT Cache found, trust cache enabled, skipping...\n");
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"cache hit found\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -762,7 +761,7 @@
|
||||
logit(log_file, "ERROR No content length from url %s\n", in_buff.url);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"no content length from URL\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -775,7 +774,7 @@
|
||||
logit(log_file, "DEBUG No antivir check (Content length is upper than maxsize): %'.2f > %'.2f\n", usize, maxsize);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"content length is upper than maxsize\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -787,7 +786,7 @@
|
||||
in_buff.url);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"no content type from URL\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -799,7 +798,7 @@
|
||||
logit(log_file, "DEBUG No antivir check (ABORTCONTENT match) for content-type: %s\n", content_type);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"ABORTCONTENT match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -814,7 +813,7 @@
|
||||
if ((sockd = dconnect ()) < 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't connect to Clamd daemon, fallback to Squid.\n");
|
||||
- puts("");
|
||||
+ puts("BH message=\"cannot connect clamd daemon\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -824,7 +823,7 @@
|
||||
if (write (sockd, "zINSTREAM", 10) <= 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't write to Clamd socket.\n");
|
||||
- puts("");
|
||||
+ puts("BH message=\"cannot write to clamd socket\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -844,7 +843,7 @@
|
||||
close (sockd);
|
||||
if (debug > 1)
|
||||
logit(log_file, "DEBUG Connection to clamd closed.\n");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"connection to clamd closed\"");
|
||||
fflush(stdout);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
@@ -892,8 +891,7 @@
|
||||
logit(log_file, "Squid Cache purged of url %s.\n", in_buff.url);
|
||||
}
|
||||
}
|
||||
- fprintf (stdout, "%s %s %s %s\n", urlredir,
|
||||
- in_buff.src_address, in_buff.ident, in_buff.method);
|
||||
+ fprintf (stdout, "OK status=302 url=\"%s\"\n", urlredir);
|
||||
fflush(stdout);
|
||||
xfree(urlredir);
|
||||
if (debug != 0)
|
||||
@@ -911,7 +909,7 @@
|
||||
if (virusfound == 0) {
|
||||
if (debug != 0)
|
||||
logit(log_file, "DEBUG No virus detected.\n");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"no virus detected\"");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user