summaryrefslogtreecommitdiffstats
path: root/src/authdb.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-09-01 15:13:24 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-09-01 15:14:27 +0300
commiteafaf02a07ea8436d195805bba57a25dc6b9e26b (patch)
treedf3acec78429955708c6c4495eaeeddf6a999520 /src/authdb.c
parent604378a88fc348718b01e5ce8a3a77cf976a7065 (diff)
downloadsquark-eafaf02a07ea8436d195805bba57a25dc6b9e26b.tar.bz2
squark-eafaf02a07ea8436d195805bba57a25dc6b9e26b.tar.xz
filter: option to allow automatic anonymous login
so no captive portal, snmp or squid authentication is required. fixes #737.
Diffstat (limited to 'src/authdb.c')
-rw-r--r--src/authdb.c13
1 files changed, 13 insertions, 0 deletions
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;