diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-09-01 15:11:57 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-09-01 15:11:57 +0300 |
commit | 5bc7fd8f1e41365677eb6787cb7d2a6dea62ee0c (patch) | |
tree | a59724c3bd7026d82b622f954466d2df2113cce0 /squark-filter.c | |
parent | b8944ab71ccdc9951c6b74ef8ed8686d0329f99c (diff) | |
download | squark-5bc7fd8f1e41365677eb6787cb7d2a6dea62ee0c.tar.bz2 squark-5bc7fd8f1e41365677eb6787cb7d2a6dea62ee0c.tar.xz |
auth-ip: introduce helper tool for authdb management
fix also some authdb bugs, and make it actually usable.
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 |