aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-05-16 10:24:08 +0000
committerWerner Koch <[email protected]>2019-05-16 10:25:07 +0000
commit50c2f76ae65d4ee793876865011fa97c85f38ac2 (patch)
tree84b83ea61a0dc28b1ecb8bbde3079058e86383aa
parentscd: Remove unused cruft from GnuPG 1.x (diff)
downloadgnupg-50c2f76ae65d4ee793876865011fa97c85f38ac2.tar.gz
gnupg-50c2f76ae65d4ee793876865011fa97c85f38ac2.zip
gpgconf: Before --launch check that the config file is fine.
* tools/gpgconf-comp.c (gc_component_launch): Check the conf file. * tools/gpgconf.c (gpgconf_failure): Call log_flush. -- GnuPG-bug-id: 4497 Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--tools/gpgconf-comp.c18
-rw-r--r--tools/gpgconf.c1
2 files changed, 15 insertions, 4 deletions
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index a308c1c83..110f88975 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -1273,8 +1273,17 @@ gc_component_launch (int component)
if (!(component == GC_COMPONENT_GPG_AGENT
|| component == GC_COMPONENT_DIRMNGR))
{
- es_fputs (_("Component not suitable for launching"), es_stderr);
- es_putc ('\n', es_stderr);
+ log_error ("%s\n", _("Component not suitable for launching"));
+ gpgconf_failure (0);
+ }
+
+ if (gc_component_check_options (component, NULL, NULL))
+ {
+ log_error (_("Configuration file of component %s is broken\n"),
+ gc_component[component].name);
+ if (!opt.quiet)
+ log_info (_("Note: Use the command \"%s%s\" to get details.\n"),
+ "gpgconf --check-options ", gc_component[component].name);
gpgconf_failure (0);
}
@@ -1685,8 +1694,9 @@ collect_error_output (estream_t fp, const char *tag)
}
-/* Check the options of a single component. Returns 0 if everything
- is OK. */
+/* Check the options of a single component. If CONF_FILE is NULL the
+ * standard config file is used. If OUT is not NULL the output is
+ * written to that stream. Returns 0 if everything is OK. */
int
gc_component_check_options (int component, estream_t out, const char *conf_file)
{
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index b67125b89..a0cd97f60 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -900,6 +900,7 @@ main (int argc, char **argv)
void
gpgconf_failure (gpg_error_t err)
{
+ log_flush ();
if (!err)
err = gpg_error (GPG_ERR_GENERAL);
gpgconf_write_status