summaryrefslogtreecommitdiffstats
path: root/squark-auth-snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'squark-auth-snmp.c')
-rw-r--r--squark-auth-snmp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/squark-auth-snmp.c b/squark-auth-snmp.c
index bcf1858..d72c958 100644
--- a/squark-auth-snmp.c
+++ b/squark-auth-snmp.c
@@ -29,6 +29,7 @@
#include "blob.h"
#include "addr.h"
#include "authdb.h"
+#include "filterdb.h"
/* Compile time configurables */
#define SWITCH_HASH_SIZE 128
@@ -97,7 +98,9 @@ static int num_queries = 0;
static int running = TRUE;
static int kick_out = FALSE;
+static struct sqdb db;
static struct authdb adb;
+static struct authdb_config adbc;
static const char *snmp_community = NULL;
static const char *username_format = "%w";
static struct switch_info *all_switches[SWITCH_HASH_SIZE];
@@ -273,6 +276,7 @@ struct auth_context {
static void cache_update_time(void)
{
current_time = time(NULL);
+ adbc_refresh(&adbc, current_time);
}
static int cache_refresh(
@@ -562,7 +566,7 @@ static void auth_completed(struct auth_context *auth)
memcpy(entry.p.mac_address, auth->mac, MAC_LEN);
entry.p.switch_ip = auth->current_switch->addr;
entry.p.switch_port = auth->local_port;
- authdb_commit_login(token, &entry, current_time);
+ authdb_commit_login(token, &entry, current_time, &adbc);
}
blob_push(&b, BLOB_STR(" OK user="));
@@ -1092,7 +1096,8 @@ int main(int argc, char **argv)
return 1;
}
- authdb_open(&adb);
+ sqdb_open(&db, "/var/lib/squark/squark.db");
+ authdb_open(&adb, &adbc, &db);
if (l2_root == NULL)
l2_root = l3_root;
@@ -1133,6 +1138,7 @@ int main(int argc, char **argv)
snmp_timeout();
}
authdb_close(&adb);
+ sqdb_close(&db);
return 0;
}