diff options
-rw-r--r-- | config_host.mk.in | 2 | ||||
-rw-r--r-- | config_host/config_gpgme.h.in | 2 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | xmlsecurity/CppunitTest_xmlsecurity_signing.mk | 11 | ||||
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 29 |
5 files changed, 32 insertions, 15 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index 3543974328d5..9ed3802ad761 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -211,7 +211,6 @@ export EPOXY_LIBS=$(gb_SPACE)@EPOXY_LIBS@ export GLM_CFLAGS=$(gb_SPACE)@GLM_CFLAGS@ export GPG_ERROR_CFLAGS=$(gb_SPACE)@GPG_ERROR_CFLAGS@ export GPG_ERROR_LIBS=$(gb_SPACE)@GPG_ERROR_LIBS@ -export GPGCONF=@GPGCONF@ export GPGMEPP_CFLAGS=$(gb_SPACE)@GPGMEPP_CFLAGS@ export GPGMEPP_LIBS=$(gb_SPACE)@GPGMEPP_LIBS@ export GNUTLS_CFLAGS=$(gb_SPACE)@GNUTLS_CFLAGS@ @@ -256,7 +255,6 @@ export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@ export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@ export HAVE_GCC_SPLIT_DWARF=@HAVE_GCC_SPLIT_DWARF@ 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_HASH_STYLE=@HAVE_LD_HASH_STYLE@ export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@ diff --git a/config_host/config_gpgme.h.in b/config_host/config_gpgme.h.in index 4a2f24a2de61..3c483d08f564 100644 --- a/config_host/config_gpgme.h.in +++ b/config_host/config_gpgme.h.in @@ -29,6 +29,8 @@ // Defined if gpgme supports exporting minimal key. #define GPGME_CAN_EXPORT_MINIMAL_KEY 0 +#undef GPGME_GPGCONF + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configure.ac b/configure.ac index 92d21b8d0385..5e2524745005 100644 --- a/configure.ac +++ b/configure.ac @@ -10563,6 +10563,7 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then if $GPGCONF --dump-options | grep -q create-socketdir ; then AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_GPGCONF_SOCKETDIR]) + AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"]) else AC_MSG_RESULT([no]) fi @@ -10582,8 +10583,6 @@ 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 2f3ed41e2dfb..6a3cbcab2a58 100644 --- a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk +++ b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk @@ -58,17 +58,6 @@ ifeq ($(OS),LINUX) $(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 - -$(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 2a2c38945309..675b825c9995 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -12,6 +12,7 @@ #include <sal/config.h> +#include <cstdlib> #include <type_traits> #include <test/bootstrapfixture.hxx> @@ -59,6 +60,10 @@ class SigningTest : public test::BootstrapFixture, public unotest::MacrosTest, p uno::Reference<xml::crypto::XSEInitializer> mxSEInitializer; uno::Reference<xml::crypto::XXMLSecurityContext> mxSecurityContext; +#if HAVE_GPGCONF_SOCKETDIR + OString m_gpgconfCommandPrefix; +#endif + public: SigningTest(); virtual void setUp() override; @@ -188,6 +193,22 @@ void SigningTest::setUp() OUString gpgHomeVar("GNUPGHOME"); osl_setEnvironment(gpgHomeVar.pData, aTargetPath.pData); +#if HAVE_GPGCONF_SOCKETDIR + OString path; + bool ok = aTargetPath.convertToString( + &path, osl_getThreadTextEncoding(), + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR); + CPPUNIT_ASSERT_MESSAGE(OUStringToOString(aTargetPath, RTL_TEXTENCODING_UTF8).getStr(), ok); + // if conversion fails, at least provide a best-effort conversion in the message here, for + // context + m_gpgconfCommandPrefix = "GNUPGHOME=" + path + " " GPGME_GPGCONF; + // HAVE_GPGCONF_SOCKETDIR is only defined in configure.ac for Linux for now, so (a) std::system + // behavior will conform to POSIX, and (b) gpgconf --create-socketdir should return zero: + OString cmd = m_gpgconfCommandPrefix + " --create-socketdir"; + int res = std::system(cmd.getStr()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(cmd.getStr(), 0, res); +#endif + // Initialize crypto after setting up the environment variables. mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory())); mxDesktop.set(frame::Desktop::create(mxComponentContext)); @@ -200,6 +221,14 @@ void SigningTest::tearDown() if (mxComponent.is()) mxComponent->dispose(); +#if HAVE_GPGCONF_SOCKETDIR + // HAVE_GPGCONF_SOCKETDIR is only defined in configure.ac for Linux for now, so (a) std::system + // behavior will conform to POSIX, and (b) gpgconf --remove-socketdir should return zero: + OString cmd = m_gpgconfCommandPrefix + " --remove-socketdir"; + int res = std::system(cmd.getStr()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(cmd.getStr(), 0, res); +#endif + test::BootstrapFixture::tearDown(); } |