diff options
author | Justus Winter <justus@g10code.com> | 2015-12-03 16:54:06 +0100 |
---|---|---|
committer | Justus Winter <justus@g10code.com> | 2015-12-04 13:02:56 +0100 |
commit | 6ac57a482f7ae02db1bee4e4b861288fc6905adc (patch) | |
tree | 17b7d7c101eb45dfdff60ffa372fc7e092ee81ca /dirmngr/ks-action.c | |
parent | dirmngr: Handle http status '501 Not Implemented'. (diff) | |
download | gnupg2-6ac57a482f7ae02db1bee4e4b861288fc6905adc.tar.xz gnupg2-6ac57a482f7ae02db1bee4e4b861288fc6905adc.zip |
dirmngr: Really search all keyservers for patterns.
* dirmngr/ks-action.c (ks_action_search): Search all configured
keyservers for the given patterns.
Signed-off-by: Justus Winter <justus@g10code.com>
GnuPG-bug-id: 1038
Diffstat (limited to 'dirmngr/ks-action.c')
-rw-r--r-- | dirmngr/ks-action.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/dirmngr/ks-action.c b/dirmngr/ks-action.c index dd4516aee..285167a17 100644 --- a/dirmngr/ks-action.c +++ b/dirmngr/ks-action.c @@ -144,6 +144,7 @@ ks_action_search (ctrl_t ctrl, uri_item_t keyservers, { gpg_error_t err = 0; int any_server = 0; + int any_results = 0; uri_item_t uri; estream_t infp; @@ -155,7 +156,9 @@ ks_action_search (ctrl_t ctrl, uri_item_t keyservers, parallel and merge them. We also need to decide what to do with errors - it might not be the best idea to ignore an error from one server and silently continue with another server. For now we - stop at the first error. */ + stop at the first error, unless it is GPG_ERR_NO_DATA, in which + case we try the next server. Unfortunately, 'send_requests' + broadly maps all kinds of http errors to GPG_ERR_NO_DATA. */ for (uri = keyservers; !err && uri; uri = uri->next) { int is_http = uri->parsed_uri->is_http; @@ -177,10 +180,18 @@ ks_action_search (ctrl_t ctrl, uri_item_t keyservers, err = ks_hkp_search (ctrl, uri->parsed_uri, patterns->d, &infp); } + if (err == gpg_error (GPG_ERR_NO_DATA)) + { + /* No record found. Clear error and try next server. */ + err = 0; + continue; + } + if (!err) { err = copy_stream (infp, outfp); es_fclose (infp); + any_results = 1; break; } } @@ -188,6 +199,8 @@ ks_action_search (ctrl_t ctrl, uri_item_t keyservers, if (!any_server) err = gpg_error (GPG_ERR_NO_KEYSERVER); + else if (err == 0 && !any_results) + err = gpg_error (GPG_ERR_NO_DATA); return err; } |