summaryrefslogtreecommitdiffstats
path: root/dirmngr/ks-action.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2011-01-20 14:12:53 +0100
committerWerner Koch <wk@gnupg.org>2011-01-20 14:12:53 +0100
commit7f32d88ed1b81719e0cda11710fc66745deee6e2 (patch)
tree569ba918414268e5cee2eebaa7de3e23b6bbe277 /dirmngr/ks-action.c
parentKeyserver search and get basically works again. (diff)
downloadgnupg2-7f32d88ed1b81719e0cda11710fc66745deee6e2.tar.xz
gnupg2-7f32d88ed1b81719e0cda11710fc66745deee6e2.zip
All standard keyserver commands are now using dirmngr.
Diffstat (limited to 'dirmngr/ks-action.c')
-rw-r--r--dirmngr/ks-action.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/dirmngr/ks-action.c b/dirmngr/ks-action.c
index f376c27d1..fd2a2b568 100644
--- a/dirmngr/ks-action.c
+++ b/dirmngr/ks-action.c
@@ -90,7 +90,7 @@ ks_action_search (ctrl_t ctrl, strlist_t patterns, estream_t outfp)
}
-/* Get the requested keys (macthing PATTERNS) using all configured
+/* Get the requested keys (matching PATTERNS) using all configured
keyservers and write the result to the provided output stream. */
gpg_error_t
ks_action_get (ctrl_t ctrl, strlist_t patterns, estream_t outfp)
@@ -148,3 +148,36 @@ ks_action_get (ctrl_t ctrl, strlist_t patterns, estream_t outfp)
return err;
}
+
+
+/* Send an OpenPGP key to all keyservers. The key in {DATA,DATALEN}
+ is expected in OpenPGP binary transport format. */
+gpg_error_t
+ks_action_put (ctrl_t ctrl, const void *data, size_t datalen)
+{
+ gpg_error_t err = 0;
+ gpg_error_t first_err = 0;
+ int any = 0;
+ uri_item_t uri;
+
+ for (uri = ctrl->keyservers; !err && uri; uri = uri->next)
+ {
+ if (uri->parsed_uri->is_http)
+ {
+ any = 1;
+ err = ks_hkp_put (ctrl, uri->parsed_uri, data, datalen);
+ if (err)
+ {
+ first_err = err;
+ err = 0;
+ }
+ }
+ }
+
+ if (!any)
+ err = gpg_error (GPG_ERR_NO_KEYSERVER);
+ else if (!err && first_err)
+ err = first_err; /* fixme: Do we really want to do that? */
+ return err;
+}
+