summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2017-12-08 00:10:42 +0100
committerRene Engelhard <rene@debian.org>2017-12-11 13:12:45 +0100
commite52e0403d42f7a0c29700cda3d5791915ae95297 (patch)
tree85ad6477f0024354a8d93201fd38e233b65e0b10 /xmlsecurity
parenta63e8a7fa3b0f98501e8bc20a1adf6ca235a7dd1 (diff)
gpg4libre: check if we can really verify OpenPGP signatures
And disable unit tests otherwise Change-Id: I32e1d8d2f8b0013d9cb43b78a55d23a1a29a8e8d Reviewed-on: https://gerrit.libreoffice.org/46057 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 7886de305809e265cd2126d39912147131d3a004) Reviewed-on: https://gerrit.libreoffice.org/46191 Reviewed-by: Rene Engelhard <rene@debian.org>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx20
1 files changed, 7 insertions, 13 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index 9ea266907bcb..7e737f8f3bd4 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -42,6 +42,7 @@
#include <sfx2/sfxbasemodel.hxx>
#include <sfx2/objsh.hxx>
#include <osl/file.hxx>
+#include <osl/process.h>
#include <comphelper/ofopxmlhelper.hxx>
#include <documentsignaturehelper.hxx>
@@ -103,8 +104,7 @@ public:
void testXAdESGood();
/// Test importing of signature line images
void testSignatureLineImages();
-#ifdef LINUX
-# if HAVE_FEATURE_GPGME
+#if HAVE_FEATURE_GPGVERIFY
/// Test a typical ODF where all streams are GPG-signed.
void testODFGoodGPG();
/// Test a typical ODF where all streams are GPG-signed, but we don't trust the signature.
@@ -113,7 +113,6 @@ public:
void testODFBrokenStreamGPG();
/// Test a typical broken ODF signature where the XML dsig hash is corrupted.
void testODFBrokenDsigGPG();
-# endif
#endif
CPPUNIT_TEST_SUITE(SigningTest);
CPPUNIT_TEST(testDescription);
@@ -137,13 +136,11 @@ public:
CPPUNIT_TEST(testXAdES);
CPPUNIT_TEST(testXAdESGood);
CPPUNIT_TEST(testSignatureLineImages);
-#ifdef LINUX
-# if HAVE_FEATURE_GPGME
+#if HAVE_FEATURE_GPGVERIFY
CPPUNIT_TEST(testODFGoodGPG);
CPPUNIT_TEST(testODFUntrustedGoodGPG);
CPPUNIT_TEST(testODFBrokenStreamGPG);
CPPUNIT_TEST(testODFBrokenDsigGPG);
-# endif
#endif
CPPUNIT_TEST_SUITE_END();
@@ -177,15 +174,14 @@ void SigningTest::setUp()
osl::FileBase::getSystemPathFromFileURL(aTargetDir, aTargetPath);
setenv("MOZILLA_CERTIFICATE_FOLDER", aTargetPath.toUtf8().getStr(), 1);
#endif
-#ifdef LINUX
-# if HAVE_FEATURE_GPGME
+#if HAVE_FEATURE_GPGVERIFY
// Make gpg use our own defined setup below data dir
OUString aHomePath;
osl::FileBase::getSystemPathFromFileURL(
m_directories.getURLFromSrc(DATA_DIRECTORY),
aHomePath);
- setenv("GNUPGHOME", aHomePath.toUtf8().getStr(), 1);
-# endif
+ OUString envVar("GNUPGHOME");
+ osl_setEnvironment(envVar.pData, aHomePath.pData);
#endif
}
@@ -687,8 +683,7 @@ void SigningTest::testSignatureLineImages()
CPPUNIT_ASSERT(xSignatureInfo[0].InvalidSignatureLineImage.is());
}
-#ifdef LINUX
-# if HAVE_FEATURE_GPGME
+#if HAVE_FEATURE_GPGVERIFY
void SigningTest::testODFGoodGPG()
{
createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "goodGPG.odt");
@@ -743,7 +738,6 @@ void SigningTest::testODFBrokenDsigGPG()
CPPUNIT_ASSERT(pObjectShell);
CPPUNIT_ASSERT_EQUAL(static_cast<int>(SignatureState::BROKEN), static_cast<int>(pObjectShell->GetDocumentSignatureState()));
}
-# endif
#endif
void SigningTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)