core: Add trust-model flag
ClosedPublic

Authored by aheinecke on Sep 12 2018, 9:55 AM.

Details

Summary
  • 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 (def_trust_model_lock): New lock for trust_model

global.
(def_trust_model): New global variable for trust model.
(gpgme_set_global_flag, gpgme_new, gpgme_release): Handle trust-model.
(gpgme_set_ctx_flag): Take global trust-model into account.

  • doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag and

gpgme_set_global_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. There is a usecase for both a local change (e.g.
to fetch the tofu_info of a single key). And a global
application wide change.

Changing the trust model for only a single application depends
on:
GnuPG-Bug-Id: T4134

Test Plan

Tested with run-keylist.

Diff Detail

Repository
rM GPGME
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aheinecke created this revision.Sep 12 2018, 9:55 AM

To avoid a traumatic change to Gpg4win I do not want to change the default trust-model globally. Changing it on demand will provide the freedom to "port" each application using GnuPG to the new trust-model independently.

My current plan is that there will be an option in GpgOL to use tofu+pgp that would use set_global_flag to avoid having to modify each context creation call.

Kleopatra will run in the default trust-model (pgp). But in the "Details" view will have an option to "show communication history" which would do a new keylisting with trust-model tofu+pgp for this key. For that I plan to use the set_ctx_flag locally for the single key list.

aheinecke updated this revision to Diff 1340.Sep 12 2018, 2:35 PM

Removed the global trust model flag.

werner accepted this revision.Oct 9 2018, 9:41 AM
This revision is now accepted and ready to land.Oct 9 2018, 9:41 AM
This revision was automatically updated to reflect the committed changes.