diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-01-29 20:52:20 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-02-06 12:28:50 +0100 |
commit | c461648d4918ea3f885f4800462eabb0d20f0572 (patch) | |
tree | b829e8a639eca25e9c56b5d2ef061c4740666145 /xmlsecurity | |
parent | 24c7a6d77de0769ba944f3f56e5cb37399b165e0 (diff) |
tdf#159307 Fix GetCertificateManager
...which had always cut off an existing path ever since
92b6ffcd9f687cc54a0fc3801ca85c7e4d77512f "Allow selecting a custom certificate
manager", for reasons that are unclear to me.
So if an existing setting contains at least one slash (or backslash, on
Windows), try to use it as-is; otherwise, keep searching for it in aPath. (And,
in any case, make sure to report back the given value in sExecutable.)
Change-Id: I8b2b6ac7a449d7afd02e029ff46d4c79e6b824e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162703
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162800
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 3cd13c6060cf..f2bb37241b7c 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -154,16 +154,23 @@ void GetCertificateManager(OUString& sExecutable) OUString aCetMgrConfig = officecfg::Office::Common::Security::Scripting::CertMgrPath::get(); if (!aCetMgrConfig.isEmpty()) { + if (aCetMgrConfig.indexOf('/') != -1 #ifdef _WIN32 - sal_Int32 nLastBackslashIndex = aCetMgrConfig.lastIndexOf('\\'); -#else - sal_Int32 nLastBackslashIndex = aCetMgrConfig.lastIndexOf('/'); + || aCetMgrConfig.indexOf('\\') != -1 #endif + ) + { + sExecutable = aCetMgrConfig; + return; + } osl::FileBase::RC searchError = osl::File::searchFileURL( - aCetMgrConfig.copy(0, nLastBackslashIndex + 1), aPath, + aCetMgrConfig, aPath, aFoundGUIServer); if (searchError == osl::FileBase::E_None) + { + osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable); return; + } } for (const auto& rServer: aGUIServers) |