[git] GPGME - branch, master, updated. gpgme-1.6.0-318-g9fc72e9

by Andre Heinecke cvs at cvs.gnupg.org
Thu Aug 25 16:27:52 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  9fc72e928bf2cf239bd3b0facdf33ceb1acc975b (commit)
       via  c875f07e559a7c53fc173b4c3f9f5715f3fbb8f8 (commit)
       via  4e37d0bb1255558ce20e1a5ac83a2d06a37f8b0b (commit)
       via  5a92cc96da183ebb19867a2a910f53ba41e76ae9 (commit)
       via  f311b92ceaedb12c9e00a722b6b47bbe6b50871e (commit)
      from  053e6e0a7b8ea38ad9d4160c84814867bbb9fcf6 (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 9fc72e928bf2cf239bd3b0facdf33ceb1acc975b
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Aug 25 16:25:49 2016 +0200

    qt: Fix and extend TofuInfo test.
    
    * lang/qt/tests/t-tofuinfo.cpp: Delete executed jobs.
    (testTofuKeyList): New.
    (testSupported): Activate for 2.1.16
    (signAndVerify): Disable sigcount tests.

diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index d306167..30f7bea 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -62,10 +62,7 @@ class TofuInfoTest: public QGpgMETest
 
     bool testSupported()
     {
-        /* GnuPG currently returns different values for different uid's
-         * on the first verify. This breaks this test. so its disabled
-         * for now. See GnuPG-Bug 2405 */
-        return !(GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "3.0.0");
+        return !(GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.16");
     }
 
     void testTofuCopy(TofuInfo other, const TofuInfo &orig)
@@ -90,9 +87,12 @@ class TofuInfoTest: public QGpgMETest
         keys.push_back(key);
         QByteArray signedData;
         auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData);
+        delete job;
 
         auto info = keys[0].userID(0).tofuInfo();
-        Q_ASSERT(info.signCount() == expected - 1);
+        if (expected != -1) {
+            Q_ASSERT(info.signCount() == expected - 1);
+        }
 
         Q_ASSERT(!sigResult.error());
 
@@ -100,6 +100,7 @@ class TofuInfoTest: public QGpgMETest
         QByteArray verified;
 
         auto result = verifyJob->exec(signedData, verified);
+        delete verifyJob;
 
         Q_ASSERT(!result.error());
         Q_ASSERT(verified == what.toUtf8());
@@ -113,7 +114,9 @@ class TofuInfoTest: public QGpgMETest
         Q_ASSERT(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
         auto stats = key2.userID(0).tofuInfo();
         Q_ASSERT(!stats.isNull());
-        Q_ASSERT(stats.signCount() == expected);
+        if (expected != -1) {
+            Q_ASSERT(stats.signCount() == expected);
+        }
     }
 
 private Q_SLOTS:
@@ -142,6 +145,7 @@ private Q_SLOTS:
         QByteArray plaintext;
 
         auto result = job->exec(data1, plaintext);
+        delete job;
 
         Q_ASSERT(!result.isNull());
         Q_ASSERT(!result.error());
@@ -168,6 +172,7 @@ private Q_SLOTS:
 
         job = openpgp()->verifyOpaqueJob(true);
         result = job->exec(data1, plaintext);
+        delete job;
 
         Q_ASSERT(!result.isNull());
         Q_ASSERT(!result.error());
@@ -188,6 +193,7 @@ private Q_SLOTS:
         /* Verify that another call yields the same result */
         job = openpgp()->verifyOpaqueJob(true);
         result = job->exec(data1, plaintext);
+        delete job;
 
         Q_ASSERT(!result.isNull());
         Q_ASSERT(!result.error());
@@ -215,14 +221,49 @@ private Q_SLOTS:
         std::vector<GpgME::Key> keys;
         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
                                                 true, keys);
+        delete job;
         Q_ASSERT(!keys.empty());
         Key key = keys[0];
         Q_ASSERT(!key.isNull());
 
