desktop/source/lib/init.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
New commits: commit 03f177d22873069e8e2e520c98f05ebfcc1b063c Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Dec 8 20:42:42 2021 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Mon Dec 13 12:58:03 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> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3bd212195f4d..bf4bd7883f4f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -175,6 +175,7 @@ #include "lokinteractionhandler.hxx" #include "lokclipboard.hxx" +#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Impress.hxx> using namespace css; @@ -6448,6 +6449,26 @@ static void activateNotebookbar(const OUString& 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) @@ -6757,6 +6778,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char } #endif + setCertificateDir(); + if (bNotebookbar) { activateNotebookbar("Writer");