summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2022-11-07 14:29:09 +0100
committerAndras Timar <andras.timar@collabora.com>2023-01-25 12:24:34 +0000
commit6053df3ecdf89886a4573a47aac789cacf4df008 (patch)
tree6b9f7cfedc04c760d57bf4123de7a4362998b12b /oox/source
parentbb391230db5387d708b6f4fbeec0442fb29d44be (diff)
NSS initialization guard
Change-Id: I61a5886d0d13eaef6a61479e35d52a85937075ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142385 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146042 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/crypto/CryptTools.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx
index ee68a8a50815..e0a4b9d686cc 100644
--- a/oox/source/crypto/CryptTools.cxx
+++ b/oox/source/crypto/CryptTools.cxx
@@ -21,6 +21,7 @@
#if USE_TLS_NSS
#include <nss.h>
+#include <nspr.h>
#include <pk11pub.h>
#endif // USE_TLS_NSS
@@ -167,7 +168,16 @@ struct CryptoImpl
, mWrapKey(nullptr)
{
// Initialize NSS, database functions are not needed
- NSS_NoDB_Init(nullptr);
+ if (!NSS_IsInitialized())
+ {
+ auto const e = NSS_NoDB_Init(nullptr);
+ if (e != SECSuccess)
+ {
+ PRErrorCode error = PR_GetError();
+ const char* errorText = PR_ErrorToName(error);
+ throw css::uno::RuntimeException("NSS_NoDB_Init failed with " + OUString(errorText, strlen(errorText), RTL_TEXTENCODING_UTF8) + " (" + OUString::number(static_cast<int>(error)) + ")");
+ }
+ }
}
~CryptoImpl()