mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpgconf: Take care of --homedir when reading/updating options.
* tools/gpgconf-comp.c (gpg_agent_runtime_change): Remove unused var. (scdaemon_runtime_change): Ditto. (dirmngr_runtime_change): Ditto. (gc_component_check_options): Pass --homedir if needed. (retrieve_options_from_program): Take care of --homedir. -- This is related to bug 4882 but different due all the code changes. GnuPG-bug-id: 4882 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
4287f89557
commit
c1844ca752
@ -676,7 +676,6 @@ gpg_agent_runtime_change (int killflag)
|
||||
const char *pgmname;
|
||||
const char *argv[5];
|
||||
pid_t pid = (pid_t)(-1);
|
||||
char *abs_homedir = NULL;
|
||||
int i = 0;
|
||||
|
||||
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
|
||||
@ -697,7 +696,6 @@ gpg_agent_runtime_change (int killflag)
|
||||
gc_error (0, 0, "error running '%s %s': %s",
|
||||
pgmname, argv[1], gpg_strerror (err));
|
||||
gnupg_release_process (pid);
|
||||
xfree (abs_homedir);
|
||||
}
|
||||
|
||||
|
||||
@ -708,7 +706,6 @@ scdaemon_runtime_change (int killflag)
|
||||
const char *pgmname;
|
||||
const char *argv[9];
|
||||
pid_t pid = (pid_t)(-1);
|
||||
char *abs_homedir = NULL;
|
||||
int i = 0;
|
||||
|
||||
(void)killflag; /* For scdaemon kill and reload are synonyms. */
|
||||
@ -740,7 +737,6 @@ scdaemon_runtime_change (int killflag)
|
||||
gc_error (0, 0, "error running '%s %s': %s",
|
||||
pgmname, argv[4], gpg_strerror (err));
|
||||
gnupg_release_process (pid);
|
||||
xfree (abs_homedir);
|
||||
}
|
||||
|
||||
|
||||
@ -751,7 +747,6 @@ dirmngr_runtime_change (int killflag)
|
||||
const char *pgmname;
|
||||
const char *argv[6];
|
||||
pid_t pid = (pid_t)(-1);
|
||||
char *abs_homedir = NULL;
|
||||
|
||||
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
|
||||
argv[0] = "--no-autostart";
|
||||
@ -774,7 +769,6 @@ dirmngr_runtime_change (int killflag)
|
||||
gc_error (0, 0, "error running '%s %s': %s",
|
||||
pgmname, argv[2], gpg_strerror (err));
|
||||
gnupg_release_process (pid);
|
||||
xfree (abs_homedir);
|
||||
}
|
||||
|
||||
|
||||
@ -1170,7 +1164,7 @@ gc_component_check_options (int component, estream_t out, const char *conf_file)
|
||||
gpg_error_t err;
|
||||
unsigned int result;
|
||||
const char *pgmname;
|
||||
const char *argv[4];
|
||||
const char *argv[5];
|
||||
int i;
|
||||
pid_t pid;
|
||||
int exitcode;
|
||||
@ -1186,6 +1180,12 @@ gc_component_check_options (int component, estream_t out, const char *conf_file)
|
||||
|
||||
pgmname = gnupg_module_name (gc_component[component].module_name);
|
||||
i = 0;
|
||||
if (!gnupg_default_homedir_p ()
|
||||
&& component != GC_COMPONENT_PINENTRY)
|
||||
{
|
||||
argv[i++] = "--homedir";
|
||||
argv[i++] = gnupg_homedir ();
|
||||
}
|
||||
if (conf_file)
|
||||
{
|
||||
argv[i++] = "--options";
|
||||
@ -1517,6 +1517,7 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
const char *config_name;
|
||||
gpgrt_argparse_t pargs;
|
||||
int dummy_argc;
|
||||
char *twopartconfig_name = NULL;
|
||||
gpgrt_opt_t *opt_table = NULL; /* A malloced option table. */
|
||||
size_t opt_table_used = 0; /* Its current length. */
|
||||
size_t opt_table_size = 0; /* Its allocated length. */
|
||||
@ -1797,6 +1798,17 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
if (!config_name)
|
||||
gc_error (1, 0, "name of config file for %s is not known\n", pgmname);
|
||||
|
||||
if (!gnupg_default_homedir_p ())
|
||||
{
|
||||
/* This is not the default homedir. We need to take an absolute
|
||||
* config name for the user config file; gpgrt_argparser
|
||||
* fortunately supports this. */
|
||||
char *tmp = make_filename (gnupg_homedir (), config_name, NULL);
|
||||
twopartconfig_name = xstrconcat (config_name, PATHSEP_S, tmp, NULL);
|
||||
xfree (tmp);
|
||||
config_name = twopartconfig_name;
|
||||
}
|
||||
|
||||
memset (&pargs, 0, sizeof pargs);
|
||||
dummy_argc = 0;
|
||||
pargs.argc = &dummy_argc;
|
||||
@ -1876,6 +1888,7 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
}
|
||||
|
||||
xfree (line);
|
||||
xfree (twopartconfig_name);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user