mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +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 is a backport from master (2.3).
This commit is contained in:
parent
7a3a1ef370
commit
5934027115
@ -681,7 +681,6 @@ gpg_agent_runtime_change (int killflag)
|
|||||||
const char *pgmname;
|
const char *pgmname;
|
||||||
const char *argv[5];
|
const char *argv[5];
|
||||||
pid_t pid = (pid_t)(-1);
|
pid_t pid = (pid_t)(-1);
|
||||||
char *abs_homedir = NULL;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
|
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
|
||||||
@ -702,7 +701,6 @@ gpg_agent_runtime_change (int killflag)
|
|||||||
gc_error (0, 0, "error running '%s %s': %s",
|
gc_error (0, 0, "error running '%s %s': %s",
|
||||||
pgmname, argv[1], gpg_strerror (err));
|
pgmname, argv[1], gpg_strerror (err));
|
||||||
gnupg_release_process (pid);
|
gnupg_release_process (pid);
|
||||||
xfree (abs_homedir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -713,7 +711,6 @@ scdaemon_runtime_change (int killflag)
|
|||||||
const char *pgmname;
|
const char *pgmname;
|
||||||
const char *argv[9];
|
const char *argv[9];
|
||||||
pid_t pid = (pid_t)(-1);
|
pid_t pid = (pid_t)(-1);
|
||||||
char *abs_homedir = NULL;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
(void)killflag; /* For scdaemon kill and reload are synonyms. */
|
(void)killflag; /* For scdaemon kill and reload are synonyms. */
|
||||||
@ -745,7 +742,6 @@ scdaemon_runtime_change (int killflag)
|
|||||||
gc_error (0, 0, "error running '%s %s': %s",
|
gc_error (0, 0, "error running '%s %s': %s",
|
||||||
pgmname, argv[4], gpg_strerror (err));
|
pgmname, argv[4], gpg_strerror (err));
|
||||||
gnupg_release_process (pid);
|
gnupg_release_process (pid);
|
||||||
xfree (abs_homedir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1536,6 +1532,7 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
|||||||
const char *config_name;
|
const char *config_name;
|
||||||
gnupg_argparse_t pargs;
|
gnupg_argparse_t pargs;
|
||||||
int dummy_argc;
|
int dummy_argc;
|
||||||
|
char *twopartconfig_name = NULL;
|
||||||
gpgrt_opt_t *opt_table = NULL; /* A malloced option table. */
|
gpgrt_opt_t *opt_table = NULL; /* A malloced option table. */
|
||||||
size_t opt_table_used = 0; /* Its current length. */
|
size_t opt_table_used = 0; /* Its current length. */
|
||||||
size_t opt_table_size = 0; /* Its allocated length. */
|
size_t opt_table_size = 0; /* Its allocated length. */
|
||||||
@ -1814,6 +1811,17 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
|||||||
if (!config_name)
|
if (!config_name)
|
||||||
gc_error (1, 0, "name of config file for %s is not known\n", pgmname);
|
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);
|
memset (&pargs, 0, sizeof pargs);
|
||||||
dummy_argc = 0;
|
dummy_argc = 0;
|
||||||
pargs.argc = &dummy_argc;
|
pargs.argc = &dummy_argc;
|
||||||
@ -1893,6 +1901,7 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
xfree (line);
|
xfree (line);
|
||||||
|
xfree (twopartconfig_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user