diff options
author | Werner Koch <[email protected]> | 2024-10-29 10:59:51 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2024-10-29 11:00:11 +0000 |
commit | a304ec0ede937e21df5b4a311cbaf8d89f13ef59 (patch) | |
tree | 846889cf9b17748eef4977269a36e060d7e9d1fd /tests | |
parent | core: Add new helper _gpgme_strtokenize. (diff) | |
download | gpgme-a304ec0ede937e21df5b4a311cbaf8d89f13ef59.tar.gz gpgme-a304ec0ede937e21df5b4a311cbaf8d89f13ef59.zip |
core: New context flags "known-notations".
* src/gpgme.c (gpgme_set_ctx_flag): Add "known-notations".
(gpgme_get_ctx_flag): Ditto.
(gpgme_release): Free variable.
* src/context.h (struct gpgme_context): Add "known_notations".
* src/engine-gpg.c (struct engine_gpg): Add "known_notations".
(gpg_release): Free variable.
(gpg_set_engine_flags): Set variable.
(add_known_notations): New.
(gpg_decrypt, gpg_verify): Call function.
* tests/run-decrypt.c (main): Add option --known-notations.
* tests/run-verify.c (main): Ditto.
--
GnuPG-bug-id: 4060
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run-decrypt.c | 17 | ||||
-rw-r--r-- | tests/run-verify.c | 16 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index 6869f4d5..c724e407 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -97,6 +97,7 @@ show_usage (int ex) " --directory DIR extract the files into the directory DIR\n" " --diagnostics print diagnostics\n" " --direct-file-io pass FILE instead of stream with content of FILE to backend\n" + " --known-notations STRING Parse STRING and pass to gpg\n" , stderr); exit (ex); } @@ -120,6 +121,7 @@ main (int argc, char **argv) const char *request_origin = NULL; const char *output = NULL; const char *directory = NULL; + const char *known_notations = NULL; int no_symkey_cache = 0; int ignore_mdc_error = 0; int raw_output = 0; @@ -239,6 +241,14 @@ main (int argc, char **argv) direct_file_io = 1; argc--; argv++; } + else if (!strcmp (*argv, "--known-notations")) + { + argc--; argv++; + if (!argc) + show_usage (1); + known_notations = *argv; + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) show_usage (1); @@ -324,6 +334,13 @@ main (int argc, char **argv) } } + if (known_notations) + { + err = gpgme_set_ctx_flag (ctx, "known-notations", known_notations); + fail_if_err (err); + } + + if (direct_file_io) err = gpgme_data_new (&in); else diff --git a/tests/run-verify.c b/tests/run-verify.c index 13efd89f..b4f2e06f 100644 --- a/tests/run-verify.c +++ b/tests/run-verify.c @@ -242,6 +242,7 @@ show_usage (int ex) " --diagnostics print diagnostics\n" " --direct-file-io pass file names instead of streams with content of files to backend\n" " --proc-all-sigs pass this option to gpg\n" + " --known-notations STRING Parse STRING and pass to gpg\n" , stderr); exit (ex); } @@ -258,6 +259,7 @@ main (int argc, char **argv) const char *sender = NULL; const char *output = NULL; const char *directory = NULL; + const char *known_notations = NULL; int auto_key_retrieve = 0; int auto_key_import = 0; gpgme_data_encoding_t encoding = GPGME_DATA_ENCODING_NONE; @@ -367,6 +369,14 @@ main (int argc, char **argv) proc_all_sigs = 1; argc--; argv++; } + else if (!strcmp (*argv, "--known-notations")) + { + argc--; argv++; + if (!argc) + show_usage (1); + known_notations = *argv; + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) show_usage (1); @@ -441,6 +451,12 @@ main (int argc, char **argv) } } + if (known_notations) + { + err = gpgme_set_ctx_flag (ctx, "known-notations", known_notations); + fail_if_err (err); + } + if (auto_key_import) { gpgme_set_ctx_flag (ctx, "auto-key-import", "1"); |