mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-09 12:54:23 +01:00
* keyserver.c (keyserver_spawn): Don't print "searching for key 00000000"
when fetching a URI. * keyserver-internal.h, keyserver.c (keyserver_fetch): New. Fetch an arbitrary URI using the keyserver helpers. * gpg.c (main): Call it from here for --fetch-keys.
This commit is contained in:
parent
c826ccdec1
commit
05193a2705
@ -1,3 +1,13 @@
|
|||||||
|
2005-12-07 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* keyserver.c (keyserver_spawn): Don't print "searching for key
|
||||||
|
00000000" when fetching a URI.
|
||||||
|
|
||||||
|
* keyserver-internal.h, keyserver.c (keyserver_fetch): New. Fetch
|
||||||
|
an arbitrary URI using the keyserver helpers.
|
||||||
|
|
||||||
|
* gpg.c (main): Call it from here for --fetch-keys.
|
||||||
|
|
||||||
2005-11-20 David Shaw <dshaw@jabberwocky.com>
|
2005-11-20 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* main.h, keylist.c (print_revokers): New. Print the "rvk"
|
* main.h, keylist.c (print_revokers): New. Print the "rvk"
|
||||||
|
15
g10/gpg.c
15
g10/gpg.c
@ -127,6 +127,8 @@ enum cmd_and_opt_values
|
|||||||
aSendKeys,
|
aSendKeys,
|
||||||
aRecvKeys,
|
aRecvKeys,
|
||||||
aSearchKeys,
|
aSearchKeys,
|
||||||
|
aRefreshKeys,
|
||||||
|
aFetchKeys,
|
||||||
aExport,
|
aExport,
|
||||||
aExportSecret,
|
aExportSecret,
|
||||||
aExportSecretSub,
|
aExportSecretSub,
|
||||||
@ -149,7 +151,6 @@ enum cmd_and_opt_values
|
|||||||
aGenRandom,
|
aGenRandom,
|
||||||
aPipeMode,
|
aPipeMode,
|
||||||
aRebuildKeydbCaches,
|
aRebuildKeydbCaches,
|
||||||
aRefreshKeys,
|
|
||||||
aCardStatus,
|
aCardStatus,
|
||||||
aCardEdit,
|
aCardEdit,
|
||||||
aChangePIN,
|
aChangePIN,
|
||||||
@ -399,6 +400,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
N_("search for keys on a key server") },
|
N_("search for keys on a key server") },
|
||||||
{ aRefreshKeys, "refresh-keys", 256,
|
{ aRefreshKeys, "refresh-keys", 256,
|
||||||
N_("update all keys from a keyserver")},
|
N_("update all keys from a keyserver")},
|
||||||
|
{ aFetchKeys, "fetch-keys" , 256, "@" },
|
||||||
{ aExportSecret, "export-secret-keys" , 256, "@" },
|
{ aExportSecret, "export-secret-keys" , 256, "@" },
|
||||||
{ aExportSecretSub, "export-secret-subkeys" , 256, "@" },
|
{ aExportSecretSub, "export-secret-subkeys" , 256, "@" },
|
||||||
{ aImport, "import", 256 , N_("import/merge keys")},
|
{ aImport, "import", 256 , N_("import/merge keys")},
|
||||||
@ -1901,6 +1903,7 @@ main (int argc, char **argv )
|
|||||||
case aRecvKeys:
|
case aRecvKeys:
|
||||||
case aSearchKeys:
|
case aSearchKeys:
|
||||||
case aRefreshKeys:
|
case aRefreshKeys:
|
||||||
|
case aFetchKeys:
|
||||||
case aExport:
|
case aExport:
|
||||||
set_cmd (&cmd, pargs.r_opt);
|
set_cmd (&cmd, pargs.r_opt);
|
||||||
break;
|
break;
|
||||||
@ -3389,6 +3392,16 @@ main (int argc, char **argv )
|
|||||||
free_strlist(sl);
|
free_strlist(sl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case aFetchKeys:
|
||||||
|
sl = NULL;
|
||||||
|
for( ; argc; argc--, argv++ )
|
||||||
|
add_to_strlist2( &sl, *argv, utf8_strings );
|
||||||
|
rc=keyserver_fetch(sl);
|
||||||
|
if(rc)
|
||||||
|
log_error("key fetch failed: %s\n",g10_errstr(rc));
|
||||||
|
free_strlist(sl);
|
||||||
|
break;
|
||||||
|
|
||||||
case aExportSecret:
|
case aExportSecret:
|
||||||
sl = NULL;
|
sl = NULL;
|
||||||
for( ; argc; argc--, argv++ )
|
for( ; argc; argc--, argv++ )
|
||||||
|
@ -40,5 +40,6 @@ int keyserver_import_fprint(const byte *fprint,size_t fprint_len,
|
|||||||
int keyserver_import_keyid(u32 *keyid,struct keyserver_spec *keyserver);
|
int keyserver_import_keyid(u32 *keyid,struct keyserver_spec *keyserver);
|
||||||
int keyserver_refresh(STRLIST users);
|
int keyserver_refresh(STRLIST users);
|
||||||
int keyserver_search(STRLIST tokens);
|
int keyserver_search(STRLIST tokens);
|
||||||
|
int keyserver_fetch(STRLIST urilist);
|
||||||
|
|
||||||
#endif /* !_KEYSERVER_INTERNAL_H_ */
|
#endif /* !_KEYSERVER_INTERNAL_H_ */
|
||||||
|
@ -883,7 +883,7 @@ static int
|
|||||||
keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
||||||
int count,int *prog,struct keyserver_spec *keyserver)
|
int count,int *prog,struct keyserver_spec *keyserver)
|
||||||
{
|
{
|
||||||
int ret=0,i,gotversion=0,outofband=0;
|
int ret=0,i,gotversion=0,outofband=0,quiet=0;
|
||||||
STRLIST temp;
|
STRLIST temp;
|
||||||
unsigned int maxlen,buflen;
|
unsigned int maxlen,buflen;
|
||||||
char *command,*end,*searchstr=NULL;
|
char *command,*end,*searchstr=NULL;
|
||||||
@ -1047,18 +1047,26 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
|||||||
else if(desc[i].mode==KEYDB_SEARCH_MODE_SHORT_KID)
|
else if(desc[i].mode==KEYDB_SEARCH_MODE_SHORT_KID)
|
||||||
fprintf(spawn->tochild,"0x%08lX\n",
|
fprintf(spawn->tochild,"0x%08lX\n",
|
||||||
(ulong)desc[i].u.kid[1]);
|
(ulong)desc[i].u.kid[1]);
|
||||||
|
else if(desc[i].mode==KEYDB_SEARCH_MODE_EXACT)
|
||||||
|
{
|
||||||
|
fprintf(spawn->tochild,"0x0000000000000000\n");
|
||||||
|
quiet=1;
|
||||||
|
}
|
||||||
else if(desc[i].mode==KEYDB_SEARCH_MODE_NONE)
|
else if(desc[i].mode==KEYDB_SEARCH_MODE_NONE)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
if(keyserver->host)
|
if(!quiet)
|
||||||
log_info(_("requesting key %s from %s server %s\n"),
|
{
|
||||||
keystr_from_desc(&desc[i]),
|
if(keyserver->host)
|
||||||
keyserver->scheme,keyserver->host);
|
log_info(_("requesting key %s from %s server %s\n"),
|
||||||
else
|
keystr_from_desc(&desc[i]),
|
||||||
log_info(_("requesting key %s from %s\n"),
|
keyserver->scheme,keyserver->host);
|
||||||
keystr_from_desc(&desc[i]),keyserver->uri);
|
else
|
||||||
|
log_info(_("requesting key %s from %s\n"),
|
||||||
|
keystr_from_desc(&desc[i]),keyserver->uri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(spawn->tochild,"\n");
|
fprintf(spawn->tochild,"\n");
|
||||||
@ -1802,3 +1810,34 @@ keyserver_search(STRLIST tokens)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
keyserver_fetch(STRLIST urilist)
|
||||||
|
{
|
||||||
|
KEYDB_SEARCH_DESC desc;
|
||||||
|
STRLIST sl;
|
||||||
|
|
||||||
|
/* A dummy desc since we're not actually fetching a particular key
|
||||||
|
ID */
|
||||||
|
memset(&desc,0,sizeof(desc));
|
||||||
|
desc.mode=KEYDB_SEARCH_MODE_EXACT;
|
||||||
|
|
||||||
|
for(sl=urilist;sl;sl=sl->next)
|
||||||
|
{
|
||||||
|
struct keyserver_spec *spec;
|
||||||
|
|
||||||
|
spec=parse_keyserver_uri(sl->d,1,NULL,0);
|
||||||
|
if(spec)
|
||||||
|
{
|
||||||
|
int rc=keyserver_work(GET,NULL,&desc,1,spec);
|
||||||
|
if(rc)
|
||||||
|
log_info("WARNING: unable to fetch URI %s: %s\n",
|
||||||
|
sl->d,g10_errstr(rc));
|
||||||
|
free_keyserver_spec(spec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
log_info("WARNING: unable to parse URI %s\n",sl->d);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user