summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRene Engelhard <rene@debian.org>2018-03-18 11:25:41 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-03-18 17:21:03 +0100
commitd7ecf4a4e37a9eeffa2b40f9fe5a2e6a8f90c876 (patch)
tree26cea37ed3ca6d89cfcd18b0b46d527f1b6731d3
parentf68929ac611fdda19c1ee413effc59d33aa5ef97 (diff)
properly check for gpgconf (and --create-socketdir) working
Change-Id: I21268e5950381845eb90bf66a42a99adc3821eaa Reviewed-on: https://gerrit.libreoffice.org/51493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--config_host/config_gpgme.h.in3
-rw-r--r--configure.ac23
-rw-r--r--xmlsecurity/CppunitTest_xmlsecurity_signing.mk4
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx8
4 files changed, 37 insertions, 1 deletions
diff --git a/config_host/config_gpgme.h.in b/config_host/config_gpgme.h.in
index 7e46f3703ec3..4a2f24a2de61 100644
--- a/config_host/config_gpgme.h.in
+++ b/config_host/config_gpgme.h.in
@@ -19,6 +19,9 @@
// Defined if gpg and gpgme signature verification is available
#define HAVE_FEATURE_GPGVERIFY 0
+// Defined if gpgconf --create-socketdir works
+#define HAVE_GPGCONF_SOCKETDIR 0
+
#if HAVE_FEATURE_GPGME
# include "config_lgpl.h"
#endif
diff --git a/configure.ac b/configure.ac
index 8fa43fd0c31e..ff011fbdd57e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10355,6 +10355,27 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
# gpg installation to run OpenPGP signature verification
AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
fi
+ if test "$_os" = "Linux"; then
+ uid=`id -u`
+ AC_MSG_CHECKING([for /run/user/$uid])
+ if test -d /run/user/$uid; then
+ AC_MSG_RESULT([yes])
+ AC_PATH_PROG(GPGCONF, gpgconf)
+ AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
+ if $(GPGCONF) --dump-options > /dev/null ; then
+ if $(GPGCONF) --dump-options | grep -q create-socketdir ; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ else
+ AC_MSG_RESULT([no. missing or broken gpgconf?])
+ fi
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
fi
AC_SUBST(ENABLE_GPGMEPP)
AC_SUBST(SYSTEM_GPGMEPP)
@@ -10364,6 +10385,8 @@ AC_SUBST(LIBASSUAN_CFLAGS)
AC_SUBST(LIBASSUAN_LIBS)
AC_SUBST(GPGMEPP_CFLAGS)
AC_SUBST(GPGMEPP_LIBS)
+AC_SUBST(GPGCONF)
+AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
diff --git a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
index 747ffdd7041b..2f3ed41e2dfb 100644
--- a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
+++ b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
@@ -59,14 +59,16 @@ $(call gb_CppunitTest_get_target,xmlsecurity_signing): \
EXTRA_ENV_VARS := \
LIBO_LD_PATH=$$LD_LIBRARY_PATH
+ifneq (,$(HAVE_GPGCONF_SOCKETDIR))
# create socket dir below /run/user/ instead of in workdir
.PHONY : gb_CppunitTest_run_gpgconf
gb_CppunitTest_run_gpgconf:
GNUPGHOME=$(WORKDIR)/CppunitTest/xmlsecurity_signing.test.user \
- gpgconf --create-socketdir 2>/dev/null || true
+ $(GPGCONF) --create-socketdir
$(call gb_CppunitTest_get_target,xmlsecurity_signing): \
gb_CppunitTest_run_gpgconf
endif
+endif
# vim: set noet sw=4 ts=4:
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index 6efb6f02e029..b342adeeb80d 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -106,9 +106,11 @@ public:
void testODFBrokenStreamGPG();
/// Test a typical broken ODF signature where the XML dsig hash is corrupted.
void testODFBrokenDsigGPG();
+#if HAVE_GPGCONF_SOCKETDIR
/// Test loading an encrypted ODF document
void testODFEncryptedGPG();
#endif
+#endif
CPPUNIT_TEST_SUITE(SigningTest);
CPPUNIT_TEST(testDescription);
CPPUNIT_TEST(testODFGood);
@@ -136,8 +138,10 @@ public:
CPPUNIT_TEST(testODFUntrustedGoodGPG);
CPPUNIT_TEST(testODFBrokenStreamGPG);
CPPUNIT_TEST(testODFBrokenDsigGPG);
+#if HAVE_GPGCONF_SOCKETDIR
CPPUNIT_TEST(testODFEncryptedGPG);
#endif
+#endif
CPPUNIT_TEST_SUITE_END();
private:
@@ -736,6 +740,8 @@ void SigningTest::testODFBrokenDsigGPG()
CPPUNIT_ASSERT_EQUAL(static_cast<int>(SignatureState::BROKEN), static_cast<int>(pObjectShell->GetDocumentSignatureState()));
}
+#if HAVE_GPGCONF_SOCKETDIR
+
void SigningTest::testODFEncryptedGPG()
{
createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "encryptedGPG.odt");
@@ -747,6 +753,8 @@ void SigningTest::testODFEncryptedGPG()
#endif
+#endif
+
void SigningTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
{
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("odfds"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"));