summaryrefslogtreecommitdiffstats
path: root/src/authdb.c
diff options
context:
space:
mode:
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;