Date: prev next · Thread: first prev next last
2018 Archives by date, by thread · List index



hi,

anybody got an insight into NSS initialisation to tell me if this is a good fix?

it seems plausible to me, but i haven't tested it, and my OS is so new it creates the new SQL profiles by default anyway.

anybody got an old system and some time to test if it actually works?

but i'm thinking we need some insight here before backporting the recent bundled NSS upgrade to release branches :)



-------- Forwarded Message --------
Subject: [PATCH] xmlsecurity: nsscrypto_initialize: try to avoid profile migr...
Date:   Thu, 9 Aug 2018 12:02:55 +0200
From:   Michael Stahl (via Code Review) <gerrit@gerrit.libreoffice.org>
Reply-To:       Michael.Stahl@cib.de
CC:     Michael Stahl <Michael.Stahl@cib.de>



Hi,

I would like you to review the following patch:

    https://gerrit.libreoffice.org/58756

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/56/58756/1

xmlsecurity: nsscrypto_initialize: try to avoid profile migration

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_3.35_release_notes

NSS 3.35 and later will automatically migrate migrate profiles from the
old "dbm:" BDB format to the new "sql:" SQLite format.

The new format can be read by NSS 3.12 and later, which is old enough that
it can be assumed to be available.

However LibreOffice still shouldn't migrate the profile on its own:
LO typically uses a Mozilla Firefox or Thunderbird profile, and if it is
a system Firefox with system NSS libraries, then it's probably a bad
idea for LO to migrate the profile under Firefox's nose, particularly
considering the "partial migration" scenario if the profile is
password-protected.

Try to avoid this by checking if the profile is the old format and
explicitly using the "dbm:" prefix to prevent the migration.

Change-Id: I06480522f830ce74e2fb7bf79fee84ad80979b82
---
M xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
1 file changed, 14 insertions(+), 0 deletions(-)



diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx 
b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index dd035c6..b1f16df 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -244,6 +244,20 @@
     // there might be no profile
     if ( !sCertDir.isEmpty() )
     {
+        if (sCertDir.indexOf(':') == -1) //might be env var with explicit prefix
+        {
+            OUString sCertDirURL;
+            osl::FileBase::getFileURLFromSystemPath(
+                OStringToOUString(sCertDir, osl_getThreadTextEncoding()),
+                sCertDirURL);
+            osl::DirectoryItem item;
+            if (osl::FileBase::E_NOENT == osl::DirectoryItem::get(sCertDirURL + "/cert8.db", item) 
&&
+                osl::FileBase::E_NOENT != osl::DirectoryItem::get(sCertDirURL + "/cert9.db", item))
+            {
+                SAL_INFO("xmlsecurity.xmlsec", "nsscrypto_initialize: trying to avoid profile 
migration");
+                sCertDir = "dbm:" + sCertDir;
+            }
+        }
         if( NSS_InitReadWrite( sCertDir.getStr() ) != SECSuccess )
         {
             SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with profile failed.");

--
To view, visit https://gerrit.libreoffice.org/58756
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I06480522f830ce74e2fb7bf79fee84ad80979b82
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Michael Stahl <Michael.Stahl@cib.de>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.