summaryrefslogtreecommitdiffstats
path: root/dirmngr/ks-action.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2011-02-09 17:48:00 +0100
committerWerner Koch <wk@gnupg.org>2011-02-09 18:20:05 +0100
commit1cdcab68924a58623c3ea75eb47544973f24420c (patch)
tree96b0e3e873e2510d6b958ed6d3c42e8c4f61d6d5 /dirmngr/ks-action.c
parentSupport key fetching using HTTP. (diff)
downloadgnupg2-1cdcab68924a58623c3ea75eb47544973f24420c.tar.xz
gnupg2-1cdcab68924a58623c3ea75eb47544973f24420c.zip
Add framework to print keyserver engine information
Diffstat (limited to 'dirmngr/ks-action.c')
-rw-r--r--dirmngr/ks-action.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/dirmngr/ks-action.c b/dirmngr/ks-action.c
index ec691fe2a..1f876d07b 100644
--- a/dirmngr/ks-action.c
+++ b/dirmngr/ks-action.c
@@ -49,6 +49,50 @@ copy_stream (estream_t in, estream_t out)
}
+/* Called by the engine's help functions to print the actual help. */
+gpg_error_t
+ks_print_help (ctrl_t ctrl, const char *text)
+{
+ return dirmngr_status_help (ctrl, text);
+}
+
+
+/* Run the help command for the engine responsible for URI. */
+gpg_error_t
+ks_action_help (ctrl_t ctrl, const char *url)
+{
+ gpg_error_t err;
+ parsed_uri_t parsed_uri; /* The broken down URI. */
+
+ if (!url || !*url)
+ {
+ ks_print_help (ctrl, "Known schemata:\n");
+ parsed_uri = NULL;
+ }
+ else
+ {
+ err = http_parse_uri (&parsed_uri, url, 1);
+ if (err)
+ return err;
+ }
+
+ /* Call all engines to geive them a chance to print a help sting. */
+ err = ks_hkp_help (ctrl, parsed_uri);
+ if (!err)
+ err = ks_http_help (ctrl, parsed_uri);
+ if (!err)
+ err = ks_finger_help (ctrl, parsed_uri);
+ if (!err)
+ err = ks_kdns_help (ctrl, parsed_uri);
+
+ if (!parsed_uri)
+ ks_print_help (ctrl,
+ "(Use the schema followed by a colon for specific help.)");
+ else
+ http_release_parsed_uri (parsed_uri);
+ return err;
+}
+
/* Search all configured keyservers for keys matching PATTERNS and
write the result to the provided output stream. */
@@ -187,6 +231,15 @@ ks_action_fetch (ctrl_t ctrl, const char *url, estream_t outfp)
es_fclose (infp);
}
}
+ else if (!strcmp (parsed_uri->scheme, "kdns"))
+ {
+ err = ks_kdns_fetch (ctrl, parsed_uri, &infp);
+ if (!err)
+ {
+ err = copy_stream (infp, outfp);
+ es_fclose (infp);
+ }
+ }
else
err = gpg_error (GPG_ERR_INV_URI);