[Pkg-gnupg-commit] [gnupg2] 42/241: gpg: Keep the trust DB up to date for the tofu and tofu+pgp models.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 20:31:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit d05ff81732e20e6f9d6d7a6281a96a312b001abb
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Oct 21 13:28:15 2015 +0200

    gpg: Keep the trust DB up to date for the tofu and tofu+pgp models.
    
    * g10/trustdb.c (init_trustdb): Recognize tofu and tofu+pgp as
    possibly saved trust models.  Also register the ultimately trusted
    keys if the trust model is tofu or tofu+pgp.
    (check_trustdb): Don't skip if the trust model is tofu or tofu+pgp.
    (update_trustdb): Likewise.
    (tdb_check_trustdb_stale): Likewise.
    (validate_keys): If the trust model is TOFU, just write out the
    ultimately trusted keys.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>
---
 g10/trustdb.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/g10/trustdb.c b/g10/trustdb.c
index 1be98b5..296083c 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -459,9 +459,11 @@ init_trustdb ()
       opt.trust_model=tdbio_read_model();
 
       /* Sanity check this ;) */
-      if(opt.trust_model!=TM_CLASSIC
-	 && opt.trust_model!=TM_PGP
-	 && opt.trust_model!=TM_EXTERNAL)
+      if(opt.trust_model != TM_CLASSIC
+	 && opt.trust_model != TM_PGP
+	 && opt.trust_model != TM_TOFU_PGP
+	 && opt.trust_model != TM_TOFU
+	 && opt.trust_model != TM_EXTERNAL)
 	{
 	  log_info(_("unable to use unknown trust model (%d) - "
 		     "assuming %s trust model\n"),opt.trust_model,"PGP");
@@ -472,7 +474,8 @@ init_trustdb ()
 	log_info(_("using %s trust model\n"),trust_model_string());
     }
 
-  if(opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC)
+  if (opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC
+      || opt.trust_model == TM_TOFU || opt.trust_model == TM_TOFU_PGP)
     {
       /* Verify the list of ultimately trusted keys and move the
 	 --trusted-keys list there as well. */
@@ -494,7 +497,8 @@ void
 check_trustdb ()
 {
   init_trustdb();
-  if(opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC)
+  if (opt.trust_model == TM_PGP || opt.trust_model == TM_CLASSIC
+      || opt.trust_model == TM_TOFU_PGP || opt.trust_model == TM_TOFU)
     {
       if (opt.batch && !opt.answer_yes)
 	{
@@ -530,7 +534,8 @@ void
 update_trustdb()
 {
   init_trustdb();
-  if(opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC)
+  if (opt.trust_model == TM_PGP || opt.trust_model == TM_CLASSIC
+      || opt.trust_model == TM_TOFU_PGP || opt.trust_model == TM_TOFU)
     validate_keys (1);
   else
     log_info (_("no need for a trustdb update with '%s' trust model\n"),
@@ -946,7 +951,8 @@ tdb_check_trustdb_stale (void)
     return;  /* No trustdb => can't be stale.  */
 
   if (!did_nextcheck
-      && (opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC))
+      && (opt.trust_model == TM_PGP || opt.trust_model == TM_CLASSIC
+          || opt.trust_model == TM_TOFU_PGP || opt.trust_model == TM_TOFU))
     {
       ulong scheduled;
 
@@ -1938,6 +1944,11 @@ validate_keys (int interactive)
       do_sync ();
     }
 
+  if (opt.trust_model == TM_TOFU)
+    /* In the TOFU trust model, we only need to save the ultimately
+       trusted keys.  */
+    goto leave;
+
   klist = utk_list;
 
   log_info(_("%d marginal(s) needed, %d complete(s) needed, %s trust model\n"),

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list