From 301047f944320fccef17df3431ddd0bd5d1455a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Thu, 18 Nov 2010 16:49:54 +0200 Subject: filter: return categorization and blocked/overridden status return the analysis back to squid as urlgroup. it can be then used in squid config acl's and logging (with patch). ref #447. --- src/squark-filter.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/squark-filter.c b/src/squark-filter.c index eff88b1..22c8800 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -308,12 +308,17 @@ static blob_t get_category_name(struct sqdb *db, int id) return sqdb_get_string_literal(db, c[id]); } -static void send_ok(blob_t tag) +static void send_ok(blob_t tag, blob_t categ, int override) { static char buffer[64]; blob_t b = BLOB_BUF(buffer); blob_push(&b, tag); + blob_push(&b, BLOB_STR(" !")); + blob_push(&b, categ); + if (override) + blob_push(&b, BLOB_STR(",overridden")); + blob_push(&b, BLOB_STR("!")); blob_push(&b, lf); b = blob_pushed(BLOB_BUF(buffer), b); @@ -326,7 +331,9 @@ static void send_redirect(blob_t redirect_page, blob_t tag, blob_t url, blob_t c blob_t b = BLOB_BUF(buffer); blob_push(&b, tag); - blob_push(&b, BLOB_STR(" 302:")); + blob_push(&b, BLOB_STR(" !")); + blob_push(&b, categ); + blob_push(&b, BLOB_STR(",blocked!302:")); blob_push(&b, adbc.redirect_url_base); blob_push(&b, redirect_page); blob_push(&b, BLOB_STR("?REASON=")); @@ -410,7 +417,8 @@ static void read_input(struct sqdb *db) ((1ULL << category) & entry.p.hard_block_categories))) { send_redirect(BLOB_STR("warning.cgi"), id, url, get_category_name(db, category), username); } else - send_ok(id); + send_ok(id, get_category_name(db, category), + !!((1ULL << category) & entry.p.block_categories)); } if (b.len) { -- cgit v1.2.3