mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Improve error return for --quick-add-subkey and -add-adsk.
* g10/keyedit.c (keyedit_quick_addkey): Emit a ERROR status line. (keyedit_quick_addadsk): Ditto. -- GnuPG-bug-id: 6880
This commit is contained in:
parent
3f8cb9b339
commit
2cb97713e9
@ -3212,7 +3212,7 @@ keyedit_quick_addkey (ctrl_t ctrl, const char *fpr, const char *algostr,
|
||||
/* We require a fingerprint because only this uniquely identifies a
|
||||
* key and may thus be used to select a key for unattended subkey
|
||||
* creation. */
|
||||
if (find_by_primary_fpr (ctrl, fpr, &keyblock, &kdbhd))
|
||||
if ((err=find_by_primary_fpr (ctrl, fpr, &keyblock, &kdbhd)))
|
||||
goto leave;
|
||||
|
||||
if (fix_keyblock (ctrl, &keyblock))
|
||||
@ -3224,6 +3224,7 @@ keyedit_quick_addkey (ctrl_t ctrl, const char *fpr, const char *algostr,
|
||||
if (!opt.verbose)
|
||||
show_key_with_all_names (ctrl, es_stdout, keyblock, 0, 0, 0, 0, 0, 1);
|
||||
log_error ("%s%s", _("Key is revoked."), "\n");
|
||||
err = gpg_error (GPG_ERR_CERT_REVOKED);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -3247,6 +3248,8 @@ keyedit_quick_addkey (ctrl_t ctrl, const char *fpr, const char *algostr,
|
||||
log_info (_("Key not changed so no update needed.\n"));
|
||||
|
||||
leave:
|
||||
if (err)
|
||||
write_status_error ("keyedit.addkey", err);
|
||||
release_kbnode (keyblock);
|
||||
keydb_release (kdbhd);
|
||||
}
|
||||
@ -3274,7 +3277,7 @@ keyedit_quick_addadsk (ctrl_t ctrl, const char *fpr, const char *adskfpr)
|
||||
/* We require a fingerprint because only this uniquely identifies a
|
||||
* key and may thus be used to select a key for unattended adsk
|
||||
* adding. */
|
||||
if (find_by_primary_fpr (ctrl, fpr, &keyblock, &kdbhd))
|
||||
if ((err = find_by_primary_fpr (ctrl, fpr, &keyblock, &kdbhd)))
|
||||
goto leave;
|
||||
|
||||
if (fix_keyblock (ctrl, &keyblock))
|
||||
@ -3286,6 +3289,7 @@ keyedit_quick_addadsk (ctrl_t ctrl, const char *fpr, const char *adskfpr)
|
||||
if (!opt.verbose)
|
||||
show_key_with_all_names (ctrl, es_stdout, keyblock, 0, 0, 0, 0, 0, 1);
|
||||
log_error ("%s%s", _("Key is revoked."), "\n");
|
||||
err = gpg_error (GPG_ERR_CERT_REVOKED);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -3310,6 +3314,8 @@ keyedit_quick_addadsk (ctrl_t ctrl, const char *fpr, const char *adskfpr)
|
||||
}
|
||||
|
||||
leave:
|
||||
if (err)
|
||||
write_status_error ("keyedit.addadsk", err);
|
||||
release_kbnode (keyblock);
|
||||
keydb_release (kdbhd);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user