diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-12-08 20:42:42 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-12-14 10:20:55 +0100 |
commit | 089ecba05dbe502709209829385c34a2e492ed6f (patch) | |
tree | 32c4c1aacb2f15c18935e8b2ef2950805904f5fe /desktop | |
parent | 355878558967ef5a94c73f2ad92d26f62bd703f4 (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>
(cherry picked from commit 03f177d22873069e8e2e520c98f05ebfcc1b063c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126807
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
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"); |