[svn] GnuPG - r4020 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Thu Feb 23 00:37:26 CET 2006
Author: dshaw
Date: 2006-02-23 00:37:23 +0100 (Thu, 23 Feb 2006)
New Revision: 4020
Modified:
trunk/g10/ChangeLog
trunk/g10/getkey.c
trunk/g10/gpgv.c
trunk/g10/keyserver-internal.h
trunk/g10/keyserver.c
trunk/g10/options.h
Log:
* options.h, keyserver-internal.h, keyserver.c (keyserver_import_name),
getkey.c (free_akl, parse_auto_key_locate, get_pubkey_byname): The obvious
next step: allow arbitrary keyservers in the auto-key-locate list.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2006-02-22 23:19:36 UTC (rev 4019)
+++ trunk/g10/ChangeLog 2006-02-22 23:37:23 UTC (rev 4020)
@@ -1,5 +1,10 @@
2006-02-22 David Shaw <dshaw at jabberwocky.com>
+ * options.h, keyserver-internal.h, keyserver.c
+ (keyserver_import_name), getkey.c (free_akl,
+ parse_auto_key_locate, get_pubkey_byname): The obvious next step:
+ allow arbitrary keyservers in the auto-key-locate list.
+
* options.h, keyserver.c (parse_keyserver_options): Remove
auto-cert-retrieve as it is no longer meaningful. Add
max-cert-size to allow users to pick a max key size retrieved via
Modified: trunk/g10/getkey.c
===================================================================
--- trunk/g10/getkey.c 2006-02-22 23:19:36 UTC (rev 4019)
+++ trunk/g10/getkey.c 2006-02-22 23:37:23 UTC (rev 4020)
@@ -979,7 +979,7 @@
if(opt.keyserver)
{
glo_ctrl.in_auto_key_retrieve++;
- res=keyserver_import_name(name);
+ res=keyserver_import_name(name,opt.keyserver);
glo_ctrl.in_auto_key_retrieve--;
if(res==0)
@@ -987,6 +987,16 @@
name,opt.keyserver->uri);
}
break;
+
+ case AKL_SPEC:
+ glo_ctrl.in_auto_key_retrieve++;
+ res=keyserver_import_name(name,akl->spec);
+ glo_ctrl.in_auto_key_retrieve--;
+
+ if(res==0)
+ log_info(_("Automatically retrieved `%s' via %s\n"),
+ name,akl->spec->uri);
+ break;
}
rc = key_byname( NULL, namelist, pk, NULL, 0,
@@ -2879,6 +2889,15 @@
return ctx->kr_handle;
}
+static void
+free_akl(struct akl *akl)
+{
+ if(akl->spec)
+ free_keyserver_spec(akl->spec);
+
+ xfree(akl);
+}
+
int
parse_auto_key_locate(char *options)
{
@@ -2901,9 +2920,11 @@
akl->type=AKL_LDAP;
else if(ascii_strcasecmp(tok,"keyserver")==0)
akl->type=AKL_KEYSERVER;
+ else if((akl->spec=parse_keyserver_uri(tok,1,NULL,0)))
+ akl->type=AKL_SPEC;
else
{
- xfree(akl);
+ free_akl(akl);
return 0;
}
@@ -2911,8 +2932,14 @@
for(last=opt.auto_key_locate;last && last->next;last=last->next)
{
/* Check for duplicates */
- if(last && last->type==akl->type)
- return 0;
+ if(last && last->type==akl->type
+ && (akl->type!=AKL_SPEC
+ || (akl->type==AKL_SPEC
+ && strcmp(last->spec->uri,akl->spec->uri)==0)))
+ {
+ free_akl(akl);
+ return 0;
+ }
}
if(last)
Modified: trunk/g10/gpgv.c
===================================================================
--- trunk/g10/gpgv.c 2006-02-22 23:19:36 UTC (rev 4019)
+++ trunk/g10/gpgv.c 2006-02-22 23:37:23 UTC (rev 4020)
@@ -287,7 +287,10 @@
keyserver_import_pka(const char *name,unsigned char *fpr) { return -1; }
int
-keyserver_import_name(const char *name) { return -1; }
+keyserver_import_name(const char *name,struct keyserver_spec *spec)
+{
+ return -1;
+}
int
keyserver_import_ldap(const char *name) { return -1; }
Modified: trunk/g10/keyserver-internal.h
===================================================================
--- trunk/g10/keyserver-internal.h 2006-02-22 23:19:36 UTC (rev 4019)
+++ trunk/g10/keyserver-internal.h 2006-02-22 23:37:23 UTC (rev 4020)
@@ -43,7 +43,7 @@
int keyserver_fetch(STRLIST urilist);
int keyserver_import_cert(const char *name);
int keyserver_import_pka(const char *name,unsigned char *fpr);
-int keyserver_import_name(const char *name);
+int keyserver_import_name(const char *name,struct keyserver_spec *keyserver);
int keyserver_import_ldap(const char *name);
#endif /* !_KEYSERVER_INTERNAL_H_ */
Modified: trunk/g10/keyserver.c
===================================================================
--- trunk/g10/keyserver.c 2006-02-22 23:19:36 UTC (rev 4019)
+++ trunk/g10/keyserver.c 2006-02-22 23:37:23 UTC (rev 4020)
@@ -2001,14 +2001,14 @@
/* Import all keys that match name */
int
-keyserver_import_name(const char *name)
+keyserver_import_name(const char *name,struct keyserver_spec *keyserver)
{
STRLIST list=NULL;
int rc;
append_to_strlist(&list,name);
- rc=keyserver_work(KS_GETNAME,list,NULL,0,opt.keyserver);
+ rc=keyserver_work(KS_GETNAME,list,NULL,0,keyserver);
free_strlist(list);
Modified: trunk/g10/options.h
===================================================================
--- trunk/g10/options.h 2006-02-22 23:19:36 UTC (rev 4019)
+++ trunk/g10/options.h 2006-02-22 23:37:23 UTC (rev 4020)
@@ -224,7 +224,8 @@
keyring. */
struct akl
{
- enum {AKL_CERT, AKL_PKA, AKL_LDAP, AKL_KEYSERVER} type;
+ enum {AKL_CERT, AKL_PKA, AKL_LDAP, AKL_KEYSERVER, AKL_SPEC} type;
+ struct keyserver_spec *spec;
struct akl *next;
} *auto_key_locate;
More information about the Gnupg-commits
mailing list