diff options
author | Werner Koch <[email protected]> | 2018-05-31 23:29:20 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2018-05-31 23:29:34 +0000 |
commit | 662604c5bcb4e03d3c9ecc670d4f320a2418ebb3 (patch) | |
tree | 4495b29c8d7ab2c323f58d8fb772411789d7c565 /tests/run-decrypt.c | |
parent | core: New decryption result flag 'legacy_cipher_nomdc'. (diff) | |
download | gpgme-662604c5bcb4e03d3c9ecc670d4f320a2418ebb3.tar.gz gpgme-662604c5bcb4e03d3c9ecc670d4f320a2418ebb3.zip |
core: New context flag "ignore-mdc-error".
* src/context.h (gpgme_context): Add field ignore_mdc_error.
* src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Set/get it.
* src/engine-gpg.c (engine_gpg): Add flags.ignore_mdc_error.
(gpg_set_engine_flags): Set it.
(build_argv): Pass option to gpg.
* src/decrypt.c (_gpgme_decrypt_status_handler): Take care of flag.
(gpgme_op_decrypt_result): Clear flag.
(gpgme_op_decrypt): Clear flag.
* src/decrypt-verify.c (gpgme_op_decrypt_verify): Clear flag
(gpgme_op_decrypt_ext): Clear flag.
* tests/run-decrypt.c (show_usage): Add option --ignore-mdc-error.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tests/run-decrypt.c')
-rw-r--r-- | tests/run-decrypt.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index 8ec0cb4f..99a15c7e 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -86,6 +86,7 @@ show_usage (int ex) " --override-session-key STRING use STRING as session key\n" " --request-origin STRING use STRING as request origin\n" " --no-symkey-cache disable the use of that cache\n" + " --ignore-mdc-error allow decryption of legacy data\n" " --unwrap remove only the encryption layer\n" , stderr); exit (ex); @@ -109,6 +110,7 @@ main (int argc, char **argv) const char *override_session_key = NULL; const char *request_origin = NULL; int no_symkey_cache = 0; + int ignore_mdc_error = 0; int raw_output = 0; if (argc) @@ -170,6 +172,11 @@ main (int argc, char **argv) no_symkey_cache = 1; argc--; argv++; } + else if (!strcmp (*argv, "--ignore-mdc-error")) + { + ignore_mdc_error = 1; + argc--; argv++; + } else if (!strcmp (*argv, "--unwrap")) { flags |= GPGME_DECRYPT_UNWRAP; @@ -241,7 +248,18 @@ main (int argc, char **argv) err = gpgme_set_ctx_flag (ctx, "no-symkey-cache", "1"); if (err) { - fprintf (stderr, PGM ": error setting no-symkey-cache: %s\n", + fprintf (stderr, PGM ": error setting no-symkey-cache: %s\n", + gpgme_strerror (err)); + exit (1); + } + } + + if (ignore_mdc_error) + { + err = gpgme_set_ctx_flag (ctx, "ignore-mdc-error", "1"); + if (err) + { + fprintf (stderr, PGM ": error setting ignore-mdc-error: %s\n", gpgme_strerror (err)); exit (1); } |