aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-05-07 15:40:36 +0000
committerWerner Koch <[email protected]>2008-05-07 15:40:36 +0000
commit69ae16636cb0800d37f5d9eee6bb3d4749e645f7 (patch)
tree7b7fccd66e971375d1d3e4506a08266281935233 /g10/getkey.c
parentFixed bug#907. (diff)
downloadgnupg-69ae16636cb0800d37f5d9eee6bb3d4749e645f7.tar.gz
gnupg-69ae16636cb0800d37f5d9eee6bb3d4749e645f7.zip
Add command --locate-key.
Fix auto-key-locate processing of "nodefault".
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 5c1ed10e6..93f8f14ce 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -925,8 +925,11 @@ get_pubkey_byname (PKT_public_key *pk,
int rc;
strlist_t namelist = NULL;
struct akl *akl;
+ int is_mbox;
int nodefault = 0;
+ is_mbox = is_valid_mailbox (name);
+
/* Check whether we the default local search has been disabled.
This is the case if either the "nodefault" or the "local" keyword
are in the list of auto key locate mechanisms. */
@@ -940,8 +943,11 @@ get_pubkey_byname (PKT_public_key *pk,
}
}
- if (nodefault)
- rc = G10ERR_NO_PUBKEY;
+ if (nodefault && is_mbox)
+ {
+ /* Nodefault but a mailbox - let the AKL locate the key. */
+ rc = G10ERR_NO_PUBKEY;
+ }
else
{
add_to_strlist (&namelist, name);
@@ -951,8 +957,7 @@ get_pubkey_byname (PKT_public_key *pk,
/* If the requested name resembles a valid mailbox and automatic
retrieval has been enabled, we try to import the key. */
-
- if (rc == G10ERR_NO_PUBKEY && !no_akl && is_valid_mailbox(name))
+ if (gpg_err_code (rc) == G10ERR_NO_PUBKEY && !no_akl && is_mbox)
{
for (akl=opt.auto_key_locate; akl; akl=akl->next)
{