diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2013-06-05 21:13:31 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2013-06-05 21:13:31 +0200 |
commit | 6f80a314b634f63dee9f79b94a31df22e85836b2 (patch) | |
tree | f87e9cb9d08fa7d584258c775854fea191cfa37f | |
parent | 340fe83d834865542a30d3507bc59a480e1054c5 (diff) | |
download | eurephia-6f80a314b634f63dee9f79b94a31df22e85836b2.tar.gz eurephia-6f80a314b634f63dee9f79b94a31df22e85836b2.tar.xz eurephia-6f80a314b634f63dee9f79b94a31df22e85836b2.zip |
common: Update callers of eurephia_log_init() to comply with the API changes
This is to enable an improved logging feature in OpenVPN v2.3 and newer.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
-rw-r--r-- | database/sqlite/sqlite.c | 4 | ||||
-rw-r--r-- | eurephiadm/client_context.c | 7 | ||||
-rw-r--r-- | plugin/eurephia.c | 17 | ||||
-rw-r--r-- | plugin/eurephia.h | 5 |
4 files changed, 21 insertions, 12 deletions
diff --git a/database/sqlite/sqlite.c b/database/sqlite/sqlite.c index 2122885..1df00e2 100644 --- a/database/sqlite/sqlite.c +++ b/database/sqlite/sqlite.c @@ -1,6 +1,6 @@ /* sqlite.c -- Generic functions to simplify SQLite3 queries * - * GPLv2 only - Copyright (C) 2008 - 2012 + * GPLv2 only - Copyright (C) 2008 - 2013 * David Sommerseth <dazo@users.sourceforge.net> * * This program is free software; you can redistribute it and/or @@ -828,7 +828,7 @@ int main(int argc, char **argv) { ctx = malloc_nullsafe(NULL, sizeof(eurephiaCTX)+2); ctx->dbc = malloc_nullsafe(NULL, sizeof(eDBconn)+2); - eurephia_log_init(ctx, "sqlitedbg", "stderr:", 10); + eurephia_log_init(ctx, "sqlitedbg", "stderr:", 10, NULL); rc = sqlite3_open(argv[1], (void *) &ctx->dbc->dbhandle); if( rc ) { diff --git a/eurephiadm/client_context.c b/eurephiadm/client_context.c index 5f03be9..719d02c 100644 --- a/eurephiadm/client_context.c +++ b/eurephiadm/client_context.c @@ -1,6 +1,6 @@ /* client_context.c -- Handles eurephia contexts used by admin interfaces * - * GPLv2 only - Copyright (C) 2008 - 2012 + * GPLv2 only - Copyright (C) 2008 - 2013 * David Sommerseth <dazo@users.sourceforge.net> * * This program is free software; you can redistribute it and/or @@ -73,13 +73,14 @@ eurephiaCTX *eurephiaCTX_init(const char *logident, const char *log, logfile = eGet_value(cfg, "log"); if( (logfile != NULL) && (log == NULL) ) { - eurephia_log_init(ctx, logident, logfile, (loglevel > 0 ? loglevel : cfgloglvl)); + eurephia_log_init(ctx, logident, logfile, + (loglevel > 0 ? loglevel : cfgloglvl), NULL); } else { // If log file is not set in config, use input log parameter. But if // no log file is defined even here, use stderr. If no logging is wanted, it // must be defined as none: in the config file. eurephia_log_init(ctx, logident, (log != NULL ? log : "stderr:"), - (loglevel > 0 ? loglevel : cfgloglvl)); + (loglevel > 0 ? loglevel : cfgloglvl), NULL); } if( !eDBlink_init(ctx, dbdriver, 4) ) { diff --git a/plugin/eurephia.c b/plugin/eurephia.c index 946422f..01f14fe 100644 --- a/plugin/eurephia.c +++ b/plugin/eurephia.c @@ -68,7 +68,8 @@ * * @return returns a pointer to a eurephiaCTX context. On failure NULL is returned. */ -eurephiaCTX *eurephiaInit(const char const **argv, const char const **envp) +eurephiaCTX *eurephiaInit(const char const **argv, const char const **envp, + struct openvpn_plugin_callbacks const *ovpn_callbacks) { static struct option eurephia_opts[] = { {"log-destination", required_argument, 0, 'l'}, @@ -139,12 +140,18 @@ eurephiaCTX *eurephiaInit(const char const **argv, const char const **envp) // Open a log file if( (logfile == NULL) || (strcmp(logfile, "openvpn:") == 0) ) { - // If no logfile is given, or openvpn: is given, log to stderr which OpenVPN will - // take care of - eurephia_log_init(ctx, "eurephia-auth", "stderr:", loglvl); + // If no logfile is given, or openvpn: is given, + // log to the OpenVPN plug-in v3 log callback if available, + // otherwise stderr which OpenVPN will take care of in a different way + if( (ovpn_callbacks != NULL) && (ovpn_callbacks->plugin_vlog != NULL) ) { + eurephia_log_init(ctx, "eurephia-auth", "openvpn:", loglvl, + ovpn_callbacks->plugin_vlog); + } else { + eurephia_log_init(ctx, "eurephia-auth", "stderr:", loglvl, NULL); + } } else { // If another log file is given, process that - eurephia_log_init(ctx, "eurephia-auth", logfile, loglvl); + eurephia_log_init(ctx, "eurephia-auth", logfile, loglvl, NULL); } eurephia_log(ctx, LOG_INFO, 0, "Initialising eurephia v" EUREPHIAVERSION " (David Sommerseth (C) 2008-2012 GPLv2)"); diff --git a/plugin/eurephia.h b/plugin/eurephia.h index 9e4ac8a..dc6918e 100644 --- a/plugin/eurephia.h +++ b/plugin/eurephia.h @@ -1,6 +1,6 @@ /* eurephia.h -- Main API for the eurephia authentication module * - * GPLv2 only - Copyright (C) 2008 - 2012 + * GPLv2 only - Copyright (C) 2008 - 2013 * David Sommerseth <dazo@users.sourceforge.net> * * This program is free software; you can redistribute it and/or @@ -36,7 +36,8 @@ char *get_env(eurephiaCTX *ctx, int logmasking, size_t len, const char *envp[], const char *fmt, ... ); -eurephiaCTX *eurephiaInit(const char const **argv, const char const **envp); +eurephiaCTX *eurephiaInit(const char const **argv, const char const **envp, + struct openvpn_plugin_callbacks const *ovpn_callbacks); int eurephiaShutdown(eurephiaCTX *ctx); int eurephia_tlsverify(eurephiaCTX *ctx, const char **argv, const char *depth); |