From eafaf02a07ea8436d195805bba57a25dc6b9e26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Thu, 1 Sep 2011 15:13:24 +0300 Subject: filter: option to allow automatic anonymous login so no captive portal, snmp or squid authentication is required. fixes #737. --- src/authdb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/authdb.c') diff --git a/src/authdb.c b/src/authdb.c index d48c43d..8c17ed9 100644 --- a/src/authdb.c +++ b/src/authdb.c @@ -323,6 +323,16 @@ static inline uint64_t to_category(struct sqdb *db, blob_t c) return 0; } +static int is_true(blob_t p) +{ + if (blob_icmp(p, BLOB_STR("yes")) == 0 || + blob_icmp(p, BLOB_STR("true")) == 0 || + blob_icmp(p, BLOB_STR("1")) == 0) + return 1; + + return 0; +} + int adbc_refresh(struct authdb_config *cfg, time_t now) { FILE *in; @@ -349,6 +359,7 @@ int adbc_refresh(struct authdb_config *cfg, time_t now) cfg->block_categories = 0; cfg->hard_block_categories = 0; cfg->logout_timeout = DEFAULT_LOGOUT_TIMEOUT; + cfg->require_auth = 1; while (1) { b = read_word(in, &lineno, BLOB_BUF(word1)); @@ -364,6 +375,8 @@ int adbc_refresh(struct authdb_config *cfg, time_t now) cfg->block_categories |= to_category(cfg->db, p); } else if (blob_cmp(b, BLOB_STR("logout_timeout")) == 0) { cfg->logout_timeout = blob_pull_uint(&p, 10); + } else if (blob_cmp(b, BLOB_STR("require_auth")) == 0) { + cfg->require_auth = is_true(p); } } cfg->block_categories |= cfg->hard_block_categories; -- cgit v1.2.3