[git] GPGME - branch, master, updated. gpgme-1.6.0-332-ga0263ad

by Justus Winter cvs at cvs.gnupg.org
Mon Sep 12 15:04:40 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 "GnuPG Made Easy".

The branch, master has been updated
       via  a0263ad282d350b548cbbc27e96f196d9217d040 (commit)
      from  d480f6b701894f78f3f4016d69c0e3b87939930b (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 a0263ad282d350b548cbbc27e96f196d9217d040
Author: Justus Winter <justus at g10code.com>
Date:   Mon Sep 12 14:53:08 2016 +0200

    tests: Make signature notation test compatible with older GnuPGs.
    
    * lang/python/tests/t-sig-notation.py: Only check the critical flag
    when GnuPG >= 2.1.13 is used.
    * tests/gpg/t-sig-notation.c: Likewise.
    
    Fixes-commit: c88c9ef3
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py
index 0f77e37..b024bb5 100755
--- a/lang/python/tests/t-sig-notation.py
+++ b/lang/python/tests/t-sig-notation.py
@@ -29,6 +29,14 @@ expected_notations = {
     None: ("http://www.gnu.org/policy/", 0),
 }
 
+# GnuPG prior to 2.1.13 did not report the critical flag correctly.
+with core.Context() as c:
+    version = c.engine_info.version
+    have_correct_sig_data = not (version.startswith("1.")
+                                 or version == "2.1.1"
+                                 or (version.startswith("2.1.1")
+                                     and version[5] < '3'))
+
 def check_result(result):
     assert len(result.signatures) == 1, "Unexpected number of signatures"
     sig = result.signatures[0]
@@ -45,7 +53,8 @@ def check_result(result):
         assert r.human_readable \
             == bool(flags&constants.SIG_NOTATION_HUMAN_READABLE)
         assert r.critical \
-            == bool(flags&constants.SIG_NOTATION_CRITICAL)
+            == (bool(flags&constants.SIG_NOTATION_CRITICAL)
+                if have_correct_sig_data else False)
 
     assert len(expected_notations) == 0
 
diff --git a/tests/gpg/t-sig-notation.c b/tests/gpg/t-sig-notation.c
index 843606a..798ad24 100644
--- a/tests/gpg/t-sig-notation.c
+++ b/tests/gpg/t-sig-notation.c
@@ -24,6 +24,7 @@
 #include <config.h>
 #endif
 
+#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -33,6 +34,11 @@
 #include "t-support.h"
 
 

+
+/* GnuPG prior to 2.1.13 did not report the critical flag
+   correctly.  */
+int have_correct_sig_data;
+
 static struct {
   const char *name;
   const char *value;
@@ -83,11 +89,17 @@ check_result (gpgme_verify_result_t result)
 	       && r->value
 	       && !strcmp (r->value, expected_notations[i].value)
 	       && r->value_len == strlen (expected_notations[i].value)
-	       && r->flags == expected_notations[i].flags
+	       && r->flags
+                  == (have_correct_sig_data
+                      ? expected_notations[i].flags
+                      : expected_notations[i].flags
+                        & ~GPGME_SIG_NOTATION_CRITICAL)
 	       && r->human_readable
 	       == !!(r->flags & GPGME_SIG_NOTATION_HUMAN_READABLE)
 	       && r->critical
-               == !!(r->flags & GPGME_SIG_NOTATION_CRITICAL))
+                  == (have_correct_sig_data
+                      ? !!(r->flags & GPGME_SIG_NOTATION_CRITICAL)
+                      : 0))
 	    {
 	      expected_notations[i].seen++;
 	      any++;
@@ -121,9 +133,25 @@ main (int argc, char *argv[])
   gpgme_verify_result_t result;
   char *agent_info;
   int i;
+  gpgme_engine_info_t engine_info;
 
   init_gpgme (GPGME_PROTOCOL_OpenPGP);
 
+  err = gpgme_get_engine_info (&engine_info);
+  fail_if_err (err);
+  for (; engine_info; engine_info = engine_info->next)
+    if (engine_info->protocol == GPGME_PROTOCOL_OpenPGP)
+      break;
+  assert (engine_info);
+
+  /* GnuPG prior to 2.1.13 did not report the critical flag
+     correctly.  */
+  have_correct_sig_data =
+    ! (strncmp ("1.", engine_info->version, 2)
+       || (strncmp ("2.1.1", engine_info->version, 5)
+           && (engine_info->version[5] == 0
+               || engine_info->version[5] < '3')));
+
   err = gpgme_new (&ctx);
   fail_if_err (err);
 

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

Summary of changes:
 lang/python/tests/t-sig-notation.py | 11 ++++++++++-
 tests/gpg/t-sig-notation.c          | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 40 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list