diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-09-14 14:59:38 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-09-14 14:59:38 +0300 |
commit | 84354c50f807607700b95debdd3a7ddfde0c09f9 (patch) | |
tree | 56065d6d7a34b45a6cbb5eef662ae1f1bad64484 /squark-auth-ip.c | |
parent | 4be1e8fd5e352a54e87a81979d5ad303efdcbffe (diff) | |
download | squark-84354c50f807607700b95debdd3a7ddfde0c09f9.tar.bz2 squark-84354c50f807607700b95debdd3a7ddfde0c09f9.tar.xz |
authdb: use configuration file to decide blocked categories
and cache the information to authdb properly.
Diffstat (limited to 'squark-auth-ip.c')
-rw-r--r-- | squark-auth-ip.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/squark-auth-ip.c b/squark-auth-ip.c index 1346a2e..4f914ae 100644 --- a/squark-auth-ip.c +++ b/squark-auth-ip.c @@ -16,6 +16,7 @@ #include "blob.h" #include "authdb.h" +#include "filterdb.h" #define DO_LOGIN -1 #define DO_OVERRIDE -2 @@ -23,7 +24,9 @@ #define DO_LOGOUT -4 static int running = 1; +static struct sqdb db; static struct authdb adb; +static struct authdb_config adbc; static blob_t space = BLOB_STR_INIT(" "); static blob_t lf = BLOB_STR_INIT("\n"); static time_t now; @@ -143,7 +146,8 @@ int main(int argc, char **argv) } now = time(NULL); - authdb_open(&adb); + sqdb_open(&db, "/var/lib/squark/squark.db"); + authdb_open(&adb, &adbc, &db); if (running < 0) { struct authdb_entry entry; @@ -168,7 +172,7 @@ int main(int argc, char **argv) } authdb_clear_entry(&entry); memcpy(entry.p.login_name, username.ptr, username.len); - authdb_commit_login(token, &entry, now); + authdb_commit_login(token, &entry, now, &adbc); break; case DO_OVERRIDE: if (authdb_check_login(token, &entry, username, now)) @@ -206,4 +210,5 @@ int main(int argc, char **argv) } authdb_close(&adb); + sqdb_close(&db); } |