mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
Support log-file option from common.conf for all daemon.
* agent/gpg-agent.c: Include comopt.h. (main): Read log-file option from common.conf. (reread_configuration): Ditto. * dirmngr/dirmngr.c: Include comopt.h. (main): Read log-file option from common.conf. (reread_configuration): Ditto. * kbx/keyboxd.c: Include comopt.h. (main): Read log-file option from common.conf. (reread_configuration): Ditto. * scd/scdaemon.c: Include comopt.h. (main): Read log-file option from common.conf. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
b657d6c3bd
commit
45918813f0
@ -59,6 +59,7 @@
|
|||||||
#include "../common/gc-opt-flags.h"
|
#include "../common/gc-opt-flags.h"
|
||||||
#include "../common/exechelp.h"
|
#include "../common/exechelp.h"
|
||||||
#include "../common/asshelp.h"
|
#include "../common/asshelp.h"
|
||||||
|
#include "../common/comopt.h"
|
||||||
#include "../common/init.h"
|
#include "../common/init.h"
|
||||||
|
|
||||||
|
|
||||||
@ -1317,6 +1318,13 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
finalize_rereadable_options ();
|
finalize_rereadable_options ();
|
||||||
|
|
||||||
|
/* Get a default log file from common.conf. */
|
||||||
|
if (!logfile && !parse_comopt (GNUPG_MODULE_NAME_AGENT, debug_argparser))
|
||||||
|
{
|
||||||
|
logfile = comopt.logfile;
|
||||||
|
comopt.logfile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Print a warning if an argument looks like an option. */
|
/* Print a warning if an argument looks like an option. */
|
||||||
if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
|
if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
|
||||||
{
|
{
|
||||||
@ -1986,6 +1994,7 @@ reread_configuration (void)
|
|||||||
gpgrt_argparse_t pargs;
|
gpgrt_argparse_t pargs;
|
||||||
char *twopart;
|
char *twopart;
|
||||||
int dummy;
|
int dummy;
|
||||||
|
int logfile_seen = 0;
|
||||||
|
|
||||||
if (!config_filename)
|
if (!config_filename)
|
||||||
return; /* No config file. */
|
return; /* No config file. */
|
||||||
@ -2013,12 +2022,29 @@ reread_configuration (void)
|
|||||||
else if (pargs.r_opt < -1)
|
else if (pargs.r_opt < -1)
|
||||||
pargs.err = ARGPARSE_PRINT_WARNING;
|
pargs.err = ARGPARSE_PRINT_WARNING;
|
||||||
else /* Try to parse this option - ignore unchangeable ones. */
|
else /* Try to parse this option - ignore unchangeable ones. */
|
||||||
|
{
|
||||||
|
if (pargs.r_opt == oLogFile)
|
||||||
|
logfile_seen = 1;
|
||||||
parse_rereadable_options (&pargs, 1);
|
parse_rereadable_options (&pargs, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
|
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
|
||||||
xfree (twopart);
|
xfree (twopart);
|
||||||
|
|
||||||
finalize_rereadable_options ();
|
finalize_rereadable_options ();
|
||||||
set_debug ();
|
set_debug ();
|
||||||
|
|
||||||
|
/* Get a default log file from common.conf. */
|
||||||
|
if (!logfile_seen && !parse_comopt (GNUPG_MODULE_NAME_AGENT, !!opt.debug))
|
||||||
|
{
|
||||||
|
if (!current_logfile || !comopt.logfile
|
||||||
|
|| strcmp (current_logfile, comopt.logfile))
|
||||||
|
{
|
||||||
|
log_set_file (comopt.logfile);
|
||||||
|
xfree (current_logfile);
|
||||||
|
current_logfile = comopt.logfile? xtrystrdup (comopt.logfile) : NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
#if USE_LDAP
|
#if USE_LDAP
|
||||||
# include "ldap-wrapper.h"
|
# include "ldap-wrapper.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "../common/comopt.h"
|
||||||
#include "../common/init.h"
|
#include "../common/init.h"
|
||||||
#include "../common/gc-opt-flags.h"
|
#include "../common/gc-opt-flags.h"
|
||||||
#include "dns-stuff.h"
|
#include "dns-stuff.h"
|
||||||
@ -1072,6 +1073,14 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
if (log_get_errorcount(0))
|
if (log_get_errorcount(0))
|
||||||
exit(2);
|
exit(2);
|
||||||
|
|
||||||
|
/* Get a default log file from common.conf. */
|
||||||
|
if (!logfile && !parse_comopt (GNUPG_MODULE_NAME_DIRMNGR, debug_argparser))
|
||||||
|
{
|
||||||
|
logfile = comopt.logfile;
|
||||||
|
comopt.logfile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (nogreeting )
|
if (nogreeting )
|
||||||
greeting = 0;
|
greeting = 0;
|
||||||
|
|
||||||
@ -1806,9 +1815,10 @@ reread_configuration (void)
|
|||||||
gpgrt_argparse_t pargs;
|
gpgrt_argparse_t pargs;
|
||||||
char *twopart;
|
char *twopart;
|
||||||
int dummy;
|
int dummy;
|
||||||
|
int logfile_seen = 0;
|
||||||
|
|
||||||
if (!opt.config_filename)
|
if (!opt.config_filename)
|
||||||
return; /* No config file. */
|
goto finish; /* No config file. */
|
||||||
|
|
||||||
twopart = strconcat (DIRMNGR_NAME EXTSEP_S "conf" PATHSEP_S,
|
twopart = strconcat (DIRMNGR_NAME EXTSEP_S "conf" PATHSEP_S,
|
||||||
opt.config_filename, NULL);
|
opt.config_filename, NULL);
|
||||||
@ -1833,11 +1843,28 @@ reread_configuration (void)
|
|||||||
else if (pargs.r_opt < -1)
|
else if (pargs.r_opt < -1)
|
||||||
pargs.err = ARGPARSE_PRINT_WARNING;
|
pargs.err = ARGPARSE_PRINT_WARNING;
|
||||||
else /* Try to parse this option - ignore unchangeable ones. */
|
else /* Try to parse this option - ignore unchangeable ones. */
|
||||||
|
{
|
||||||
|
if (pargs.r_opt == oLogFile)
|
||||||
|
logfile_seen = 1;
|
||||||
parse_rereadable_options (&pargs, 1);
|
parse_rereadable_options (&pargs, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
|
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
|
||||||
xfree (twopart);
|
xfree (twopart);
|
||||||
post_option_parsing ();
|
post_option_parsing ();
|
||||||
|
|
||||||
|
finish:
|
||||||
|
/* Get a default log file from common.conf. */
|
||||||
|
if (!logfile_seen && !parse_comopt (GNUPG_MODULE_NAME_DIRMNGR, !!opt.debug))
|
||||||
|
{
|
||||||
|
if (!current_logfile || !comopt.logfile
|
||||||
|
|| strcmp (current_logfile, comopt.logfile))
|
||||||
|
{
|
||||||
|
log_set_file (comopt.logfile);
|
||||||
|
xfree (current_logfile);
|
||||||
|
current_logfile = comopt.logfile? xtrystrdup (comopt.logfile) : NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#include "../common/init.h"
|
#include "../common/init.h"
|
||||||
#include "../common/gc-opt-flags.h"
|
#include "../common/gc-opt-flags.h"
|
||||||
#include "../common/exechelp.h"
|
#include "../common/exechelp.h"
|
||||||
|
#include "../common/comopt.h"
|
||||||
#include "frontend.h"
|
#include "frontend.h"
|
||||||
|
|
||||||
|
|
||||||
@ -610,6 +611,14 @@ main (int argc, char **argv )
|
|||||||
if (log_get_errorcount(0))
|
if (log_get_errorcount(0))
|
||||||
exit (2);
|
exit (2);
|
||||||
|
|
||||||
|
/* Get a default log file from common.conf. */
|
||||||
|
if (!logfile && !parse_comopt (GNUPG_MODULE_NAME_KEYBOXD, debug_argparser))
|
||||||
|
{
|
||||||
|
logfile = comopt.logfile;
|
||||||
|
comopt.logfile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
finalize_rereadable_options ();
|
finalize_rereadable_options ();
|
||||||
|
|
||||||
/* Print a warning if an argument looks like an option. */
|
/* Print a warning if an argument looks like an option. */
|
||||||
@ -988,9 +997,10 @@ reread_configuration (void)
|
|||||||
gpgrt_argparse_t pargs;
|
gpgrt_argparse_t pargs;
|
||||||
char *twopart;
|
char *twopart;
|
||||||
int dummy;
|
int dummy;
|
||||||
|
int logfile_seen = 0;
|
||||||
|
|
||||||
if (!config_filename)
|
if (!config_filename)
|
||||||
return; /* No config file. */
|
goto finish; /* No config file. */
|
||||||
|
|
||||||
twopart = strconcat ("keyboxd" EXTSEP_S "conf" PATHSEP_S,
|
twopart = strconcat ("keyboxd" EXTSEP_S "conf" PATHSEP_S,
|
||||||
config_filename, NULL);
|
config_filename, NULL);
|
||||||
@ -1015,12 +1025,29 @@ reread_configuration (void)
|
|||||||
else if (pargs.r_opt < -1)
|
else if (pargs.r_opt < -1)
|
||||||
pargs.err = ARGPARSE_PRINT_WARNING;
|
pargs.err = ARGPARSE_PRINT_WARNING;
|
||||||
else /* Try to parse this option - ignore unchangeable ones. */
|
else /* Try to parse this option - ignore unchangeable ones. */
|
||||||
|
{
|
||||||
|
if (pargs.r_opt == oLogFile)
|
||||||
|
logfile_seen = 1;
|
||||||
parse_rereadable_options (&pargs, 1);
|
parse_rereadable_options (&pargs, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
|
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
|
||||||
xfree (twopart);
|
xfree (twopart);
|
||||||
finalize_rereadable_options ();
|
finalize_rereadable_options ();
|
||||||
set_debug ();
|
set_debug ();
|
||||||
|
|
||||||
|
finish:
|
||||||
|
/* Get a default log file from common.conf. */
|
||||||
|
if (!logfile_seen && !parse_comopt (GNUPG_MODULE_NAME_KEYBOXD, !!opt.debug))
|
||||||
|
{
|
||||||
|
if (!current_logfile || !comopt.logfile
|
||||||
|
|| strcmp (current_logfile, comopt.logfile))
|
||||||
|
{
|
||||||
|
log_set_file (comopt.logfile);
|
||||||
|
xfree (current_logfile);
|
||||||
|
current_logfile = comopt.logfile? xtrystrdup (comopt.logfile) : NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include "../common/gc-opt-flags.h"
|
#include "../common/gc-opt-flags.h"
|
||||||
#include "../common/asshelp.h"
|
#include "../common/asshelp.h"
|
||||||
#include "../common/exechelp.h"
|
#include "../common/exechelp.h"
|
||||||
|
#include "../common/comopt.h"
|
||||||
#include "../common/init.h"
|
#include "../common/init.h"
|
||||||
|
|
||||||
#ifndef ENAMETOOLONG
|
#ifndef ENAMETOOLONG
|
||||||
@ -652,6 +653,17 @@ main (int argc, char **argv )
|
|||||||
|
|
||||||
if (log_get_errorcount(0))
|
if (log_get_errorcount(0))
|
||||||
exit(2);
|
exit(2);
|
||||||
|
|
||||||
|
/* Process common component options. */
|
||||||
|
if (parse_comopt (GNUPG_MODULE_NAME_SCDAEMON, debug_argparser))
|
||||||
|
exit(2);
|
||||||
|
|
||||||
|
if (!logfile)
|
||||||
|
{
|
||||||
|
logfile = comopt.logfile;
|
||||||
|
comopt.logfile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (nogreeting )
|
if (nogreeting )
|
||||||
greeting = 0;
|
greeting = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user