Kaydet (Commit) 0e734568 authored tarafından Rene Engelhard's avatar Rene Engelhard Kaydeden (comit) Andras Timar

gpg4libre: fix failing gpg test due to over-long filenames

This squashes the following commits:

From f68929ac Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Date: Fri, 9 Mar 2018 01:38:26 +0100
Subject: gpg4libre: fix failing gpg test due to over-long filenames

With long workdir path, gpg sometimes fails with 'gpg: can't connect
to the agent: File name too long' error.
WK recommends to create preferred socket dir under /run/user, needs
prepping though via gpgconf.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=84720

From d7ecf4a4 Mon Sep 17 00:00:00 2001
From: Rene Engelhard <rene@debian.org>
Date: Sun, 18 Mar 2018 11:25:41 +0100
Subject: properly check for gpgconf (and --create-socketdir) working

From d6ed1d41 Mon Sep 17 00:00:00 2001
From: Rene Engelhard <rene@debian.org>
Date: Sun, 18 Mar 2018 19:06:58 +0100
Subject: actually add GPGCONF to config_host.mk.in

From 7a95ee8d Mon Sep 17 00:00:00 2001
From: Rene Engelhard <rene@debian.org>
Date: Sun, 18 Mar 2018 19:26:45 +0100
Subject: actually add HAVE_GPGCONF_SOCKETDIR to config_host.mk.in...

