summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-07-12 14:34:43 +0200
committerMiklos Vajna <vmiklos@collabora.com>2023-07-12 15:41:26 +0200
commita0471ec6e9a000a4985af2ad2967498c71004085 (patch)
treef6d496ff7e83ee6c864aeccc62670d28aef9f7a0 /xmlsecurity
parent6716b9a8ddc255f3d2fc28591c36b16b59e7b9a6 (diff)
xmlsecurity: fix deadlock on preloading libsdlo.so
The trouble is that calling into the configmgr would require recursive access to the service manager, but that's protected by a non-recursive mutex. See <https://gerrit.libreoffice.org/c/core/+/153798/24#message-b04c747da2cb73230d88ec65cc8207ac8b124dda> for details. Change-Id: If75779a995c2ad8855073bd6538832a18953d4cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154356 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx44
1 files changed, 25 insertions, 19 deletions
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 7ce82fd9f943..9a6222c59e1e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -118,23 +118,29 @@ namespace
m_nODF = nTmp;
}
+
+ std::vector<std::u16string_view>& GetGUIServers()
+ {
+
#ifdef _WIN32
-std::vector<std::u16string_view> aGUIServers
- = { u"Gpg4win\\kleopatra.exe",
- u"Gpg4win\\bin\\kleopatra.exe",
- u"GNU\\GnuPG\\kleopatra.exe",
- u"GNU\\GnuPG\\launch-gpa.exe",
- u"GNU\\GnuPG\\gpa.exe",
- u"GnuPG\\bin\\gpa.exe",
- u"GNU\\GnuPG\\bin\\kleopatra.exe",
- u"GNU\\GnuPG\\bin\\launch-gpa.exe",
- u"GNU\\GnuPG\\bin\\gpa.exe",
- officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
+ static std::vector<std::u16string_view> aGUIServers
+ = { u"Gpg4win\\kleopatra.exe",
+ u"Gpg4win\\bin\\kleopatra.exe",
+ u"GNU\\GnuPG\\kleopatra.exe",
+ u"GNU\\GnuPG\\launch-gpa.exe",
+ u"GNU\\GnuPG\\gpa.exe",
+ u"GnuPG\\bin\\gpa.exe",
+ u"GNU\\GnuPG\\bin\\kleopatra.exe",
+ u"GNU\\GnuPG\\bin\\launch-gpa.exe",
+ u"GNU\\GnuPG\\bin\\gpa.exe",
+ officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
#else
-std::vector<std::u16string_view> aGUIServers
- = { u"kleopatra", u"seahorse", u"gpa", u"kgpg",
- officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
+ static std::vector<std::u16string_view> aGUIServers
+ = { u"kleopatra", u"seahorse", u"gpa", u"kgpg",
+ officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
#endif
+ return aGUIServers;
+ }
}
@@ -521,17 +527,17 @@ bool DigitalSignaturesDialog::GetPathAllOS(OUString& aPath)
void DigitalSignaturesDialog::GetCertificateManager(OUString& aPath, OUString& sExecutable,
OUString& sFoundGUIServer)
{
- aGUIServers.pop_back();
- aGUIServers.push_back(officecfg::Office::Common::Security::Scripting::CertMgrPath::get());
+ GetGUIServers().pop_back();
+ GetGUIServers().push_back(officecfg::Office::Common::Security::Scripting::CertMgrPath::get());
- for (auto it = aGUIServers.rbegin(); it != aGUIServers.rend(); ++it)
+ for (auto it = GetGUIServers().rbegin(); it != GetGUIServers().rend(); ++it)
{
const auto& rServer = *it;
if (rServer.empty())
continue;
- bool bValidSetMgr = (it == aGUIServers.rbegin() && rServer.size() > 0);
+ bool bValidSetMgr = (it == GetGUIServers().rbegin() && rServer.size() > 0);
sal_Int32 nLastBackslashIndex = -1;
if (bValidSetMgr)
@@ -549,7 +555,7 @@ void DigitalSignaturesDialog::GetCertificateManager(OUString& aPath, OUString& s
if (searchError == osl::FileBase::E_None)
{
osl::File::getSystemPathFromFileURL(sFoundGUIServer, sExecutable);
- if (it != aGUIServers.rbegin())
+ if (it != GetGUIServers().rbegin())
{
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());