[svn] GnuPG - r3956 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Wed Dec 7 23:34:13 CET 2005
Author: dshaw
Date: 2005-12-07 23:34:11 +0100 (Wed, 07 Dec 2005)
New Revision: 3956
Modified:
trunk/g10/ChangeLog
trunk/g10/gpg.c
trunk/g10/keyserver-internal.h
trunk/g10/keyserver.c
Log:
* 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.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2005-12-07 22:25:58 UTC (rev 3955)
+++ trunk/g10/ChangeLog 2005-12-07 22:34:11 UTC (rev 3956)
@@ -1,3 +1,13 @@
+2005-12-07 David Shaw <dshaw at 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 at jabberwocky.com>
* main.h, keylist.c (print_revokers): New. Print the "rvk"
Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c 2005-12-07 22:25:58 UTC (rev 3955)
+++ trunk/g10/gpg.c 2005-12-07 22:34:11 UTC (rev 3956)
@@ -127,6 +127,8 @@
aSendKeys,
aRecvKeys,
aSearchKeys,
+ aRefreshKeys,
+ aFetchKeys,
aExport,
aExportSecret,
aExportSecretSub,
@@ -149,7 +151,6 @@
aGenRandom,
aPipeMode,
aRebuildKeydbCaches,
- aRefreshKeys,
aCardStatus,
aCardEdit,
aChangePIN,
@@ -399,6 +400,7 @@
N_("search for keys on a key server") },
{ aRefreshKeys, "refresh-keys", 256,
N_("update all keys from a keyserver")},
+ { aFetchKeys, "fetch-keys" , 256, "@" },
{ aExportSecret, "export-secret-keys" , 256, "@" },
{ aExportSecretSub, "export-secret-subkeys" , 256, "@" },
{ aImport, "import", 256 , N_("import/merge keys")},
@@ -1901,6 +1903,7 @@
case aRecvKeys:
case aSearchKeys:
case aRefreshKeys:
+ case aFetchKeys:
case aExport:
set_cmd (&cmd, pargs.r_opt);
break;
@@ -3389,6 +3392,16 @@
free_strlist(sl);
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:
sl = NULL;
for( ; argc; argc--, argv++ )
Modified: trunk/g10/keyserver-internal.h
===================================================================
--- trunk/g10/keyserver-internal.h 2005-12-07 22:25:58 UTC (rev 3955)
+++ trunk/g10/keyserver-internal.h 2005-12-07 22:34:11 UTC (rev 3956)
@@ -40,5 +40,6 @@
int keyserver_import_keyid(u32 *keyid,struct keyserver_spec *keyserver);
int keyserver_refresh(STRLIST users);
int keyserver_search(STRLIST tokens);
+int keyserver_fetch(STRLIST urilist);
#endif /* !_KEYSERVER_INTERNAL_H_ */
Modified: trunk/g10/keyserver.c
===================================================================
--- trunk/g10/keyserver.c 2005-12-07 22:25:58 UTC (rev 3955)
+++ trunk/g10/keyserver.c 2005-12-07 22:34:11 UTC (rev 3956)
@@ -883,7 +883,7 @@
keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
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;
unsigned int maxlen,buflen;
char *command,*end,*searchstr=NULL;
@@ -1047,18 +1047,26 @@
else if(desc[i].mode==KEYDB_SEARCH_MODE_SHORT_KID)
fprintf(spawn->tochild,"0x%08lX\n",
(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)
continue;
else
BUG();
- if(keyserver->host)
- log_info(_("requesting key %s from %s server %s\n"),
- keystr_from_desc(&desc[i]),
- keyserver->scheme,keyserver->host);
- else
- log_info(_("requesting key %s from %s\n"),
- keystr_from_desc(&desc[i]),keyserver->uri);
+ if(!quiet)
+ {
+ if(keyserver->host)
+ log_info(_("requesting key %s from %s server %s\n"),
+ keystr_from_desc(&desc[i]),
+ keyserver->scheme,keyserver->host);
+ else
+ log_info(_("requesting key %s from %s\n"),
+ keystr_from_desc(&desc[i]),keyserver->uri);
+ }
}
fprintf(spawn->tochild,"\n");
@@ -1705,7 +1713,7 @@
/* Note this is different than the original HKP refresh. It allows
usernames to refresh only part of the keyring. */
-int
+int
keyserver_refresh(STRLIST users)
{
int rc,count,numdesc,fakev3=0;
@@ -1802,3 +1810,34 @@
else
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;
+}
More information about the Gnupg-commits
mailing list