From a8b503c42bd4a773c6a9f88f553138d8092eec4d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 7 Oct 2024 08:16:31 +0200 Subject: [PATCH] gpg: Emit status error for an invalid ADSK. * g10/keygen.c (prepare_adsk): Emit status error. -- This is useful for GPGME. GnuPG-bug-id: 7322 --- g10/keyedit.c | 2 ++ g10/keygen.c | 1 + 2 files changed, 3 insertions(+) diff --git a/g10/keyedit.c b/g10/keyedit.c index 45a1a2414..754f23a38 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -5043,6 +5043,7 @@ menu_addadsk (ctrl_t ctrl, kbnode_t pub_keyblock, const char *adskfpr) NULL, adsk_pk, answer, &adsk_keyblock, NULL, 1); if (err) { + write_status_error ("add_adsk", err); log_info (_("key \"%s\" not found: %s\n"), answer, gpg_strerror (err)); if ((!opt.batch || adskfpr) && !opt.quiet @@ -5068,6 +5069,7 @@ menu_addadsk (ctrl_t ctrl, kbnode_t pub_keyblock, const char *adskfpr) } if (!node) { + write_status_error ("add_adsk", err); err = gpg_error (GPG_ERR_WRONG_KEY_USAGE); log_info (_("key \"%s\" not found: %s\n"), answer, gpg_strerror (err)); diff --git a/g10/keygen.c b/g10/keygen.c index a1143182c..fda595793 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -4282,6 +4282,7 @@ prepare_adsk (ctrl_t ctrl, const char *name) { if (namebuffer && (p=strchr (namebuffer, '!'))) *p = 0; /* Strip the ! for the diagnostic. */ + write_status_error ("add_adsk", err); log_error ("invalid ADSK '%s' specified: %s\n", name, gpg_strerror (err)); } free_public_key (adsk_pk);