desktop/source/lib/init.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
New commits: commit 089ecba05dbe502709209829385c34a2e492ed6f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Dec 8 20:42:42 2021 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Dec 14 10:20:55 2021 +0100 lokit: add env. var to set the certificate database dir This adds to LOKit a way to set the certificate database dir with a env. var. - LO_CERTIFICATE_DATABASE_PATH, which is used for signing and encrypting of documents. Change-Id: Ieb7725d41893212d962c8b9e32f9607d0ba10397 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126553 Tested-by: Andras Timar <andras.ti...@collabora.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 03f177d22873069e8e2e520c98f05ebfcc1b063c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126807 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a1d1cf317f36..3be80637ec26 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -177,6 +177,7 @@ #include "lokinteractionhandler.hxx" #include "lokclipboard.hxx" +#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Impress.hxx> using namespace css; @@ -6402,6 +6403,26 @@ static void activateNotebookbar(std::u16string_view rApp) } } +void setCertificateDir() +{ + const char* pEnvVarString = ::getenv("LO_CERTIFICATE_DATABASE_PATH"); + if (pEnvVarString) + { + OUString aCertificateDatabasePath = OStringToOUString(pEnvVarString, RTL_TEXTENCODING_UTF8); + try + { + std::shared_ptr<comphelper::ConfigurationChanges> pBatch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Security::Scripting::CertDir::set(aCertificateDatabasePath, pBatch); + officecfg::Office::Common::Security::Scripting::ManualCertDir::set(aCertificateDatabasePath, pBatch); + pBatch->commit(); + } + catch (uno::Exception const& rException) + { + SAL_WARN("lok", "Failed to set the NSS certificate database directory: " << rException.Message); + } + } +} + } static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl) @@ -6708,6 +6729,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char } #endif + setCertificateDir(); + if (bNotebookbar) { activateNotebookbar(u"Writer");