summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2012-09-13 17:46:10 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2012-09-13 17:48:30 +0200
commitef50b1ba878472e82ab499d4066c5a4a2b757741 (patch)
tree0fa466611da4fa7698e442882219b2c879b12e29 /plugin
parentea92f408ee3d103c1668f36a7d4117a3fcebbf13 (diff)
downloadeurephia-ef50b1ba878472e82ab499d4066c5a4a2b757741.tar.gz
eurephia-ef50b1ba878472e82ab499d4066c5a4a2b757741.tar.xz
eurephia-ef50b1ba878472e82ab499d4066c5a4a2b757741.zip
Added a new database driver function: eDBregister_vpnclientaddr()
This function replaces eDBregister_vpnmacaddr(). This new function will in addition to the MAC address (if OpenVPN is running in TAP mode) also register the client's IPv4 VPN address. It's also prepared for logging the client's IPv6 VPN address. This function supports both TUN and TAP mode, while the old function only handled TAP mode. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/eurephia.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/plugin/eurephia.c b/plugin/eurephia.c
index eda014f..880ad71 100644
--- a/plugin/eurephia.c
+++ b/plugin/eurephia.c
@@ -1,6 +1,6 @@
/* eurephia.c -- Main functions for the eurephia authentication module
*
- * GPLv2 only - Copyright (C) 2008 - 2010
+ * GPLv2 only - Copyright (C) 2008 - 2012
* David Sommerseth <dazo@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
@@ -142,10 +142,10 @@ eurephiaCTX *eurephiaInit(const char const **argv, const char const **envp)
eurephia_log_init(ctx, "eurephia-auth", logfile, loglvl);
}
eurephia_log(ctx, LOG_INFO, 0, "Initialising eurephia v" EUREPHIAVERSION
- " (David Sommerseth (C) 2008-2010 GPLv2)");
+ " (David Sommerseth (C) 2008-2012 GPLv2)");
// Load the database driver
- if( (error == 0) && eDBlink_init(ctx, dbi, 1) ) {
+ if( (error == 0) && eDBlink_init(ctx, dbi, 3) ) {
// Connect to the database
if( !eDBconnect(ctx, dbargc, dbargv) ) {
eurephia_log(ctx, LOG_PANIC, 0, "Could not connect to the database");
@@ -699,12 +699,11 @@ int eurephia_learn_address(eurephiaCTX *ctx, const char *mode, const char *clien
goto exit;
}
- if( ctx->tuntype == tuntype_TAP ) {
- // Update openvpn_lastlog with the active MAC address, and save it as a session variable
- ret = eDBregister_vpnmacaddr(ctx, session, clientaddr);
- } else {
- ret = 1;
- }
+ // Update openvpn_lastlog with the active VPN client addresses, and save it as a
+ // session variable. clientaddr will contain the MAC address in TAP mode
+ ret = eDBregister_vpnclientaddr(ctx, session,
+ (ctx->tuntype == tuntype_TAP ? clientaddr : NULL),
+ vpnipaddr, NULL);
if( (fw_enabled) && (fwdest != NULL) ) {
fwprofile = eDBget_firewall_profile(ctx, session);