plutostderrlog parameter now declares a stderr redirection file
This commit is contained in:
+1
-1
@@ -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.charondebug), NULL },
|
||||||
{ ARG_STR, offsetof(starter_config_t, setup.prepluto), NULL },
|
{ ARG_STR, offsetof(starter_config_t, setup.prepluto), NULL },
|
||||||
{ ARG_STR, offsetof(starter_config_t, setup.postpluto), 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_ENUM, offsetof(starter_config_t, setup.uniqueids), LST_unique },
|
||||||
{ ARG_UINT, offsetof(starter_config_t, setup.overridemtu), NULL },
|
{ ARG_UINT, offsetof(starter_config_t, setup.overridemtu), NULL },
|
||||||
{ ARG_TIME, offsetof(starter_config_t, setup.crlcheckinterval), NULL },
|
{ ARG_TIME, offsetof(starter_config_t, setup.crlcheckinterval), NULL },
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ struct starter_config {
|
|||||||
char *charondebug;
|
char *charondebug;
|
||||||
char *prepluto;
|
char *prepluto;
|
||||||
char *postpluto;
|
char *postpluto;
|
||||||
bool plutostderrlog;
|
char *plutostderrlog;
|
||||||
bool uniqueids;
|
bool uniqueids;
|
||||||
u_int overridemtu;
|
u_int overridemtu;
|
||||||
u_int crlcheckinterval;
|
u_int crlcheckinterval;
|
||||||
|
|||||||
@@ -179,13 +179,11 @@ starter_start_pluto (starter_config_t *cfg, bool no_fork)
|
|||||||
snprintf(buf2, sizeof(buf2), "%u", cfg->setup.keep_alive);
|
snprintf(buf2, sizeof(buf2), "%u", cfg->setup.keep_alive);
|
||||||
arg[argc++] = buf2;
|
arg[argc++] = buf2;
|
||||||
}
|
}
|
||||||
#ifdef VIRTUAL_IP
|
|
||||||
if (cfg->setup.virtual_private)
|
if (cfg->setup.virtual_private)
|
||||||
{
|
{
|
||||||
arg[argc++] = "--virtual_private";
|
arg[argc++] = "--virtual_private";
|
||||||
arg[argc++] = cfg->setup.virtual_private;
|
arg[argc++] = cfg->setup.virtual_private;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (cfg->setup.pkcs11module)
|
if (cfg->setup.pkcs11module)
|
||||||
{
|
{
|
||||||
arg[argc++] = "--pkcs11module";
|
arg[argc++] = "--pkcs11module";
|
||||||
@@ -226,6 +224,21 @@ starter_start_pluto (starter_config_t *cfg, bool no_fork)
|
|||||||
return -1;
|
return -1;
|
||||||
case 0:
|
case 0:
|
||||||
/* child */
|
/* 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();
|
setsid();
|
||||||
sigprocmask(SIG_SETMASK, 0, NULL);
|
sigprocmask(SIG_SETMASK, 0, NULL);
|
||||||
execv(arg[0], arg);
|
execv(arg[0], arg);
|
||||||
|
|||||||
Reference in New Issue
Block a user