-        signAndVerify(QStringLiteral("Hello"), key, 1);
-        signAndVerify(QStringLiteral("Hello2"), key, 2);
-        signAndVerify(QStringLiteral("Hello3"), key, 3);
-        signAndVerify(QStringLiteral("Hello4"), key, 4);
+        signAndVerify(QStringLiteral("Hello"), key, -1);
+        signAndVerify(QStringLiteral("Hello2"), key, -1);
+        signAndVerify(QStringLiteral("Hello3"), key, -1);
+        signAndVerify(QStringLiteral("Hello4"), key, -1);
+    }
+
+    void testTofuKeyList()
+    {
+        if (!testSupported()) {
+            return;
+        }
+
+        /* First check that the key has no tofu info. */
+        auto *job = openpgp()->keyListJob(false, false, false);
+        std::vector<GpgME::Key> keys;
+        auto result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
+                                                 true, keys);
+        delete job;
+        Q_ASSERT(!keys.empty());
+        auto key = keys[0];
+        Q_ASSERT(!key.isNull());
+        Q_ASSERT(key.userID(0).tofuInfo().isNull());
+        signAndVerify(QStringLiteral("Hello"), key, -1);
+        signAndVerify(QStringLiteral("Hello"), key, -1);
+
+        /* Now another one but with tofu */
+        job = openpgp()->keyListJob(false, false, false);
+        job->addMode(GpgME::WithTofu);
+        result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
+                           true, keys);
+        delete job;
+        Q_ASSERT(!result.error());
+        Q_ASSERT(!keys.empty());
+        auto key2 = keys[0];
+        Q_ASSERT(!key2.isNull());
+        auto info = key2.userID(0).tofuInfo();
+        Q_ASSERT(!info.isNull());
+        Q_ASSERT(info.signCount());
     }
 
     void initTestCase()

commit c875f07e559a7c53fc173b4c3f9f5715f3fbb8f8
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Aug 25 16:23:58 2016 +0200

    qt: Fix keyring copy in tests
    
    * lang/qt/test/t-encrypt.cpp,
    lang/qt/test/t-tofuinfo.cpp: Assert on copy failure.
    * lang/qt/test/t-support.cpp (copyKeyrings): Fix path.

diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp
index 44cea96..3d4cfa9 100644
--- a/lang/qt/tests/t-encrypt.cpp
+++ b/lang/qt/tests/t-encrypt.cpp
@@ -242,7 +242,7 @@ public Q_SLOT:
         Q_ASSERT(agentConf.open(QIODevice::WriteOnly));
         agentConf.write("allow-loopback-pinentry");
         agentConf.close();
-        copyKeyrings(gpgHome, mDir.path());
+        Q_ASSERT(copyKeyrings(gpgHome, mDir.path()));
     }
 
 private:
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp
index 73e8d5c..27c0132 100644
--- a/lang/qt/tests/t-support.cpp
+++ b/lang/qt/tests/t-support.cpp
@@ -50,7 +50,7 @@ bool QGpgMETest::copyKeyrings(const QString &src, const QString &dest)
     bool is21dir = QFileInfo(src + QDir::separator() + QStringLiteral("pubring.kbx")).exists();
     const QString name = is21dir ? QStringLiteral("pubring.kbx") :
                                   QStringLiteral("pubring.gpg");
-    if (!QFile::copy(src + name, dest + QDir::separator() + name)) {
+    if (!QFile::copy(src + QDir::separator() + name, dest + QDir::separator() + name)) {
         return false;
     }
     if (!is21dir) {
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index 7eea1ea..d306167 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -239,7 +239,7 @@ private Q_SLOTS:
         Q_ASSERT(agentConf.open(QIODevice::WriteOnly));
         agentConf.write("allow-loopback-pinentry");
         agentConf.close();
-        copyKeyrings(gpgHome, mDir.path());
+        Q_ASSERT(copyKeyrings(gpgHome, mDir.path()));
     }
 private:
     QTemporaryDir mDir;

commit 4e37d0bb1255558ce20e1a5ac83a2d06a37f8b0b
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Aug 25 16:22:12 2016 +0200

    qt: Add generic flag support for keylistjobs
    
    * lang/qt/src/keylistjob.h (addMode): New.
    * lang/qt/src/qgpgmekeylistjob.h (addMode): New.
    * lang/qt/src/qgpgmekeylistjob.cpp (addMode: New.
    
    --
    Instead of new API for each new thing lets be a bit more
    generic / open.

diff --git a/lang/qt/src/keylistjob.h b/lang/qt/src/keylistjob.h
index fc7a048..8dc736e 100644
--- a/lang/qt/src/keylistjob.h
+++ b/lang/qt/src/keylistjob.h
@@ -96,6 +96,9 @@ public:
 
     virtual GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly, std::vector<GpgME::Key> &keys) = 0;
 
+    /** Add a flag to the keylistmode used. */
+    virtual void addMode(GpgME::KeyListMode mode) = 0;
+
 Q_SIGNALS:
     void nextKey(const GpgME::Key &key);
     void result(const GpgME::KeyListResult &result, const std::vector<GpgME::Key> &keys = std::vector<GpgME::Key>(), const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp
index 49a3c03..1169c46 100644
--- a/lang/qt/src/qgpgmekeylistjob.cpp
+++ b/lang/qt/src/qgpgmekeylistjob.cpp
@@ -151,6 +151,11 @@ void QGpgMEKeyListJob::resultHook(const result_type &tuple)
         Q_EMIT nextKey(key);
     }
 }
