diff options
author | David Shaw <[email protected]> | 2006-02-22 23:37:23 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2006-02-22 23:37:23 +0000 |
commit | 1ae024ef81d108c68d00a96fca6f808b4a9c454d (patch) | |
tree | cf9ea77a36a9d3096eed336ba148a2426559245b /g10/getkey.c | |
parent | * gpgkeys_hkp.c (get_name): A GETNAME query turns exact=on to cut down on (diff) | |
download | gnupg-1ae024ef81d108c68d00a96fca6f808b4a9c454d.tar.gz gnupg-1ae024ef81d108c68d00a96fca6f808b4a9c454d.zip |
* 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.
Diffstat (limited to '')
-rw-r--r-- | g10/getkey.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/g10/getkey.c b/g10/getkey.c index 7d91cde1a..81b15b2e2 100644 --- a/g10/getkey.c +++ b/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) |