wkd: Let gpg-wks-client --supported print some diagnostics.

* tools/call-dirmngr.c (wkd_get_status_cb): Deetect and output warning
and note stati from dirmngr.
--

This is in particular helpful to check for non-proper TLS
certificates.
This commit is contained in:
Werner Koch 2023-01-19 10:52:43 +01:00
parent 60963d98cf
commit 227c78ce0e
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 45 additions and 1 deletions

View File

@ -124,10 +124,54 @@ wkd_get_status_cb (void *opaque, const char *line)
{
struct wkd_get_parm_s *parm = opaque;
gpg_error_t err = 0;
const char *s, *s2;
const char *warn = NULL;
int is_note = 0;
(void)line;
(void)parm;
/* Note: The code below is mostly duplicated from g10/call-dirmngr.c */
if ((s = has_leading_keyword (line, "WARNING"))
|| (is_note = !!(s = has_leading_keyword (line, "NOTE"))))
{
if ((s2 = has_leading_keyword (s, "wkd_cached_result")))
{
if (opt.verbose)
warn = _("WKD uses a cached result");
}
else if ((s2 = has_leading_keyword (s, "tor_not_running")))
warn = _("Tor is not running");
else if ((s2 = has_leading_keyword (s, "tor_config_problem")))
warn = _("Tor is not properly configured");
else if ((s2 = has_leading_keyword (s, "dns_config_problem")))
warn = _("DNS is not properly configured");
else if ((s2 = has_leading_keyword (s, "http_redirect")))
warn = _("unacceptable HTTP redirect from server");
else if ((s2 = has_leading_keyword (s, "http_redirect_cleanup")))
warn = _("unacceptable HTTP redirect from server was cleaned up");
else if ((s2 = has_leading_keyword (s, "tls_cert_error")))
warn = _("server uses an invalid certificate");
else
warn = NULL;
if (warn)
{
if (is_note)
log_info (_("Note: %s\n"), warn);
else
log_info (_("WARNING: %s\n"), warn);
if (s2 && opt.verbose)
{
while (*s2 && !spacep (s2))
s2++;
while (*s2 && spacep (s2))
s2++;
if (*s2)
log_info ("(%s)\n", s2);
}
}
}
return err;
}