From a304ec0ede937e21df5b4a311cbaf8d89f13ef59 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 29 Oct 2024 11:59:51 +0100 Subject: 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 --- src/gpgme.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/gpgme.c') diff --git a/src/gpgme.c b/src/gpgme.c index 086e680b..4f63cc4f 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -262,6 +262,7 @@ gpgme_release (gpgme_ctx_t ctx) free (ctx->key_origin); free (ctx->import_filter); free (ctx->import_options); + free (ctx->known_notations); _gpgme_engine_info_release (ctx->engine_info); ctx->engine_info = NULL; DESTROY_LOCK (ctx->lock); @@ -623,6 +624,13 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) { ctx->proc_all_sigs = abool; } + else if (!strcmp (name, "known-notations")) + { + free (ctx->known_notations); + ctx->known_notations = strdup (value); + if (!ctx->known_notations) + err = gpg_error_from_syserror (); + } else err = gpg_error (GPG_ERR_UNKNOWN_NAME); @@ -716,6 +724,10 @@ gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) { return ctx->proc_all_sigs? "1":""; } + else if (!strcmp (name, "known-notations")) + { + return ctx->known_notations? ctx->known_notations: ""; + } else return NULL; } -- cgit v1.2.3