[git] GnuPG - branch, master, updated. gnupg-2.1.15-222-g3ad17e7

by Neal H. Walfield cvs at cvs.gnupg.org
Wed Oct 12 21:45:32 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  3ad17e72fa81d18c95732ddcd4def244f52bb5b1 (commit)
       via  ca84f65c7cf2c6a08a01018519965a82e6c52cac (commit)
       via  6fdf37f0831949cb279de6dc6b247ab2ed53fe5a (commit)
       via  78eda335fd1c29038b74b9cc912b6a4515fccd9f (commit)
      from  cbbf0a7a8da1757fea29cff0daaa42a6bbb95b26 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3ad17e72fa81d18c95732ddcd4def244f52bb5b1
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Oct 12 21:42:10 2016 +0200

    g10: When changing a TOFU binding's policy, update the conflict info
    
    * g10/tofu.c (record_binding): Take an additional argument, CONFLICT.
    Set the binding's conflict accordingly.  Update callers.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/g10/tofu.c b/g10/tofu.c
index ae7166c..d7f4e4c 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -797,8 +797,9 @@ get_single_long_cb2 (void *cookie, int argc, char **argv, char **azColName,
    If SHOW_OLD is set, the binding's old policy is displayed.  */
 static gpg_error_t
 record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
-		const char *user_id, enum tofu_policy policy, int show_old,
-                time_t now)
+		const char *user_id, enum tofu_policy policy,
+                const char *conflict,
+                int show_old, time_t now)
 {
   char *fingerprint_pp = format_hexfingerprint (fingerprint, NULL, 0);
   gpg_error_t rc;
@@ -850,12 +851,6 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
            " <key: %s, user id: %s> to %s.\n",
            fingerprint, show_old ? user_id : email,
            tofu_policy_str (policy));
-
-      if (policy_old == policy)
-        {
-          rc = 0;
-          goto leave; /* Nothing to do.  */
-        }
     }
 
   if (opt.dry_run)
@@ -868,18 +863,19 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
   rc = gpgsql_stepx
     (dbs->db, &dbs->s.record_binding_update, NULL, NULL, &err,
      "insert or replace into bindings\n"
-     " (oid, fingerprint, email, user_id, time, policy)\n"
+     " (oid, fingerprint, email, user_id, time, policy, conflict)\n"
      " values (\n"
      /* If we don't explicitly reuse the OID, then SQLite will
 	reallocate a new one.  We just need to search for the OID
 	based on the fingerprint and email since they are unique.  */
      "  (select oid from bindings where fingerprint = ? and email = ?),\n"
-     "  ?, ?, ?, ?, ?);",
+     "  ?, ?, ?, ?, ?, ?);",
      GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
      GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
      GPGSQL_ARG_STRING, user_id,
      GPGSQL_ARG_LONG_LONG, (long long) now,
      GPGSQL_ARG_INT, (int) policy,
+     GPGSQL_ARG_STRING, conflict ? conflict : "",
      GPGSQL_ARG_END);
   if (rc)
     {
@@ -1747,7 +1743,7 @@ ask_about_binding (ctrl_t ctrl,
                 }
 
               if (record_binding (dbs, fingerprint, email, user_id,
-                                  *policy, 0, now))
+                                  *policy, NULL, 0, now))
                 {
                   /* If there's an error registering the
                    * binding, don't save the signature.  */
@@ -2087,7 +2083,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk,
           /* New binding.  */
           {
             if (record_binding (dbs, fingerprint, email, user_id,
-                                TOFU_POLICY_GOOD, 0, now) != 0)
+                                TOFU_POLICY_GOOD, NULL, 0, now) != 0)
               {
                 log_error (_("error setting TOFU binding's trust level"
                              " to %s\n"), "good");
@@ -2206,7 +2202,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk,
     if (is_signed_by_utk)
       {
         if (record_binding (dbs, fingerprint, email, user_id,
-                            TOFU_POLICY_GOOD, 0, now) != 0)
+                            TOFU_POLICY_GOOD, NULL, 0, now) != 0)
           {
             log_error (_("error setting TOFU binding's trust level"
                          " to %s\n"), "good");
@@ -2246,7 +2242,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk,
 		   fingerprint, email);
 
       if (record_binding (dbs, fingerprint, email, user_id,
-			  TOFU_POLICY_AUTO, 0, now) != 0)
+			  TOFU_POLICY_AUTO, NULL, 0, now) != 0)
 	{
 	  log_error (_("error setting TOFU binding's trust level to %s\n"),
 		       "auto");
@@ -2275,7 +2271,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk,
                    fingerprint, email);
 
       if (record_binding (dbs, fingerprint, email, user_id,
-			  TOFU_POLICY_AUTO, 0, now) != 0)
+			  TOFU_POLICY_AUTO, NULL, 0, now) != 0)
 	log_error (_("error setting TOFU binding's trust level to %s\n"),
 		   "auto");
 
