summaryrefslogtreecommitdiffstats
path: root/squark-auth-ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'squark-auth-ip.c')
-rw-r--r--squark-auth-ip.c9
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);
}