summaryrefslogtreecommitdiff
path: root/src/passphrase.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-08-25 13:22:43 +0200
committerWerner Koch <wk@gnupg.org>2015-08-25 13:23:51 +0200
commit8ddc5801ade02297924447df5745c8877a96e5e3 (patch)
tree0d26e47c4eef71c62c8e562d5b34a6e1d6019a0d /src/passphrase.c
parent208f0297466ce68abfc432f4944f81eb8bf47cf8 (diff)
downloadgpgme-8ddc5801ade02297924447df5745c8877a96e5e3.tar.gz
Improve error return by checking the FAILURE status.
* src/gpgme.h.in (GPGME_STATUS_FAILURE): New. * src/status-table.c (FAILURE): New. * src/op-support.c (_gpgme_parse_failure): New. * src/passphrase.c (_gpgme_passphrase_status_handler): Forward FAILURE status line to the status callback. * src/decrypt.c (op_data_t): Add field failure_code. (_gpgme_decrypt_status_handler): Parse that code and act upon it on EOF. * src/encrypt.c (op_data_t): Add field failure_code. (_gpgme_encrypt_status_handler): Parse that code and act upon it on EOF. * src/genkey.c (op_data_t): Add field failure_code. (genkey_status_handler): Parse that code and act upon it on EOF. * src/passwd.c (op_data_t): Add field failure_code. (passwd_status_handler): Parse that code and act upon it on EOF. * src/sign.c (op_data_t): Add field failure_code. (_gpgme_sign_status_handler): Parse that code and act upon it on EOF. * src/verify.c (op_data_t): Add field failure_code. (_gpgme_verify_status_handler): Parse that code and act upon it on EOF. -- This requires GnuPG 2.1.8 to actually make a difference. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src/passphrase.c')
-rw-r--r--src/passphrase.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/passphrase.c b/src/passphrase.c
index 5d656b17..c88e57d2 100644
--- a/src/passphrase.c
+++ b/src/passphrase.c
@@ -128,6 +128,19 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code,
}
break;
+ case GPGME_STATUS_FAILURE:
+ /* We abuse this status handler to forward FAILURE status codes
+ to the caller. This should better be done in a generic
+ handler, but for now this is sufficient. */
+ if (ctx->status_cb)
+ {
+ err = ctx->status_cb (ctx->status_cb_value, "FAILURE", args);
+ if (err)
+ return err;
+ }
+ break;
+
+
default:
/* Ignore all other codes. */
break;