diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/decrypt-verify.c | 2 | ||||
-rw-r--r-- | src/decrypt.c | 13 | ||||
-rw-r--r-- | src/engine-gpg.c | 3 | ||||
-rw-r--r-- | src/gpgme.h.in | 1 | ||||
-rw-r--r-- | src/ops.h | 3 |
5 files changed, 16 insertions, 6 deletions
diff --git a/src/decrypt-verify.c b/src/decrypt-verify.c index 3ff15feb..94ebeb90 100644 --- a/src/decrypt-verify.c +++ b/src/decrypt-verify.c @@ -62,7 +62,7 @@ decrypt_verify_start (gpgme_ctx_t ctx, int synchronous, if (err) return err; - err = _gpgme_op_decrypt_init_result (ctx, plain); + err = _gpgme_op_decrypt_init_result (ctx, plain, flags); if (err) return err; diff --git a/src/decrypt.c b/src/decrypt.c index e5d2f7c7..c6030eef 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -44,7 +44,10 @@ typedef struct int okay; - /* A flag telling that the a decryption failed and two optional error + /* Indicates that list only mode is active. */ + int list_only; + + /* A flag telling that the decryption failed and two optional error * codes to further specify the failure for public key decryption and * symmetric decryption. */ int failed; @@ -419,7 +422,7 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, /* Generic decryption failed error code. */ return gpg_error (GPG_ERR_DECRYPT_FAILED); } - else if (!opd->okay) + else if (!opd->okay && !opd->list_only) { /* No data was found. */ return gpg_error (GPG_ERR_NO_DATA); @@ -540,7 +543,8 @@ decrypt_status_handler (void *priv, gpgme_status_code_t code, char *args) gpgme_error_t -_gpgme_op_decrypt_init_result (gpgme_ctx_t ctx, gpgme_data_t plaintext) +_gpgme_op_decrypt_init_result (gpgme_ctx_t ctx, gpgme_data_t plaintext, + gpgme_decrypt_flags_t flags) { gpgme_error_t err; void *hook; @@ -552,6 +556,7 @@ _gpgme_op_decrypt_init_result (gpgme_ctx_t ctx, gpgme_data_t plaintext) if (err) return err; + opd->list_only = !!(flags & GPGME_DECRYPT_LISTONLY); opd->last_recipient_p = &opd->result.recipients; opd->plaintext_dserial = _gpgme_data_get_dserial (plaintext); return 0; @@ -571,7 +576,7 @@ _gpgme_decrypt_start (gpgme_ctx_t ctx, int synchronous, if (err) return err; - err = _gpgme_op_decrypt_init_result (ctx, plain); + err = _gpgme_op_decrypt_init_result (ctx, plain, flags); if (err) return err; diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 66303263..c0391d11 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1952,6 +1952,9 @@ gpg_decrypt (void *engine, err = add_arg (gpg, "--unwrap"); } + if (!err && (flags & GPGME_DECRYPT_LISTONLY)) + err = add_arg (gpg, "--list-only"); + if (!err && export_session_key) err = add_gpg_arg (gpg, "--show-session-key"); diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 705d9741..69d9f54c 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -1491,6 +1491,7 @@ typedef enum { GPGME_DECRYPT_VERIFY = 1, GPGME_DECRYPT_ARCHIVE = 2, + GPGME_DECRYPT_LISTONLY = 16, GPGME_DECRYPT_UNWRAP = 128 } gpgme_decrypt_flags_t; @@ -86,7 +86,8 @@ gpgme_error_t _gpgme_verify_status_handler (void *priv, /* From decrypt.c. */ gpgme_error_t _gpgme_op_decrypt_init_result (gpgme_ctx_t ctx, - gpgme_data_t plaintext); + gpgme_data_t plaintext, + gpgme_decrypt_flags_t flags); gpgme_error_t _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, char *args); |