mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Add command --locate-key.
Fix auto-key-locate processing of "nodefault".
This commit is contained in:
parent
4254e90426
commit
69ae16636c
7 changed files with 103 additions and 13 deletions
13
g10/getkey.c
13
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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue