agent,dirmngr: Re-read the user specified config file.

* agent/gpg-agent.c (reread_configuration): Use a two-part config
file.
* dirmngr/dirmngr.c (reread_configuration): Ditto.
--

If --options is used to to set a specific options file, this file and
not the default file needs to be re-read on SIGHUP.

GnuPG-bug-id: 4788
This commit is contained in:
Werner Koch 2020-02-22 11:35:34 +01:00
parent cdbe10b762
commit 941a48f9b1
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 16 additions and 4 deletions

View File

@ -2016,11 +2016,17 @@ static void
reread_configuration (void)
{
gpgrt_argparse_t pargs;
char *twopart;
int dummy;
if (!config_filename)
return; /* No config file. */
twopart = strconcat (GPG_AGENT_NAME EXTSEP_S "conf" PATHSEP_S,
config_filename, NULL);
if (!twopart)
return; /* Out of core. */
parse_rereadable_options (NULL, 1); /* Start from the default values. */
memset (&pargs, 0, sizeof pargs);
@ -2029,7 +2035,7 @@ reread_configuration (void)
pargs.flags = (ARGPARSE_FLAG_KEEP
|ARGPARSE_FLAG_SYS
|ARGPARSE_FLAG_USER);
while (gpgrt_argparser (&pargs, opts, GPG_AGENT_NAME EXTSEP_S "conf") )
while (gpgrt_argparser (&pargs, opts, twopart) )
{
if (pargs.r_opt == ARGPARSE_CONFFILE)
{
@ -2042,7 +2048,7 @@ reread_configuration (void)
parse_rereadable_options (&pargs, 1);
}
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
xfree (twopart);
finalize_rereadable_options ();
set_debug ();
}

View File

@ -1812,11 +1812,17 @@ static void
reread_configuration (void)
{
gpgrt_argparse_t pargs;
char *twopart;
int dummy;
if (!opt.config_filename)
return; /* No config file. */
twopart = strconcat (DIRMNGR_NAME EXTSEP_S "conf" PATHSEP_S,
opt.config_filename, NULL);
if (!twopart)
return; /* Out of core. */
parse_rereadable_options (NULL, 1); /* Start from the default values. */
memset (&pargs, 0, sizeof pargs);
@ -1825,7 +1831,7 @@ reread_configuration (void)
pargs.flags = (ARGPARSE_FLAG_KEEP
|ARGPARSE_FLAG_SYS
|ARGPARSE_FLAG_USER);
while (gpgrt_argparser (&pargs, opts, DIRMNGR_NAME EXTSEP_S "conf") )
while (gpgrt_argparser (&pargs, opts, twopart))
{
if (pargs.r_opt == ARGPARSE_CONFFILE)
{
@ -1838,7 +1844,7 @@ reread_configuration (void)
parse_rereadable_options (&pargs, 1);
}
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
xfree (twopart);
post_option_parsing ();
}