core: Return an error for secret key export operations

src/export.c (export_status_handler): Handle "export_keys.secret".
--

This allows callers of the synchronous export operations to react
properly to errors (e.g. wrong passphrase) during the export of secret
keys.

GnuPG-bug-id: 5766
This commit is contained in:
Ingo Klöcker 2022-01-10 12:32:32 +01:00
parent 062e4b1f0f
commit a527bd7cf5
2 changed files with 4 additions and 1 deletions

2
NEWS
View File

@ -7,6 +7,8 @@ Noteworthy changes in version 1.16.1 (unreleased)
* New export mode to export secret subkeys. [#5757]
* Detect errors during the export of secret keys. [#5766]
* cpp,qt: Add support for export of secret keys and secret subkeys.
[#5757]

View File

@ -105,7 +105,8 @@ export_status_handler (void *priv, gpgme_status_code_t code, char *args)
return err;
else if (opd->err)
; /* We only want to report the first error. */
else if (!strcmp (loc, "keyserver_send"))
else if (!strcmp (loc, "keyserver_send")
|| !strcmp (loc, "export_keys.secret"))
opd->err = err;
break;