mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 ;-)
This commit is contained in:
parent
8a7336e0bf
commit
2c79a2832c
14 changed files with 606 additions and 102 deletions
|
@ -132,7 +132,7 @@ ks_action_get (ctrl_t ctrl, strlist_t patterns, estream_t outfp)
|
|||
else
|
||||
{
|
||||
err = copy_stream (infp, outfp);
|
||||
/* Reading from the keyserver should nver fail, thus
|
||||
/* Reading from the keyserver should never fail, thus
|
||||
return this error. */
|
||||
es_fclose (infp);
|
||||
infp = NULL;
|
||||
|
@ -149,6 +149,49 @@ ks_action_get (ctrl_t ctrl, strlist_t patterns, estream_t outfp)
|
|||
}
|
||||
|
||||
|
||||
/* Retrive keys from URL and write the result to the provided output
|
||||
stream OUTFP. */
|
||||
gpg_error_t
|
||||
ks_action_fetch (ctrl_t ctrl, const char *url, estream_t outfp)
|
||||
{
|
||||
gpg_error_t err = 0;
|
||||
estream_t infp;
|
||||
parsed_uri_t parsed_uri; /* The broken down URI. */
|
||||
|
||||
if (!url)
|
||||
return gpg_error (GPG_ERR_INV_URI);
|
||||
|
||||
err = http_parse_uri (&parsed_uri, url, 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (parsed_uri->is_http)
|
||||
{
|
||||
err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
}
|
||||
else if (!parsed_uri->opaque)
|
||||
{
|
||||
err = gpg_error (GPG_ERR_INV_URI);
|
||||
}
|
||||
else if (!strcmp (parsed_uri->scheme, "finger"))
|
||||
{
|
||||
err = ks_finger_get (ctrl, parsed_uri, &infp);
|
||||
if (!err)
|
||||
{
|
||||
err = copy_stream (infp, outfp);
|
||||
/* Reading from the finger serrver should not fail, thus
|
||||
return this error. */
|
||||
es_fclose (infp);
|
||||
}
|
||||
}
|
||||
else
|
||||
err = gpg_error (GPG_ERR_INV_URI);
|
||||
|
||||
http_release_parsed_uri (parsed_uri);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Send an OpenPGP key to all keyservers. The key in {DATA,DATALEN}
|
||||
is expected in OpenPGP binary transport format. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue