mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
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 <wk@gnupg.org>
This commit is contained in:
parent
04b56eff11
commit
bee65edfbc
@ -1491,7 +1491,11 @@ ks_hkp_search (ctrl_t ctrl, parsed_uri_t uri, const char *pattern,
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
{
|
||||||
|
if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||||
|
dirmngr_status (ctrl, "SOURCE", hostport, NULL);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
err = dirmngr_status (ctrl, "SOURCE", hostport, NULL);
|
err = dirmngr_status (ctrl, "SOURCE", hostport, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
@ -1626,7 +1630,11 @@ ks_hkp_get (ctrl_t ctrl, parsed_uri_t uri, const char *keyspec, estream_t *r_fp)
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
{
|
||||||
|
if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||||
|
dirmngr_status (ctrl, "SOURCE", hostport, NULL);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
err = dirmngr_status (ctrl, "SOURCE", hostport, NULL);
|
err = dirmngr_status (ctrl, "SOURCE", hostport, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -608,6 +608,12 @@ gpg_dirmngr_ks_search (ctrl_t ctrl, const char *searchstr,
|
|||||||
NULL, NULL, ks_status_cb, &stparm);
|
NULL, NULL, ks_status_cb, &stparm);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = cb (cb_value, 0, NULL); /* Send EOF. */
|
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 (get_membuf (&parm.saveddata, NULL));
|
||||||
xfree (parm.helpbuf);
|
xfree (parm.helpbuf);
|
||||||
@ -650,6 +656,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
|
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.
|
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
|
If there are too many patterns the function returns an error. That
|
||||||
could be fixed by issuing several search commands or by
|
could be fixed by issuing several search commands or by
|
||||||
@ -737,13 +744,13 @@ gpg_dirmngr_ks_get (ctrl_t ctrl, char **pattern,
|
|||||||
*r_fp = parm.memfp;
|
*r_fp = parm.memfp;
|
||||||
parm.memfp = NULL;
|
parm.memfp = NULL;
|
||||||
|
|
||||||
if (r_source)
|
|
||||||
|
leave:
|
||||||
|
if (r_source && stparm.source)
|
||||||
{
|
{
|
||||||
*r_source = stparm.source;
|
*r_source = stparm.source;
|
||||||
stparm.source = NULL;
|
stparm.source = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave:
|
|
||||||
es_fclose (parm.memfp);
|
es_fclose (parm.memfp);
|
||||||
xfree (stparm.source);
|
xfree (stparm.source);
|
||||||
xfree (line);
|
xfree (line);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user