From 2c79a2832cd3cbc1c09f4f7a7b2653ba6cbd2845 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 8 Feb 2011 21:11:19 +0100 Subject: Add finger support to dirmngr. The basic network code from http.c is used for finger. This keeps the network related code at one place and we are able to use the somewhat matured code form http.c. Unfortunately I had to enhance the http code for more robustness and probably introduced new bugs. Test this code using gpg --fetch-key finger:wk@g10code.com (I might be the last user of finger ;-) --- dirmngr/server.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'dirmngr/server.c') diff --git a/dirmngr/server.c b/dirmngr/server.c index 86b21b67b..403a13692 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -1541,6 +1541,34 @@ cmd_ks_get (assuan_context_t ctx, char *line) } +static const char hlp_ks_fetch[] = + "KS_FETCH \n" + "\n" + "Get the key(s) from URL."; +static gpg_error_t +cmd_ks_fetch (assuan_context_t ctx, char *line) +{ + ctrl_t ctrl = assuan_get_pointer (ctx); + gpg_error_t err; + estream_t outfp; + + /* No options for now. */ + line = skip_options (line); + + /* Setup an output stream and perform the get. */ + outfp = es_fopencookie (ctx, "w", data_line_cookie_functions); + if (!outfp) + err = set_error (GPG_ERR_ASS_GENERAL, "error setting up a data stream"); + else + { + err = ks_action_fetch (ctrl, line, outfp); + es_fclose (outfp); + } + + return leave_cmd (ctx, err); +} + + static const char hlp_ks_put[] = "KS_PUT\n" @@ -1742,6 +1770,7 @@ register_commands (assuan_context_t ctx) { "KEYSERVER", cmd_keyserver, hlp_keyserver }, { "KS_SEARCH", cmd_ks_search, hlp_ks_search }, { "KS_GET", cmd_ks_get, hlp_ks_get }, + { "KS_FETCH", cmd_ks_fetch, hlp_ks_fetch }, { "KS_PUT", cmd_ks_put, hlp_ks_put }, { "GETINFO", cmd_getinfo, hlp_getinfo }, { "KILLDIRMNGR",cmd_killdirmngr,hlp_killdirmngr }, -- cgit v1.2.3