mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
* 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.
This commit is contained in:
parent
482a3a0101
commit
1ae024ef81
@ -1,5 +1,10 @@
|
||||
2006-02-22 David Shaw <dshaw@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
|
||||
|
35
g10/getkey.c
35
g10/getkey.c
@ -979,7 +979,7 @@ get_pubkey_byname (PKT_public_key *pk,
|
||||
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 @@ get_pubkey_byname (PKT_public_key *pk,
|
||||
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 @@ get_ctx_handle(GETKEY_CTX ctx)
|
||||
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 @@ parse_auto_key_locate(char *options)
|
||||
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 @@ parse_auto_key_locate(char *options)
|
||||
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)
|
||||
|
@ -287,7 +287,10 @@ int
|
||||
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; }
|
||||
|
@ -43,7 +43,7 @@ int keyserver_search(STRLIST tokens);
|
||||
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_ */
|
||||
|
@ -2001,14 +2001,14 @@ keyserver_import_pka(const char *name,unsigned char *fpr)
|
||||
|
||||
/* 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);
|
||||
|
||||
|
@ -224,7 +224,8 @@ struct
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user