diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-12-08 20:42:42 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-12-15 13:57:07 +0100 |
commit | 15fad73dd274f604f24a1c172c1b9e6e1668cfd8 (patch) | |
tree | de4d81ce40bbb5d21d08414b1c88009cb7cd8ad5 /desktop | |
parent | 753df71399898ef5b792f188934d2fb041ca0d78 (diff) |
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.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126853
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 19b5578d704e..5e82c3d379ff 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -183,6 +183,7 @@ #include "lokinteractionhandler.hxx" #include "lokclipboard.hxx" +#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Impress.hxx> using namespace css; @@ -6267,6 +6268,25 @@ static void activateNotebookbar(const OUString& rApp) aAppNode.commit(); } } +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) { @@ -6575,6 +6595,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char } #endif + setCertificateDir(); + if (bNotebookbar) { activateNotebookbar("Writer"); |