summaryrefslogtreecommitdiffstats
path: root/plugin/eurephia-auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/eurephia-auth.c')
-rw-r--r--plugin/eurephia-auth.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/plugin/eurephia-auth.c b/plugin/eurephia-auth.c
index 3e9ff6d..03bf674 100644
--- a/plugin/eurephia-auth.c
+++ b/plugin/eurephia-auth.c
@@ -102,33 +102,6 @@ static void dump_env(FILE *f, const char *prefix, const char *envp[]) {
#endif // ENABLE_DEBUG
-/**
- * daemonize if "daemon" environment variable is set.
- * preserves stderr access after being daemonized, but
- * only if "daemon_log_direct" environment variable is set.
- *
- * @param envp openvpn environmental table
- */
-static void daemonize(const char *envp[])
-{
- char *daemon_string = GETENV_DAEMON(envp);
- if( daemon_string && daemon_string[0] == '1' ) {
- char *log_redirect = GETENV_DAEMONLOGREDIR(envp);
- int fd = -1;
- if( log_redirect && log_redirect[0] == '1' ) {
- fd = dup (2);
- }
- if( daemon(0, 0) < 0 ) {
- fprintf(stderr, "eurephia-auth: daemonization failed\n");
- } else if( fd >= 3 ) {
- dup2(fd, 2);
- close(fd);
- }
- free_nullsafe(NULL, log_redirect);
- }
- free_nullsafe(NULL, daemon_string);
-}
-
/**
* Prepares a eurephiaCTX (context) for the openvpn process and tells openvpn which hooks eurephia
@@ -158,9 +131,7 @@ OPENVPN_EXPORT openvpn_plugin_handle_t openvpn_plugin_open_v1(unsigned int *type
| OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_LEARN_ADDRESS);
// Setup a eurephia context
- context = eurephiaInit(argv);
- // Daemonize if requested
- daemonize(envp);
+ context = eurephiaInit(argv, envp);
return (openvpn_plugin_handle_t) context;
}