mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
* card-util.c (fetch_url, card_edit): Use the pubkey URL stored on the
card to fetch an updated copy. Works with either straight URLs or HKP or LDAP keyservers. * keyserver-internal.h, keyserver.c (keyserver_import_fprint), import.c (revocation_present): Use a keyserver_spec so the caller can pass in whatever keyserver they like.
This commit is contained in:
parent
dccd0d991b
commit
45f99c58bb
@ -1,3 +1,13 @@
|
||||
2004-09-11 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* card-util.c (fetch_url, card_edit): Use the pubkey URL stored on
|
||||
the card to fetch an updated copy. Works with either straight
|
||||
URLs or HKP or LDAP keyservers.
|
||||
|
||||
* keyserver-internal.h, keyserver.c (keyserver_import_fprint),
|
||||
import.c (revocation_present): Use a keyserver_spec so the caller
|
||||
can pass in whatever keyserver they like.
|
||||
|
||||
2004-09-10 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* app-openpgp.c (get_cached_data): Avoid mallocing zero since it
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "status.h"
|
||||
#include "options.h"
|
||||
#include "main.h"
|
||||
#include "keyserver-internal.h"
|
||||
#if GNUPG_MAJOR_VERSION == 1
|
||||
#include "cardglue.h"
|
||||
#else
|
||||
@ -510,6 +511,49 @@ change_url (void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
fetch_url(void)
|
||||
{
|
||||
int rc;
|
||||
struct agent_card_info_s info;
|
||||
|
||||
memset(&info,0,sizeof(info));
|
||||
|
||||
rc=agent_scd_getattr("PUBKEY-URL",&info);
|
||||
if(rc)
|
||||
log_error("error retrieving URL from card: %s\n",gpg_strerror(rc));
|
||||
else if(info.pubkey_url)
|
||||
{
|
||||
struct keyserver_spec *spec=NULL;
|
||||
|
||||
rc=agent_scd_getattr("KEY-FPR",&info);
|
||||
if(rc)
|
||||
log_error("error retrieving key fingerprint from card: %s\n",
|
||||
gpg_strerror(rc));
|
||||
else
|
||||
{
|
||||
spec=parse_keyserver_uri(info.pubkey_url,0,NULL,0);
|
||||
if(spec && info.fpr1valid)
|
||||
{
|
||||
/* This is not perfectly right. Currently, all card
|
||||
fingerprints are 20 digits, but what about
|
||||
fingerprints for a future v5 key? We should get the
|
||||
length from somewhere lower in the code. In any
|
||||
event, the fpr/keyid is not meaningful for straight
|
||||
HTTP fetches, but using it allows the card to point
|
||||
to HKP and LDAP servers as well. */
|
||||
rc=keyserver_import_fprint(info.fpr1,20,spec);
|
||||
free_keyserver_spec(spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
log_error("no URL set on card\n");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
change_login (const char *args)
|
||||
{
|
||||
@ -792,7 +836,7 @@ card_edit (STRLIST commands)
|
||||
enum cmdids {
|
||||
cmdNOP = 0,
|
||||
cmdQUIT, cmdHELP, cmdLIST, cmdDEBUG,
|
||||
cmdNAME, cmdURL, cmdLOGIN, cmdLANG, cmdSEX, cmdCAFPR,
|
||||
cmdNAME, cmdURL, cmdFETCH, cmdLOGIN, cmdLANG, cmdSEX, cmdCAFPR,
|
||||
cmdFORCESIG, cmdGENERATE, cmdPASSWD,
|
||||
cmdINVCMD
|
||||
};
|
||||
@ -811,6 +855,7 @@ card_edit (STRLIST commands)
|
||||
{ N_("debug") , cmdDEBUG , NULL },
|
||||
{ N_("name") , cmdNAME , N_("change card holder's name") },
|
||||
{ N_("url") , cmdURL , N_("change URL to retrieve key") },
|
||||
{ N_("fetch") , cmdFETCH , N_("fetch the key specified in the card URL") },
|
||||
{ N_("login") , cmdLOGIN , N_("change the login name") },
|
||||
{ N_("lang") , cmdLANG , N_("change the language preferences") },
|
||||
{ N_("sex") , cmdSEX , N_("change card holder's sex") },
|
||||
@ -932,6 +977,10 @@ card_edit (STRLIST commands)
|
||||
change_url ();
|
||||
break;
|
||||
|
||||
case cmdFETCH:
|
||||
fetch_url();
|
||||
break;
|
||||
|
||||
case cmdLOGIN:
|
||||
change_login (arg_string);
|
||||
break;
|
||||
|
@ -1699,7 +1699,8 @@ revocation_present(KBNODE keyblock)
|
||||
" fetching revocation key %s\n"),
|
||||
tempkeystr,keystr(keyid));
|
||||
keyserver_import_fprint(sig->revkey[idx]->fpr,
|
||||
MAX_FINGERPRINT_LEN);
|
||||
MAX_FINGERPRINT_LEN,
|
||||
opt.keyserver);
|
||||
|
||||
/* Do we have it now? */
|
||||
rc=get_pubkey_byfprint_fast (NULL,
|
||||
|
@ -34,7 +34,8 @@ struct keyserver_spec *parse_keyserver_uri(const char *uri,int require_scheme,
|
||||
struct keyserver_spec *parse_preferred_keyserver(PKT_signature *sig);
|
||||
int keyserver_export(STRLIST users);
|
||||
int keyserver_import(STRLIST users);
|
||||
int keyserver_import_fprint(const byte *fprint,size_t fprint_len);
|
||||
int keyserver_import_fprint(const byte *fprint,size_t fprint_len,
|
||||
struct keyserver_spec *keyserver);
|
||||
int keyserver_import_keyid(u32 *keyid,struct keyserver_spec *keyserver);
|
||||
int keyserver_refresh(STRLIST users);
|
||||
int keyserver_search(STRLIST tokens);
|
||||
|
@ -1318,7 +1318,8 @@ keyserver_import(STRLIST users)
|
||||
}
|
||||
|
||||
int
|
||||
keyserver_import_fprint(const byte *fprint,size_t fprint_len)
|
||||
keyserver_import_fprint(const byte *fprint,size_t fprint_len,
|
||||
struct keyserver_spec *keyserver)
|
||||
{
|
||||
KEYDB_SEARCH_DESC desc;
|
||||
|
||||
@ -1333,7 +1334,7 @@ keyserver_import_fprint(const byte *fprint,size_t fprint_len)
|
||||
|
||||
memcpy(desc.u.fpr,fprint,fprint_len);
|
||||
|
||||
return keyserver_work(GET,NULL,&desc,1,opt.keyserver);
|
||||
return keyserver_work(GET,NULL,&desc,1,keyserver);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
x
Reference in New Issue
Block a user