From 35ca460019ea29ae646d08c954d4d4bf2dc1e8e1 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Mon, 2 Nov 2020 19:33:29 -0800 Subject: [PATCH] Parse STATUS_CANCELED_BY_USER. * src/gpgme.h.in (GPGME_STATUS_CANCELED_BY_USER): New. * src/status-table.c (status_table_s): Add "CANCELED_BY_USER". * src/passphrase.c (_gpgme_passphrase_status_handler): Return GPG_ERR_CANCELED during GPGME_STATUS_CANCELED_BY_USER. Signed-off-by: Ben Kibbey --- src/gpgme.h.in | 3 ++- src/passphrase.c | 3 +++ src/status-table.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gpgme.h.in b/src/gpgme.h.in index ec2b3b0d..1defa4df 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -2576,7 +2576,8 @@ typedef enum GPGME_STATUS_TOFU_STATS_LONG = 97, GPGME_STATUS_NOTATION_FLAGS = 98, GPGME_STATUS_DECRYPTION_COMPLIANCE_MODE = 99, - GPGME_STATUS_VERIFICATION_COMPLIANCE_MODE = 100 + GPGME_STATUS_VERIFICATION_COMPLIANCE_MODE = 100, + GPGME_STATUS_CANCELED_BY_USER = 101 } gpgme_status_code_t; diff --git a/src/passphrase.c b/src/passphrase.c index 2a7daea1..140cd03a 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -111,6 +111,9 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code, opd->no_passphrase = 1; break; + case GPGME_STATUS_CANCELED_BY_USER: + return gpg_error (GPG_ERR_CANCELED); + case GPGME_STATUS_EOF: if (opd->no_passphrase || opd->bad_passphrase) return gpg_error (GPG_ERR_BAD_PASSPHRASE); diff --git a/src/status-table.c b/src/status-table.c index eeafb896..6ec73ab1 100644 --- a/src/status-table.c +++ b/src/status-table.c @@ -51,6 +51,7 @@ static struct status_table_s status_table[] = { "BEGIN_ENCRYPTION", GPGME_STATUS_BEGIN_ENCRYPTION }, { "BEGIN_SIGNING", GPGME_STATUS_BEGIN_SIGNING }, { "BEGIN_STREAM", GPGME_STATUS_BEGIN_STREAM }, + { "CANCELED_BY_USER", GPGME_STATUS_CANCELED_BY_USER }, { "CARDCTRL", GPGME_STATUS_CARDCTRL }, { "DECRYPTION_FAILED", GPGME_STATUS_DECRYPTION_FAILED }, { "DECRYPTION_INFO", GPGME_STATUS_DECRYPTION_INFO },