aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2008-05-12 10:05:49 +0000
committerAndreas Steffen <andreas.steffen@strongswan.org>2008-05-12 10:05:49 +0000
commita50818ed46e96218e424efd26f310471e613d1a8 (patch)
tree1335bab21b993f3f9f65de6dc6329cebd8db54a0
parentf85d02a419d61c0e6f6b560fbfc3f76441c5bc53 (diff)
downloadstrongswan-a50818ed46e96218e424efd26f310471e613d1a8.tar.bz2
strongswan-a50818ed46e96218e424efd26f310471e613d1a8.tar.xz
plutostderrlog parameter now declares a stderr redirection file
-rw-r--r--src/starter/args.c2
-rw-r--r--src/starter/confread.h2
-rw-r--r--src/starter/invokepluto.c17
3 files changed, 17 insertions, 4 deletions
diff --git a/src/starter/args.c b/src/starter/args.c
index 185d363da..fb3587eb2 100644
--- a/src/starter/args.c
+++ b/src/starter/args.c
@@ -170,7 +170,7 @@ static const token_info_t token_info[] =
{ ARG_STR, offsetof(starter_config_t, setup.charondebug), NULL },
{ ARG_STR, offsetof(starter_config_t, setup.prepluto), NULL },
{ ARG_STR, offsetof(starter_config_t, setup.postpluto), NULL },
- { ARG_ENUM, offsetof(starter_config_t, setup.plutostderrlog), LST_bool },
+ { ARG_STR, offsetof(starter_config_t, setup.plutostderrlog), NULL },
{ ARG_ENUM, offsetof(starter_config_t, setup.uniqueids), LST_unique },
{ ARG_UINT, offsetof(starter_config_t, setup.overridemtu), NULL },
{ ARG_TIME, offsetof(starter_config_t, setup.crlcheckinterval), NULL },
diff --git a/src/starter/confread.h b/src/starter/confread.h
index ee1fd7a6c..90f729d64 100644
--- a/src/starter/confread.h
+++ b/src/starter/confread.h
@@ -174,7 +174,7 @@ struct starter_config {
char *charondebug;
char *prepluto;
char *postpluto;
- bool plutostderrlog;
+ char *plutostderrlog;
bool uniqueids;
u_int overridemtu;
u_int crlcheckinterval;
diff --git a/src/starter/invokepluto.c b/src/starter/invokepluto.c
index d68db568f..b1bca0ec1 100644
--- a/src/starter/invokepluto.c
+++ b/src/starter/invokepluto.c
@@ -179,13 +179,11 @@ starter_start_pluto (starter_config_t *cfg, bool no_fork)
snprintf(buf2, sizeof(buf2), "%u", cfg->setup.keep_alive);
arg[argc++] = buf2;
}
-#ifdef VIRTUAL_IP
if (cfg->setup.virtual_private)
{
arg[argc++] = "--virtual_private";
arg[argc++] = cfg->setup.virtual_private;
}
-#endif
if (cfg->setup.pkcs11module)
{
arg[argc++] = "--pkcs11module";
@@ -226,6 +224,21 @@ starter_start_pluto (starter_config_t *cfg, bool no_fork)
return -1;
case 0:
/* child */
+ if (cfg->setup.plutostderrlog)
+ {
+ int f = creat(cfg->setup.plutostderrlog, 00644);
+
+ /* redirect stderr to file */
+ if (f < 0)
+ {
+ plog("couldn't open stderr redirection file '%s'",
+ cfg->setup.plutostderrlog);
+ }
+ else
+ {
+ dup2(f, 2);
+ }
+ }
setsid();
sigprocmask(SIG_SETMASK, 0, NULL);
execv(arg[0], arg);