1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: Avoid printing false AKL error message.

* g10/getkey.c (get_pubkey_byname): Add special traeatment for default
and skipped-local.
--

This change avoids error message like

  gpg: error retrieving 'foo@example.org' via None: No public key

A 'None' mechanism is something internal.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-07-04 15:21:39 +02:00
parent d00c8024e5
commit 91a6ba3234
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1015,14 +1015,14 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
{
case AKL_NODEFAULT:
/* This is a dummy mechanism. */
mechanism_string = "None";
mechanism_string = "";
rc = GPG_ERR_NO_PUBKEY;
break;
case AKL_LOCAL:
if (mode == GET_PUBKEY_NO_LOCAL)
{
mechanism_string = "None";
mechanism_string = "";
rc = GPG_ERR_NO_PUBKEY;
}
else
@ -1165,8 +1165,8 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
name, mechanism_string);
break;
}
if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY
|| opt.verbose || no_fingerprint)
if ((gpg_err_code (rc) != GPG_ERR_NO_PUBKEY
|| opt.verbose || no_fingerprint) && *mechanism_string)
log_info (_("error retrieving '%s' via %s: %s\n"),
name, mechanism_string,
no_fingerprint ? _("No fingerprint") : gpg_strerror (rc));