aboutsummaryrefslogtreecommitdiffstats
path: root/g10/call-dirmngr.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-09-07 09:48:18 +0000
committerWerner Koch <[email protected]>2018-11-05 08:13:39 +0000
commitab7a907a184f37ddafaa0dc7200c76b735ba4853 (patch)
treef90d7c84d0dc1dbaae324e821b2847b91527696a /g10/call-dirmngr.c
parentdirmngr: Fix LDAP port parsing. (diff)
downloadgnupg-ab7a907a184f37ddafaa0dc7200c76b735ba4853.tar.gz
gnupg-ab7a907a184f37ddafaa0dc7200c76b735ba4853.zip
dirmngr: Emit SOURCE status also on NO_DATA.
* dirmngr/ks-engine-hkp.c (ks_hkp_search): Send SOURCE status also on NO DATA error. (ks_hkp_get): Ditto. * g10/call-dirmngr.c (gpg_dirmngr_ks_search): Print "data source" info also on error. (gpg_dirmngr_ks_get): Ditto. -- If a keyserver does not return any data it can be useful to know which keyserver out of the pool answered. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit bee65edfbc8cc2c369e5941cc9d1a01a0519b388)
Diffstat (limited to '')
-rw-r--r--g10/call-dirmngr.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c
index d086cefca..8896f27d0 100644
--- a/g10/call-dirmngr.c
+++ b/g10/call-dirmngr.c
@@ -606,6 +606,12 @@ gpg_dirmngr_ks_search (ctrl_t ctrl, const char *searchstr,
NULL, NULL, ks_status_cb, &stparm);
if (!err)
err = cb (cb_value, 0, NULL); /* Send EOF. */
+ else if (parm.stparm->source)
+ {
+ /* Error but we received a SOURCE status. Tell via callback but
+ * ignore errors. */
+ parm.data_cb (parm.data_cb_value, 1, parm.stparm->source);
+ }
xfree (get_membuf (&parm.saveddata, NULL));
xfree (parm.helpbuf);
@@ -648,6 +654,7 @@ ks_get_data_cb (void *opaque, const void *data, size_t datalen)
If R_SOURCE is not NULL the source of the data is stored as a
malloced string there. If a source is not known NULL is stored.
+ Note that this may even be returned after an error.
If there are too many patterns the function returns an error. That
could be fixed by issuing several search commands or by
@@ -735,13 +742,13 @@ gpg_dirmngr_ks_get (ctrl_t ctrl, char **pattern,
*r_fp = parm.memfp;
parm.memfp = NULL;
- if (r_source)
+
+ leave:
+ if (r_source && stparm.source)
{
*r_source = stparm.source;
stparm.source = NULL;
}
-
- leave:
es_fclose (parm.memfp);
xfree (stparm.source);
xfree (line);