@@ -2297,7 +2293,10 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk,
       log_assert (policy == TOFU_POLICY_NONE);
 
       if (record_binding (dbs, fingerprint, email, user_id,
-			  TOFU_POLICY_ASK, 0, now) != 0)
+			  TOFU_POLICY_ASK,
+                          conflict_set && conflict_set->next
+                          ? conflict_set->next->d : NULL,
+                          0, now) != 0)
 	log_error (_("error setting TOFU binding's trust level to %s\n"),
 		   "ask");
 
@@ -3378,7 +3377,7 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
       email = email_from_user_id (user_id->name);
 
       err = record_binding (dbs, fingerprint, email, user_id->name,
-                            policy, 1, now);
+                            policy, NULL, 1, now);
       if (err)
         {
           log_error (_("error setting policy for key %s, user id \"%s\": %s"),

commit ca84f65c7cf2c6a08a01018519965a82e6c52cac
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Oct 12 21:40:03 2016 +0200

    g10: Make a singular string singular.
    
    * g10/tofu.c (ask_about_binding): Make the singular string singular.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/g10/tofu.c b/g10/tofu.c
index ce107de..ae7166c 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -1619,7 +1619,7 @@ ask_about_binding (ctrl_t ctrl,
           else
             {
               if (labs(stats_iter->time_ago) == 3)
-                es_fprintf (fp, ngettext(" over the past days.",
+                es_fprintf (fp, ngettext(" over the past day.",
                                          " over the past %d days.",
                                          seen_in_past),
                             TIME_AGO_SMALL_THRESHOLD

commit 6fdf37f0831949cb279de6dc6b247ab2ed53fe5a
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Oct 12 21:39:12 2016 +0200

    g10: Correctly determine whether a binding has a conflict.
    
    * g10/tofu.c (build_conflict_set): A binding has a conflict is
    conflict is *not* NULL, not if it is NULL.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/g10/tofu.c b/g10/tofu.c
index 97e7a6e..ce107de 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -1793,7 +1793,7 @@ build_conflict_set (tofu_dbs_t dbs, const char *fingerprint, const char *email)
      "select"
      /* A binding should only appear once, but try not to break in the
       * case of corruption.  */
-     "  fingerprint || case sum(conflict ISNULL) when 0 then '' else '!' end"
+     "  fingerprint || case sum(conflict NOTNULL) when 0 then '' else '!' end"
      " from bindings where email = ?"
      "  group by fingerprint"
      /* Make sure the current key comes first in the result list (if

commit 78eda335fd1c29038b74b9cc912b6a4515fccd9f
Author: Neal H. Walfield <neal at g10code.com>
Date:   Wed Oct 12 21:37:34 2016 +0200

    g10: Fix a column's type in TOFU DB.
    
    * g10/tofu.c (initdb): Change policy from a boolean to an integer.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>
    Reported-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
    
    Note: sqlite ignores type information so this change has no real
    impact.

diff --git a/g10/tofu.c b/g10/tofu.c
index 5b01c27..97e7a6e 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -606,7 +606,7 @@ initdb (sqlite3 *db)
        "create table bindings\n"
        " (oid INTEGER PRIMARY KEY AUTOINCREMENT,\n"
        "  fingerprint TEXT, email TEXT, user_id TEXT, time INTEGER,\n"
-       "  policy BOOLEAN CHECK (policy in (%d, %d, %d, %d, %d)),\n"
+       "  policy INTEGER CHECK (policy in (%d, %d, %d, %d, %d)),\n"
        "  conflict STRING,\n"
        "  unique (fingerprint, email));\n"
        "create index bindings_fingerprint_email\n"

-----------------------------------------------------------------------

Summary of changes:
 g10/tofu.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list