diff options
Diffstat (limited to 'squark-filter.c')
-rw-r--r-- | squark-filter.c | 9 |
1 files changed, 5 insertions, 4 deletions
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 |