From 5204a514 Mon Sep 17 00:00:00 2001
From: Rene Engelhard <rene@debian.org>
Date: Sun, 18 Mar 2018 19:28:55 +0100
Subject: revert accidentially comitted local changes :(

From bc358d39 Mon Sep 17 00:00:00 2001
From: Rene Engelhard <rene@debian.org>
Date: Sun, 18 Mar 2018 20:36:45 +0100
Subject: this is sh, not make...

Change-Id: I7880fd7eee57cedc19b72348b45f0c1389409fe6
Reviewed-on: https://gerrit.libreoffice.org/51521Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit 74d438f7)
üst a819da79
...@@ -198,6 +198,7 @@ export EPOXY_LIBS=$(gb_SPACE)@EPOXY_LIBS@ ...@@ -198,6 +198,7 @@ export EPOXY_LIBS=$(gb_SPACE)@EPOXY_LIBS@
export GLM_CFLAGS=$(gb_SPACE)@GLM_CFLAGS@ export GLM_CFLAGS=$(gb_SPACE)@GLM_CFLAGS@
export GPG_ERROR_CFLAGS=$(gb_SPACE)@GPG_ERROR_CFLAGS@ export GPG_ERROR_CFLAGS=$(gb_SPACE)@GPG_ERROR_CFLAGS@
export GPG_ERROR_LIBS=$(gb_SPACE)@GPG_ERROR_LIBS@ export GPG_ERROR_LIBS=$(gb_SPACE)@GPG_ERROR_LIBS@
export GPGCONF=@GPGCONF@
export GPGMEPP_CFLAGS=$(gb_SPACE)@GPGMEPP_CFLAGS@ export GPGMEPP_CFLAGS=$(gb_SPACE)@GPGMEPP_CFLAGS@
export GPGMEPP_LIBS=$(gb_SPACE)@GPGMEPP_LIBS@ export GPGMEPP_LIBS=$(gb_SPACE)@GPGMEPP_LIBS@
export GNUTLS_CFLAGS=$(gb_SPACE)@GNUTLS_CFLAGS@ export GNUTLS_CFLAGS=$(gb_SPACE)@GNUTLS_CFLAGS@
...@@ -241,6 +242,7 @@ export HAVE_GCC_FNO_INLINE=@HAVE_GCC_FNO_INLINE@ ...@@ -241,6 +242,7 @@ export HAVE_GCC_FNO_INLINE=@HAVE_GCC_FNO_INLINE@
export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@ export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@
export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@ export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@
export HAVE_GNUMAKE_FILE_FUNC=@HAVE_GNUMAKE_FILE_FUNC@ export HAVE_GNUMAKE_FILE_FUNC=@HAVE_GNUMAKE_FILE_FUNC@
export HAVE_GPGCONF_SOCKETDIR=@HAVE_GPGCONF_SOCKETDIR@
export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@ export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@
export HAVE_LD_HASH_STYLE=@HAVE_LD_HASH_STYLE@ export HAVE_LD_HASH_STYLE=@HAVE_LD_HASH_STYLE@
export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@ export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
// Defined if gpg and gpgme signature verification is available // Defined if gpg and gpgme signature verification is available
#define HAVE_FEATURE_GPGVERIFY 0 #define HAVE_FEATURE_GPGVERIFY 0
// Defined if gpgconf --create-socketdir works
#define HAVE_GPGCONF_SOCKETDIR 0
#if HAVE_FEATURE_GPGME #if HAVE_FEATURE_GPGME
# include "config_lgpl.h" # include "config_lgpl.h"
#endif #endif
......
...@@ -10170,6 +10170,27 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then ...@@ -10170,6 +10170,27 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
# gpg installation to run OpenPGP signature verification # gpg installation to run OpenPGP signature verification
AC_DEFINE([HAVE_FEATURE_GPGVERIFY]) AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
fi 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 fi
AC_SUBST(ENABLE_GPGMEPP) AC_SUBST(ENABLE_GPGMEPP)
AC_SUBST(SYSTEM_GPGMEPP) AC_SUBST(SYSTEM_GPGMEPP)
...@@ -10179,6 +10200,8 @@ AC_SUBST(LIBASSUAN_CFLAGS) ...@@ -10179,6 +10200,8 @@ AC_SUBST(LIBASSUAN_CFLAGS)
AC_SUBST(LIBASSUAN_LIBS) AC_SUBST(LIBASSUAN_LIBS)
AC_SUBST(GPGMEPP_CFLAGS) AC_SUBST(GPGMEPP_CFLAGS)
AC_SUBST(GPGMEPP_LIBS) AC_SUBST(GPGMEPP_LIBS)
AC_SUBST(GPGCONF)
AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
AC_MSG_CHECKING([whether to build the Wiki Publisher extension]) 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 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
......
...@@ -52,11 +52,23 @@ ifeq ($(ENABLE_PDFIMPORT),TRUE) ...@@ -52,11 +52,23 @@ ifeq ($(ENABLE_PDFIMPORT),TRUE)
$(eval $(call gb_CppunitTest_use_executable,xmlsecurity_signing,xpdfimport)) $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_signing,xpdfimport))
endif endif
# reset the LD_LIBRARY_PATH for spawned GPG processes # various hacks to make unit test work on Linux more often
ifeq ($(OS),LINUX) ifeq ($(OS),LINUX)
# reset the LD_LIBRARY_PATH for spawned GPG processes
$(call gb_CppunitTest_get_target,xmlsecurity_signing): \ $(call gb_CppunitTest_get_target,xmlsecurity_signing): \
EXTRA_ENV_VARS := \ EXTRA_ENV_VARS := \
LIBO_LD_PATH=$$LD_LIBRARY_PATH 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
$(call gb_CppunitTest_get_target,xmlsecurity_signing): \
gb_CppunitTest_run_gpgconf
endif
endif endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -113,8 +113,10 @@ public: ...@@ -113,8 +113,10 @@ public:
void testODFBrokenStreamGPG(); void testODFBrokenStreamGPG();
/// Test a typical broken ODF signature where the XML dsig hash is corrupted. /// Test a typical broken ODF signature where the XML dsig hash is corrupted.
void testODFBrokenDsigGPG(); void testODFBrokenDsigGPG();
#if HAVE_GPGCONF_SOCKETDIR
/// Test loading an encrypted ODF document /// Test loading an encrypted ODF document
void testODFEncryptedGPG(); void testODFEncryptedGPG();
#endif
#endif #endif
CPPUNIT_TEST_SUITE(SigningTest); CPPUNIT_TEST_SUITE(SigningTest);
CPPUNIT_TEST(testDescription); CPPUNIT_TEST(testDescription);
...@@ -143,7 +145,9 @@ public: ...@@ -143,7 +145,9 @@ public:
CPPUNIT_TEST(testODFUntrustedGoodGPG); CPPUNIT_TEST(testODFUntrustedGoodGPG);
CPPUNIT_TEST(testODFBrokenStreamGPG); CPPUNIT_TEST(testODFBrokenStreamGPG);
CPPUNIT_TEST(testODFBrokenDsigGPG); CPPUNIT_TEST(testODFBrokenDsigGPG);
#if HAVE_GPGCONF_SOCKETDIR
CPPUNIT_TEST(testODFEncryptedGPG); CPPUNIT_TEST(testODFEncryptedGPG);
#endif
#endif #endif
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -743,6 +747,8 @@ void SigningTest::testODFBrokenDsigGPG() ...@@ -743,6 +747,8 @@ void SigningTest::testODFBrokenDsigGPG()
CPPUNIT_ASSERT_EQUAL(static_cast<int>(SignatureState::BROKEN), static_cast<int>(pObjectShell->GetDocumentSignatureState())); CPPUNIT_ASSERT_EQUAL(static_cast<int>(SignatureState::BROKEN), static_cast<int>(pObjectShell->GetDocumentSignatureState()));
} }
#if HAVE_GPGCONF_SOCKETDIR
void SigningTest::testODFEncryptedGPG() void SigningTest::testODFEncryptedGPG()
{ {
createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "encryptedGPG.odt"); createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "encryptedGPG.odt");
...@@ -754,6 +760,8 @@ void SigningTest::testODFEncryptedGPG() ...@@ -754,6 +760,8 @@ void SigningTest::testODFEncryptedGPG()
#endif #endif
#endif
void SigningTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) void SigningTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
{ {
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("odfds"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("odfds"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment