From 85627e58184529e982369cfc00ed7865244c13d6 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Wed, 12 Sep 2018 09:42:09 +0200 Subject: core: Add trust-model flag * src/context.h (gpgme_context): Extend with trust_model. * src/engine-gpg.c (engine_gpg): Extend with trust_model. (gpg_set_engine_flags): Take trust_model from context. (build_argv): Handle trust_model. (gpg_release): Free trust_model. * src/gpgme.c (gpgme_set_ctx_flag): Handle trust-model flag. (gpgme_release): Release trust-model. * doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag. (Context Flags): New subsection for the context flags. * tests/run-keylist.c (show_usage, main): Add new --trust-model parameter. -- This gives a GPGME user fine grained control over the trust-model. Changing the trust model for only a single application depends on: GnuPG-Bug-Id: T4134 Maniphest Tasks: T4134 Differential Revision: https://dev.gnupg.org/D466 --- src/gpgme.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gpgme.c') diff --git a/src/gpgme.c b/src/gpgme.c index 2d829d9b..3d72f695 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -250,6 +250,7 @@ gpgme_release (gpgme_ctx_t ctx) free (ctx->override_session_key); free (ctx->request_origin); free (ctx->auto_key_locate); + free (ctx->trust_model); _gpgme_engine_info_release (ctx->engine_info); ctx->engine_info = NULL; DESTROY_LOCK (ctx->lock); @@ -554,6 +555,13 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) if (!ctx->auto_key_locate) err = gpg_error_from_syserror (); } + else if (!strcmp (name, "trust-model")) + { + free (ctx->trust_model); + ctx->trust_model = strdup (value); + if (!ctx->trust_model) + err = gpg_error_from_syserror (); + } else err = gpg_error (GPG_ERR_UNKNOWN_NAME); -- cgit v1.2.3