+
+void QGpgMEKeyListJob::addMode(KeyListMode mode)
+{
+    context()->addKeyListMode(mode);
+}
 #if 0
 void QGpgMEKeyListJob::showErrorDialog(QWidget *parent, const QString &caption) const
 {
diff --git a/lang/qt/src/qgpgmekeylistjob.h b/lang/qt/src/qgpgmekeylistjob.h
index cbe1e94..2d5406a 100644
--- a/lang/qt/src/qgpgmekeylistjob.h
+++ b/lang/qt/src/qgpgmekeylistjob.h
@@ -74,9 +74,10 @@ public:
     /* from KeyListJob */
     GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly, std::vector<GpgME::Key> &keys) Q_DECL_OVERRIDE;
 
+    void addMode(GpgME::KeyListMode mode) Q_DECL_OVERRIDE;
+
     /* from ThreadedJobMixin */
     void resultHook(const result_type &result) Q_DECL_OVERRIDE;
-
 private:
     GpgME::KeyListResult mResult;
     bool mSecretOnly;

commit 5a92cc96da183ebb19867a2a910f53ba41e76ae9
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Aug 25 16:19:39 2016 +0200

    qt: Ensure that current src dir is included first
    
    * lang/qt/src/Makefile.am: Reorder include directives.
    
    --
    This fixes the problem that QGpgME would pick up gpgme or
    gpgme++ headers from an installed version.

diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index 8f6d773..59206ed 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -199,8 +199,9 @@ nodist_include_HEADERS = qgpgme_version.h
 
 libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
 
-AM_CPPFLAGS = @GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-              -DBUILDING_QGPGME -I$(top_srcdir)/lang/cpp/src
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/lang/cpp/src \
+              @GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
+              -DBUILDING_QGPGME
 
 libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
                        @LIBASSUAN_LIBS@ @GPGME_QT_LIBS@

commit f311b92ceaedb12c9e00a722b6b47bbe6b50871e
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Aug 25 16:17:46 2016 +0200

    cpp: Add WithTofu Keylist Mode
    
    * lang/cpp/src/context.cpp: Handle WithTofu.
    * lang/cpp/src/global.h (KeyListMode): Add WithTofu.
    * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Handle WithTofu.

diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 62cad20..564cff5 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -1420,6 +1420,7 @@ std::ostream &operator<<(std::ostream &os, KeyListMode mode)
     CHECK(Signatures);
     CHECK(Validate);
     CHECK(Ephemeral);
+    CHECK(WithTofu);
 #undef CHECK
     return os << ')';
 }
diff --git a/lang/cpp/src/global.h b/lang/cpp/src/global.h
index 3f12323..15cc027 100644
--- a/lang/cpp/src/global.h
+++ b/lang/cpp/src/global.h
@@ -61,7 +61,8 @@ enum KeyListMode {
     Signatures = 0x4,
     SignatureNotations = 0x8,
     Validate = 0x10,
-    Ephemeral = 0x20
+    Ephemeral = 0x20,
+    WithTofu = 0x40
 };
 
 enum SignatureMode { NormalSignatureMode, Detached, Clearsigned };
diff --git a/lang/cpp/src/util.h b/lang/cpp/src/util.h
index 8ccb0bf..b0d47e3 100644
--- a/lang/cpp/src/util.h
+++ b/lang/cpp/src/util.h
@@ -76,6 +76,9 @@ static inline gpgme_keylist_mode_t add_to_gpgme_keylist_mode_t(unsigned int oldm
     if (newmodes & GpgME::Validate) {
         oldmode |= GPGME_KEYLIST_MODE_VALIDATE;
     }
+    if (newmodes & GpgME::WithTofu) {
+        oldmode |= GPGME_KEYLIST_MODE_WITH_TOFU;
+    }
 #ifndef NDEBUG
     if (newmodes & ~(GpgME::Local | GpgME::Extern | GpgME::Signatures | GpgME::SignatureNotations | GpgME::Ephemeral | GpgME::Validate)) {
         //std::cerr << "GpgME::Context: keylist mode must be one of Local, "

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

Summary of changes:
 lang/cpp/src/context.cpp         |  1 +
 lang/cpp/src/global.h            |  3 +-
 lang/cpp/src/util.h              |  3 ++
 lang/qt/src/Makefile.am          |  5 ++--
 lang/qt/src/keylistjob.h         |  3 ++
 lang/qt/src/qgpgmekeylistjob.cpp |  5 ++++
 lang/qt/src/qgpgmekeylistjob.h   |  3 +-
 lang/qt/tests/t-encrypt.cpp      |  2 +-
 lang/qt/tests/t-support.cpp      |  2 +-
 lang/qt/tests/t-tofuinfo.cpp     | 63 +++++++++++++++++++++++++++++++++-------
 10 files changed, 73 insertions(+), 17 deletions(-)


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




More information about the Gnupg-commits mailing list