From 5bc7fd8f1e41365677eb6787cb7d2a6dea62ee0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 1 Sep 2010 15:11:57 +0300 Subject: auth-ip: introduce helper tool for authdb management fix also some authdb bugs, and make it actually usable. --- squark-filter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'squark-filter.c') diff --git a/squark-filter.c b/squark-filter.c index 7a005e1..236dad4 100644 --- a/squark-filter.c +++ b/squark-filter.c @@ -23,6 +23,8 @@ #include "filterdb.h" #include "authdb.h" +#define FILTER_OVERRIDE_TIMEOUT (15*60) + static int running = 1; static uint64_t banned_categories = 0; static const blob_t dash = BLOB_STR_INIT("-"); @@ -396,10 +398,9 @@ static void read_input(struct sqdb *db) if (!blob_is_null(url) && addr_parse(ipaddr, &addr)) { /* valid request, handle it */ - if (url_parse(url, &nfo)) { - url_print(&nfo); + if (url_parse(url, &nfo)) category = url_classify(&nfo, db); - } else + else category = 0; token = authdb_get(&adb, &addr, &entry, 1); @@ -421,7 +422,7 @@ static void read_input(struct sqdb *db) send_redirect(redirect_login_page, id, url, BLOB_STR("auth"), username); } else if (((1ULL << category) & entry.p.block_categories) && (entry.u.override_time < now || - entry.u.override_time + 15*60 > now || + entry.u.override_time + FILTER_OVERRIDE_TIMEOUT > now || ((1ULL << category) & entry.p.hard_block_categories))) { send_redirect(redirect_banned_page, id, url, get_category_name(db, category), username); } else -- cgit v1.2.3