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/squark-filter.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/squark-filter.c') diff --git a/src/squark-filter.c b/src/squark-filter.c index ac99a67..a5d4013 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -405,7 +405,8 @@ static void read_input(struct sqdb *db) if (authdb_check_login(token, &entry, username, now, &adbc)) { auth_ok = 1; username = BLOB_STRLEN(entry.p.login_name); - } else if (!blob_is_null(username) && blob_cmp(username, dash) != 0) { + } else if ((!adbc.require_auth) || + (!blob_is_null(username) && blob_cmp(username, dash) != 0)) { auth_ok = 1; authdb_clear_entry(&entry); memcpy(entry.p.login_name, username.ptr, username.len); @@ -436,7 +437,15 @@ static void read_input(struct sqdb *db) int main(int argc, char **argv) { - int rc = 1; + int rc = 1, opt; + + while ((opt = getopt(argc, argv, "V")) != -1) { + switch (opt) { + case 'V': + fprintf(stderr, "squark-filter %s\n", squark_version); + return 0; + } + } if (sqdb_open(&db, squark_dbname) < 0) { fprintf(stderr, "%s: failed to open squarkdb\n", -- cgit v1.2.3