[svn] GnuPG - r4065 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Tue Mar 14 03:42:03 CET 2006
Author: dshaw
Date: 2006-03-14 03:42:02 +0100 (Tue, 14 Mar 2006)
New Revision: 4065
Modified:
trunk/g10/ChangeLog
trunk/g10/getkey.c
trunk/g10/keyserver-internal.h
trunk/g10/keyserver.c
Log:
* keyserver-internal.h, keyserver.c (keyserver_spawn, keyserver_work,
keyserver_import_cert, keyserver_import_name, keyserver_import_ldap):
Pass fingerprint info through.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2006-03-14 02:23:00 UTC (rev 4064)
+++ trunk/g10/ChangeLog 2006-03-14 02:42:02 UTC (rev 4065)
@@ -1,5 +1,9 @@
2006-03-13 David Shaw <dshaw at jabberwocky.com>
+ * keyserver-internal.h, keyserver.c (keyserver_spawn,
+ keyserver_work, keyserver_import_cert, keyserver_import_name,
+ keyserver_import_ldap): Pass fingerprint info through.
+
* main.h, import.c (import_one): Optionally return the fingerprint
of the key being imported.
(import_keys_internal, import_keys_stream, import): Change all
Modified: trunk/g10/getkey.c
===================================================================
--- trunk/g10/getkey.c 2006-03-14 02:23:00 UTC (rev 4064)
+++ trunk/g10/getkey.c 2006-03-14 02:42:02 UTC (rev 4065)
@@ -926,7 +926,7 @@
{
case AKL_CERT:
glo_ctrl.in_auto_key_retrieve++;
- res=keyserver_import_cert(name);
+ res=keyserver_import_cert(name,NULL,NULL);
glo_ctrl.in_auto_key_retrieve--;
if(res==0)
@@ -963,7 +963,7 @@
case AKL_LDAP:
glo_ctrl.in_auto_key_retrieve++;
- res=keyserver_import_ldap(name);
+ res=keyserver_import_ldap(name,NULL,NULL);
glo_ctrl.in_auto_key_retrieve--;
if(res==0)
@@ -979,7 +979,7 @@
if(opt.keyserver)
{
glo_ctrl.in_auto_key_retrieve++;
- res=keyserver_import_name(name,opt.keyserver);
+ res=keyserver_import_name(name,NULL,NULL,opt.keyserver);
glo_ctrl.in_auto_key_retrieve--;
if(res==0)
@@ -994,7 +994,7 @@
keyserver=keyserver_match(akl->spec);
glo_ctrl.in_auto_key_retrieve++;
- res=keyserver_import_name(name,keyserver);
+ res=keyserver_import_name(name,NULL,NULL,keyserver);
glo_ctrl.in_auto_key_retrieve--;
if(res==0)
Modified: trunk/g10/keyserver-internal.h
===================================================================
--- trunk/g10/keyserver-internal.h 2006-03-14 02:23:00 UTC (rev 4064)
+++ trunk/g10/keyserver-internal.h 2006-03-14 02:42:02 UTC (rev 4065)
@@ -43,9 +43,12 @@
int keyserver_refresh(STRLIST users);
int keyserver_search(STRLIST tokens);
int keyserver_fetch(STRLIST urilist);
-int keyserver_import_cert(const char *name);
+int keyserver_import_cert(const char *name,
+ unsigned char **fpr,size_t *fpr_len);
int keyserver_import_pka(const char *name,unsigned char *fpr);
-int keyserver_import_name(const char *name,struct keyserver_spec *keyserver);
-int keyserver_import_ldap(const char *name);
+int keyserver_import_name(const char *name,unsigned char **fpr,size_t *fpr_len,
+ struct keyserver_spec *keyserver);
+int keyserver_import_ldap(const char *name,
+ unsigned char **fpr,size_t *fpr_len);
#endif /* !_KEYSERVER_INTERNAL_H_ */
Modified: trunk/g10/keyserver.c
===================================================================
--- trunk/g10/keyserver.c 2006-03-14 02:23:00 UTC (rev 4064)
+++ trunk/g10/keyserver.c 2006-03-14 02:42:02 UTC (rev 4065)
@@ -92,6 +92,7 @@
static int keyserver_work(enum ks_action action,STRLIST list,
KEYDB_SEARCH_DESC *desc,int count,
+ unsigned char **fpr,size_t *fpr_len,
struct keyserver_spec *keyserver);
/* Reasonable guess */
@@ -754,7 +755,8 @@
while((num=strsep(&split," ,"))!=NULL)
if(atoi(num)>=1 && atoi(num)<=numdesc)
- keyserver_work(KS_GET,NULL,&desc[atoi(num)-1],1,opt.keyserver);
+ keyserver_work(KS_GET,NULL,&desc[atoi(num)-1],1,
+ NULL,NULL,opt.keyserver);
xfree(answer);
return 1;
@@ -956,7 +958,8 @@
static int
keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
- int count,int *prog,struct keyserver_spec *keyserver)
+ int count,int *prog,unsigned char **fpr,size_t *fpr_len,
+ struct keyserver_spec *keyserver)
{
int ret=0,i,gotversion=0,outofband=0;
STRLIST temp;
@@ -1457,7 +1460,7 @@
way to do this could be to continue parsing this
line-by-line and make a temp iobuf for each key. */
- import_keys_stream(spawn->fromchild,stats_handle,NULL,NULL,
+ import_keys_stream(spawn->fromchild,stats_handle,fpr,fpr_len,
opt.keyserver_options.import_options);
import_print_stats(stats_handle);
@@ -1491,7 +1494,8 @@
static int
keyserver_work(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
- int count,struct keyserver_spec *keyserver)
+ int count,unsigned char **fpr,size_t *fpr_len,
+ struct keyserver_spec *keyserver)
{
int rc=0,ret=0;
@@ -1509,7 +1513,7 @@
#else
/* Spawn a handler */
- rc=keyserver_spawn(action,list,desc,count,&ret,keyserver);
+ rc=keyserver_spawn(action,list,desc,count,&ret,fpr,fpr_len,keyserver);
if(ret)
{
switch(ret)
@@ -1583,7 +1587,7 @@
if(sl)
{
- rc=keyserver_work(KS_SEND,sl,NULL,0,opt.keyserver);
+ rc=keyserver_work(KS_SEND,sl,NULL,0,NULL,NULL,opt.keyserver);
free_strlist(sl);
}
@@ -1621,7 +1625,7 @@
}
if(count>0)
- rc=keyserver_work(KS_GET,NULL,desc,count,opt.keyserver);
+ rc=keyserver_work(KS_GET,NULL,desc,count,NULL,NULL,opt.keyserver);
xfree(desc);
@@ -1645,7 +1649,9 @@
memcpy(desc.u.fpr,fprint,fprint_len);
- return keyserver_work(KS_GET,NULL,&desc,1,keyserver);
+ /* TODO: Warn here if the fingerprint we got doesn't match the one
+ we asked for? */
+ return keyserver_work(KS_GET,NULL,&desc,1,NULL,NULL,keyserver);
}
int
@@ -1659,7 +1665,7 @@
desc.u.kid[0]=keyid[0];
desc.u.kid[1]=keyid[1];
- return keyserver_work(KS_GET,NULL,&desc,1,keyserver);
+ return keyserver_work(KS_GET,NULL,&desc,1,NULL,NULL,keyserver);
}
/* code mostly stolen from do_export_stream */
@@ -1863,7 +1869,7 @@
Note that a preferred keyserver without a scheme://
will be interpreted as hkp:// */
- rc=keyserver_work(KS_GET,NULL,&desc[i],1,keyserver);
+ rc=keyserver_work(KS_GET,NULL,&desc[i],1,NULL,NULL,keyserver);
if(rc)
log_info(_("WARNING: unable to refresh key %s"
" via %s: %s\n"),keystr_from_desc(&desc[i]),
@@ -1893,7 +1899,7 @@
count,opt.keyserver->uri);
}
- rc=keyserver_work(KS_GET,NULL,desc,numdesc,opt.keyserver);
+ rc=keyserver_work(KS_GET,NULL,desc,numdesc,NULL,NULL,opt.keyserver);
}
xfree(desc);
@@ -1912,7 +1918,7 @@
keyserver_search(STRLIST tokens)
{
if(tokens)
- return keyserver_work(KS_SEARCH,tokens,NULL,0,opt.keyserver);
+ return keyserver_work(KS_SEARCH,tokens,NULL,0,NULL,NULL,opt.keyserver);
else
return 0;
}
@@ -1952,7 +1958,7 @@
*/
spec->flags.direct_uri=1;
- rc=keyserver_work(KS_GET,NULL,&desc,1,spec);
+ rc=keyserver_work(KS_GET,NULL,&desc,1,NULL,NULL,spec);
if(rc)
log_info (_("WARNING: unable to fetch URI %s: %s\n"),
sl->d,g10_errstr(rc));
@@ -1975,7 +1981,7 @@
/* Import key in a CERT or pointed to by a CERT */
int
-keyserver_import_cert(const char *name)
+keyserver_import_cert(const char *name,unsigned char **fpr,size_t *fpr_len)
{
char *domain,*look,*url;
IOBUF key;
@@ -1995,7 +2001,7 @@
/* CERTs are always in binary format */
opt.no_armor=1;
- rc=import_keys_stream(key,NULL,NULL,NULL,
+ rc=import_keys_stream(key,NULL,fpr,fpr_len,
opt.keyserver_options.import_options);
opt.no_armor=armor_status;
@@ -2053,14 +2059,15 @@
/* Import all keys that match name */
int
-keyserver_import_name(const char *name,struct keyserver_spec *keyserver)
+keyserver_import_name(const char *name,unsigned char **fpr,size_t *fpr_len,
+ struct keyserver_spec *keyserver)
{
STRLIST list=NULL;
int rc;
append_to_strlist(&list,name);
- rc=keyserver_work(KS_GETNAME,list,NULL,0,keyserver);
+ rc=keyserver_work(KS_GETNAME,list,NULL,0,fpr,fpr_len,keyserver);
free_strlist(list);
@@ -2070,7 +2077,7 @@
/* Use the PGP Universal trick of asking ldap://keys.(maildomain) for
the key. */
int
-keyserver_import_ldap(const char *name)
+keyserver_import_ldap(const char *name,unsigned char **fpr,size_t *fpr_len)
{
char *domain;
struct keyserver_spec *keyserver;
@@ -2098,7 +2105,7 @@
strcat(keyserver->uri,"://");
strcat(keyserver->uri,keyserver->host);
- rc=keyserver_work(KS_GETNAME,list,NULL,0,keyserver);
+ rc=keyserver_work(KS_GETNAME,list,NULL,0,fpr,fpr_len,keyserver);
free_strlist(list);
More information about the Gnupg-commits
mailing list