Backport upstream fix for testSignDocument_PEM_PDF test failure

Enable test again
f41
Mamoru TASAKA 2 years ago
parent 5dc3f05fdc
commit d9eb7d48cf

@ -0,0 +1,61 @@
From 599722cf77310429a9b9bd2a348486a08b60de0d Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.com>
Date: Mon, 13 Mar 2023 20:04:17 +0100
Subject: svl: fix CppunitTest_desktop_lib's
DesktopLOKTest::testSignDocument_PEM_PDF
The problem was that this test passed when the entire suite was running,
but not as an individual test.
Digging deeper, this didn't pass in isolation because the test loads a
private key into memory (which is not in the NSS DB) and since commit
5592ee094ca9f09bfcc16537d931518d4e6b2231 (svl: fix
testSignDocument_PEM_PDF with "dbm:" NSS DB, 2022-04-28) we delete that
in-memory key as a workaround for the NSS dbm -> sqlite transition.
Fix the problem by not deleting the in-memory private key in the LOK
case: this makes the test (operating in a stateless mode, with in-memory
keys) pass again and keeps the desktop signing (working with the NSS DB)
working.
I noticed this test failure as a local test update of libxmlsec to 1.3
RC started to fail here even when the whole suite was running, but looks
like this was working by accident before anyway, and the fix doesn't
hurt for libxmlsec 1.2, either.
Change-Id: Id365ddc5c5d04d538609f444c0e3c4ab4b32a6fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148817
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
---
svl/source/crypto/cryptosign.cxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 1d6337845569..e68ccb8aafda 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -26,6 +26,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/random.hxx>
#include <comphelper/scopeguard.hxx>
+#include <comphelper/lok.hxx>
#include <com/sun/star/security/XCertificate.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
@@ -640,7 +641,11 @@ NSSCMSMessage *CreateCMSMessage(const PRTime* time,
// if it works, and fallback if it doesn't.
if (SECKEYPrivateKey * pPrivateKey = PK11_FindKeyByAnyCert(cert, nullptr))
{
- SECKEY_DestroyPrivateKey(pPrivateKey);
+ if (!comphelper::LibreOfficeKit::isActive())
+ {
+ // pPrivateKey only exists in the memory in the LOK case, don't delete it.
+ SECKEY_DestroyPrivateKey(pPrivateKey);
+ }
*cms_signer = NSS_CMSSignerInfo_Create(result, cert, SEC_OID_SHA256);
}
else
--
cgit v1.2.1

@ -55,7 +55,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.2
Release: 1%{?libo_prerelease}%{?dist}
Release: 2%{?libo_prerelease}%{?dist}
# default new files are: MPLv2
# older files are typically: MPLv2 incorporating work under ASLv2
# nlpsolver is: LGPLv3
@ -268,6 +268,8 @@ Patch4: 0001-default-to-sifr-for-gnome-light-mode.patch
# TODO investigate these
Patch5: 0001-aarch64-failing-here.patch
Patch6: 0001-include-filename-if-the-test-fails.patch
# backported
Patch7: 0001-fix-testSignDocument_PEM_PDF.patch
# not upstreamed
Patch500: 0001-disable-libe-book-support.patch
@ -1493,10 +1495,10 @@ install -m 0755 -d %{buildroot}%{baseinstdir}/share/extensions
rm -f %{buildroot}%{baseinstdir}/program/officebean.abignore
%endif
#%%check
#make unitcheck slowcheck
## we don't need this anymore
#rm -f %%{buildroot}%%{baseinstdir}/program/classes/smoketest.jar
%check
make unitcheck slowcheck
# we don't need this anymore
rm -f %{buildroot}%{baseinstdir}/program/classes/smoketest.jar
%files
@ -2248,6 +2250,10 @@ gtk-update-icon-cache -q %{_datadir}/icons/hicolor &>/dev/null || :
%{_includedir}/LibreOfficeKit
%changelog
* Mon Jun 19 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1:7.5.4.2-2
- Backport upstream fix for testSignDocument_PEM_PDF test failure
- Enable test again
* Fri Jun 16 2023 Gwyn Ciesla <gwync@protonmail.com> - 1:7.5.4.2-1
- 7.5.4.2
- Drop 0001-tdf-155161-Always-embed-fonts-with-CFF2-table-as-PDF.patch, upstreamed.

Loading…
Cancel
Save