264 Commits
Author SHA1 Message Date
Xisco Fauli eb0c65a1a1 UnoApiTest: pass PDFium to parsePDFExport as parameter
so we can check if it's not a nullptr at test level

Change-Id: Icfe580b27f3ad4a28b328f0fac8cf93e05c50b54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210484
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-04 15:32:19 +02:00
Mike Kaganski 6601fe8419 cool#15956: keep insertion order in NameContainer's getElementNames
This is required to keep content of Basic/script-lc.xml and each
Basic/<lib>/script-lb.xml byte-identical on round-trip, which is
necessary for signatures to stay valid; this broke after commit
ea2a974386 (Simplify NameContainer,
2024-12-01).

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ib30b701dce8bbcb919c88f5b66f5134150ded575
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5025
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit bfe67bc782cf89e944324042c8e53c42f4b6421b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207164
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-23 16:48:18 +02:00
Miklos Vajna 0a924c8a9a xmlsecurity: fix loplugin:externandnotdefined, loplugin:unreffun
When using --disable-gpgmepp.

Change-Id: Ibed70fc353173c4594748266796381b9fd2bade9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200341
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2026-02-27 08:26:01 +01:00
Gabor Kelemen a9e9175ba6 tdf#146619 Use more forward declarations in include/sfx2
This shaves off some 300M of input
Change-Id: I2fae9ff6c6dab31010986e55365676d4a01f402d

Change-Id: I3b2551a1937929100f25c01c0c416a419e7fbb51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199388
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2026-02-23 12:19:48 +01:00
Xisco Fauli ba3fb9026c merge UnoApiText and UnoApiXmlTest
in preparation for a follow-up commit

Change-Id: I3449c031696fe3ab13d4832e2671da08eb483cdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199552
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-18 21:17:13 +01:00
Xisco Fauli 238f8496f9 vcl, xmlsecurity: only load one document per test
Change-Id: If62baa2b3650950fec5b78a4472c4ee5151fe954
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199497
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-17 08:34:31 +01:00
Xisco Fauli 6577d2a942 UnoApiTest: merge loadFromURL and loadWithParams into one
Change-Id: Ib58c211542018f07303cadacda86e3419062401e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199297
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-12 20:58:05 +01:00
Xisco Fauli 53d3a02db5 UnoApiTest: drop setFilterOptions
and just pass FilterOptions as a parameter

Change-Id: Ie950bd1565e5e6223b232e723bec75409b96420c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198646
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-04 14:27:23 +01:00
Mike Kaganski d0e23db89a Drop MacrosTest::Resetter, and use comphelper::ScopeGuard
Change-Id: I2214724567a58174b175a17fbabec7a5249e4df8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198482
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-02-01 19:38:44 +01:00
Pragat Pandya 89559c8bc7 tdf#168771 Convert enum to enum class in xmlreader and xmlsecurity
Converted plain enums to enum class for better type safety:

- xmlreader: Converted two local Space enums to enum class and removed
  redundant SPACE_ prefix from enum values (NONE, SPAN, BREAK, START)
- xmlsecurity: Converted EqualMode enum to enum class
- xmlsecurity: Converted local State enum in CompatDNCryptoAPI to enum class

Updated all usages across 8 files to use scoped enum syntax.

Change-Id: I27fd7280bccad72a43cda3b669b1f0926c34271c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196207
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2025-12-29 19:39:46 +01:00
Gabor Kelemen 663551c5c4 tdf#146619 Run IWYU again on include/test
Change-Id: Ia2fe7435e0fbd6185c40655cd6c5ae93d39c7963
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193916
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2025-11-30 18:25:35 +01:00
Xisco Fauli 801dc48c6f UnoApiTest: Add enum for filter names
and use it in save/saveAndReload

Change-Id: I3d82ab54119ab6c35587ea706c82254a5c39dbd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194158
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-11-18 21:11:02 +01:00
Juraj Šarinay 9d1064fd50 Fix two crashes when verifying (incomplete) signatures using NSS.
Even though SignedData.digestAlgorithms is mandatory in CMS,
the set can be empty. One ends up with a valid list containing
a single nullptr. According to RFC 5652, one MAY reject signatures
without signedData.digestAlgorithms.

SignedData.certificates is OPTIONAL in CMS. If omitted, one gets
nullptr instead of a list of entries. Rejecting such signatures
is apparently OK for adbe.pkcs7.detached and required for
ETSI.CAdES.detached.

Change-Id: If0270bd3f2d4312947562ab68d2206ae47370b06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185540
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-05-20 08:35:17 +02:00
Juraj Šarinay 6d718cabcc Refine the handling of adbe.pkcs7.sha1 signatures when using NSS.
Reject signatures with empty encapsulated content.
Enforce SHA-1 in the first pass.

Change-Id: I42b5f90d02d2abc0c250497d6cc64df4fa798d5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185207
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-05-13 09:06:45 +02:00
Miklos Vajna 62dd6274c7 cool#10630 doc electronic sign: move signature line tracking to the view
No functional changes intended:

- Replace SfxObjectShell::GetSignPDFCertificate() and
  SfxObjectShell::ResetSignPDFCertificate() with
  SfxViewShell::SetSignPDFCertificate() and
  SfxViewShell::GetSignPDFCertificate(), because information about shape
  selection belongs to the view.

- Change svx::SignatureLineHelper::setShapeCertificate() to use
  SfxViewShell::SetSignPDFCertificate() to avoid duplication.

- Change GetSignatureLineShape() in xmlsecurity/ to use
  SfxViewShell::GetSignPDFCertificate(), again to avoid duplication.

With this, all setters/getters of the inserted signature line go via
SfxViewShell and the amount of getCurrentSelection() calls on the model
is reduced.

Change-Id: I021bc41262b2a16d1014fbf1431a0eb6e1e86c73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180355
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-01-16 22:37:23 +01:00
Miklos Vajna 7d4222d008 cool#10630 doc electronic sign: fix insertion of the signature line
Have electronic signing configured in the LOK client, try to insert a
signature line, you'll get a certificate picker, while we don't have a
cert during esign.

What's in fact needed for creating the signature line is just a name
(previously extracted from the certificate), we can survive the lack of
actual certificate.

Fix the problem by adding a new External parameter to
.uno:InsertSignatureLine to hint that the certificate chooser should not
be opened, instead the editor name (used for comments already) should be
used. Add a new CertificateOrName in svl/ and use that in all places
where previously we wanted a certificate but in fact it's enough to have
a certificate or a name to create the signature line.

The name on the signature line is just visual feedback, the actual name
on the crypto signature is still not based on untrusted used input.

Change-Id: Ib7008112a8e28a9e7d9649745e6021dd6b6b9c39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180193
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-13 17:53:43 +01:00
Michael Stahl f0efcb9170 xmlsecurity: fix CppunitTest_xmlsecurity_xmlsec with F41 system NSS
xmlsecurity/qa/xmlsec/xmlsec.cxx:102:(anonymous namespace)::testInsertPrivateKey::TestBody
    equality assertion failed
    - Expected: 1
    - Actual  : 0

Just copying the NSS setup code from the other tests lets the test pass.

Also sync all the copies of the setup code while at it.

Change-Id: Idcaebec4dff29f37e0ed0f05d6d7d62782947325
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179893
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2025-01-07 16:40:07 +01:00
Michael Stahl fae1eb775d xmlsecurity: fix tests to run with system NSS on Fedora 40
testDropMacroTemplateSignature fails printing this:

  warn:xmlsecurity.xmlsec:3511616:3511616:xmlsecurity/source/xmlsec/errorcallback.cxx:53: signatures.c:599: xmlSecNssSignatureSetKey() 'rsa-sha1' 'VFY_CreateContext' 4 'NSS error: -8011'

because policy sets NSS_RSA_MIN_KEY_SIZE to 2048.

testPDFGood fails printing this:

  warn:svl.crypto:3587940:3587940:svl/source/crypto/cryptosign.cxx:1941: ValidateSignature: message is not signed
  warn:xmlsecurity.helper:3587940:3587940:xmlsecurity/source/helper/pdfsignaturehelper.cxx:482: failed to determine digest match

because enabling SEC_OID_SHA1 for NSS_USE_ALG_IN_ANY_SIGNATURE doesn't
enable it for SMIME signatures, so smime_allowed_by_policy() fails -
obviously one has to use NSS_USE_ALG_IN_SIGNATURE to enable it in any
signature.

Change-Id: I59ffaf0994eee6b51362fd3296f61465d0fc7903
(cherry picked from commit a7b7b00b78426bff8607c77106ea62dd213f0821)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178663
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-12-17 14:59:13 +01:00
Miklos Vajna 0de900cec7 cool#9992 lok doc sign, hash extract: time for getCommandValues('Signature')
The final goal of this API is to give time & hash information about the
PDF signature, so once a 3rd-party produces the PKCS#7 signature, that
can be added to the document and the actual PDF sign can be re-run with
the same parameters.

This commit continues the replacement of XCertificate with
svl::crypto::SigningContext up to the point that the timestamp used in
svl/ can be exposed on the LOK API.

This is done by updating DocumentSignatureManager::add(),
PDFSignatureHelper::SetX509Certificate(),
vcl::filter::PDFDocument::Sign() and finally the svl::crypto::Signing
ctor to work with the signing context instead of an XCertificate
directly.

Time reporting works now, so add a test for that. The digest part still
needs doing.

Change-Id: I83f1274cd420b67194b7caf12b1027e623d4f7fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176404
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-11-11 21:54:23 +01:00
Miklos Vajna 12e5082537 cool#9992 lok doc sign, hash extract: initial getCommandValues('Signature')
The trouble with signing via ca/cert/key PEM files is that usually the
CA is not trusted by the received of the signature. 3rd-party services
are available to do generate trusted signatures, but then you need to
share your document with them, which can be also problematic.

A middle-ground here is to sign the hash of the document by a 3rd-party,
something that's supported by e.g.
<https://docs.eideasy.com/electronic-signatures/api-flow-with-file-hashes-pdf.html>
(which itself aggregates a number of providers).

As a first step, add LOK API to get what would be the signature time
during signing -- but instead of actually signing, just return this
information. Once the same is done with the doc hash, this is supposed
to provide the same info than what the reference
<https://github.com/eideasy/eideasy-external-pades-digital-signatures>
app does.

This is only a start: incrementally replace XCertificate with
SignatureContext, which allows aborting the signing right before calling
into NSS, and also later it'll allow injecting the PKCS#7 object we get
from the 3rd-party.

Change-Id: I108564f047fdb4fb796240c7d18a584cd9044313
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176279
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-11-08 21:40:22 +01:00
Noel Grandin 5de73f04f3 new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-04 08:51:00 +01:00
Chris Gill 594554e07a tdf#163738 use insert function instead of for loop
In the unit test CppunitTest_xmlsecurity_pdfsigning
use std::vector::insert() in place of a for loop.

Change-Id: Ib51f0ec6932210befe3c7aad9a6b5c8989bfe839
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175337
Tested-by: Jenkins
Tested-by: Hossein   <hossein@libreoffice.org>
Reviewed-by: Hossein   <hossein@libreoffice.org>
2024-11-02 22:32:34 +01:00
Xisco Fauli a38a22c7e5 UnoApiTest: rename load to loadFromURL and use it everywhere
Change-Id: Ie67eebec74f783fa0c29acfb23bb83bc582812b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175724
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-10-29 09:11:37 +01:00
Mike Kaganski a6a6921123 Use good old string literals in assertXPath and friends
These are only sent to an external API expecting char*-like strings,
or for comparison. Having every assertXPath having three of _[ou]str
is too much syntactic noise, making the unit tests almost unreadable.

Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-10-05 10:06:44 +02:00
Xisco Fauli 4dc04a1069 qa: use SetODFDefaultVersion everywhere
Change-Id: I4a08abea9a6c61a0365d238abf1021806ae6df29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174375
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-02 11:15:09 +02:00
Xisco Fauli c6f9d381d3 Add ODF 1.3 Extended / ODF 1.4 versions to configuration and UI
The new default is ODF 1.4 Extended

Change-Id: I50f60cccde81b5ea320478314482cc67a7bcc2e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174343
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-10-02 08:57:38 +02:00
Stephan Bergmann 1c4f7139e9 Let test operate on temp copy of source document
The CppunitTest_xmlsecurity_signing
CPPUNIT_TEST_NAME=testImplicitScriptSign::TestBody introduced in
e5a0209d4b "cool#9992 lok doc sign: allow sign of
macros & the document itself in one step" failed on a read-only source tree with

> An uncaught UNO exception
> - com.sun.star.ucb.InteractiveAugmentedIOException: {Message: "an error occurred during file opening (18/28) at /home/libo/src/core/ucbhelper/source/provider/cancelcommandexecution.cxx:83", Context: @0x7ff5cb43cf90, Classification: com.sun.star.task.InteractionClassification 0, Code: com.sun.star.ucb.IOErrorCode 1, Arguments: [com.sun.star.beans.PropertyValue: {Name: "Uri", Handle: -1, Value: string: "file:///home/libo/src/core//xmlsecurity/qa/unit/signing/data//macro.odt", State: com.sun.star.beans.PropertyState 0}, com.sun.star.beans.PropertyValue: {Name: "ResourceName", Handle: -1, Value: string: "/home/libo/src/core//xmlsecurity/qa/unit/signing/data//macro.odt", State: com.sun.star.beans.PropertyState 0}]}

Change-Id: I9198ca1eba03d55e745a0bbb344963139941496f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173852
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-09-24 15:38:30 +02:00
Michael Stahl 81e0b7e7c0 xmlsecurity: add unit test with docx that can only be opened with repair
Change-Id: I4f705dd2124383a90b69d04d8b2de0e37f83a495
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170053
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-09-18 15:03:40 +02:00
Miklos Vajna e5a0209d4b cool#9992 lok doc sign: allow sign of macros & the document itself in one step
Sign a document with macros (via file -> digital signatures -> digital
signatures), realize that you still get a warning on file open, sign the
macros in the document (via tools -> macros -> digital signature),
realize that you did this in the wrong order, so now you have to re-sign
the doc content.

The reason for this is that the macro signature only signs the macro
parts of the document (so you can still edit the document and the
signature is valid, as long as you don't touch macros), while the doc
content signature signs everything, including the macro signature, so
the order of the two matters.

Solve this trouble by adding a new setting that allows doing the two
signatures in one step. Do this by extending the doc content signing
code with an optional pre-step that first signs the document macros.
This is a bit tricky to do, since xmlsecurity/ gets an RW signature
stream and a RO document storage from sfx2/, but transferring one more
signature stream can solve this trouble.

Other tricky parts of the change:
1) The crypto signing is always done by libxmlsec, so
   DigitalSignaturesDialog::SetScriptingSignatureStream() has to update
   the storage of the sign manager's sign helper, otherwise, the hashes in
   the macro signature will be empty.
2) Signing reads the RO storage, so normally the macro signature
   would not be part of the doc signature when creating both signatures
   inside a single dialog. (The storage is only committed after the
   dialog ends.) Fix this problem by extending
   DocumentSignatureManager::add() and UriBindingHelper::OpenInputStream()
   to provide kind of an overlay when xmlsecurity/ gets a script signature
   stream: this way the macro signature will be part of the doc signature
   while the dialog is in progress. No overlay is needed later, once both
   streams are committed to the storage on dialog end.

Change-Id: Ic2728689997165595991d5ec59c7a2683286e22d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173263
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-12 16:53:06 +02:00
Mike Kaganski 2ca75d4133 Fix the test failing when invalid certificate is in cert store
testPDFAddVisibleSignature was failing for me locally because of
an expired certificate present in my store.

Change-Id: I03243f6707b1b5ca94ea87e9f8c809dd47b6a93a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171901
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-08-15 16:24:15 +02:00
Mike Kaganski 0e4266dd90 Use MacrosTest::IsValid to check certificates
Change-Id: I015fae42cf95ab7ff4f384b17f6ac4994d4c81ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171902
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-08-15 15:46:13 +02:00
Michael Stahl 8ed755cfb0 pyuno,unotest,xmlsecurity: copy GPG test files for UITtest
The problem was that running UITest_xmlsecurity_gpg changed the files in
test/signing-keys/ ... prevent that by copying the directory in that
test, which is more complicated than initially expected.

Change-Id: Ie3be922e0b2e9dae49f9a70e35ad5270c90b4fc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171322
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-08-01 11:18:30 +02:00
Xisco Fauli 532a8d7ac2 CppunitTest_xmlsecurity_signing: simplify a bit
Change-Id: I197e37f6520644c594baa6936d831ea456d60f69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171051
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-07-25 22:14:25 +02:00
Noel Grandin 3519027515 make date/time single-arg constructors explicit
Change-Id: I943f755d95b90ef8aeb7d5b339f617ff50db4e29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170673
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-18 10:27:41 +02:00
Xisco Fauli 83a8d5a275 BootstrapFixture: get rid of mxComponentContext
Change-Id: I0318485c3c0159277e47096e0c7e0df8ed109ea4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169865
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-07-02 15:35:00 +02:00
Caolán McNamara b4e42bce55 WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I710ff75d387b2d452cb80911c9f0092948453ef8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167751
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-05-16 20:31:57 +02:00
Noel Grandin 6e26799069 loplugin:ostr in xmlsecurity
Change-Id: Ifb936c230f68447b3bb5993705adb5e5b790371f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167668
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-15 18:03:51 +02:00
Rafał Dobrakowski 03b00e03c2 tdf#146619 Remove unused #includes from C/C++ files
'xmlsecurity' module was cleaned.

Add some headers from xmlsec-wrapper.h in preparation
for its removal

Change-Id: Id66e6d40d4d5d980626832c0e2f6255fc31b4bcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164639
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-28 12:50:41 +01:00
Michael Stahl 2048db4dc8 tdf#105844 unotest,xmlsecurity: fix tests on MacOSX
The new tests fail with:

> core/xmlsecurity/qa/unit/signing/signing2.cxx:
> 252: Assertion
> Test name: testPasswordPreserveMacroSignatureODFWholesomeLO242::TestBody
> equality assertion failed
> - Expected: 1
> - Actual  : 4

This is because only the first test that runs sees the testing CA
certificates that are copied in MacrosTest::setUpNssGpg(); when the
second test runs, they have somehow vanished.

This is because apparently SQLite on MacOSX, unlike on Linux, monitors
the file descriptors of its database files, and then invalidates itself
when setUpNssGpg() via osl::File::copy() renames and unlinks the
existing database files:

> cppunittester[29873:5483181] [logging] BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode renamed while in use: core/workdir/CppunitTest/xmlsecurity_signing2.test.user/cert9.db.osl-tmp
> cppunittester[29873:5483181] [logging] invalidated open fd: 5 (0x20)
> cppunittester[29873:5483181] [logging] BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: core/workdir/CppunitTest/xmlsecurity_signing2.test.user/cert9.db.osl-tmp
> cppunittester[29873:5483181] [logging] invalidated open fd: 5 (0x11)
> cppunittester[29873:5483181] [logging] BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode renamed while in use: core/workdir/CppunitTest/xmlsecurity_signing2.test.user/key4.db.osl-tmp
> cppunittester[29873:5483181] [logging] invalidated open fd: 6 (0x20)
> cppunittester[29873:5483181] [logging] BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: core/workdir/CppunitTest/xmlsecurity_signing2.test.user/key4.db.osl-tmp
> cppunittester[29873:5483181] [logging] invalidated open fd: 6 (0x11)

Split MacrosTest::setUpNssGpg()/tearDownNssGpg() into functions
setUpX509() which only does something on the 1st invocation, and
setUpGpg()/tearDownGpg() which may be invoked per-test (they could also
be run once for the whole test suite, but not obvious how to do that);
PDF related tests don't need GPG.

Presumably this is (along with the WNT-specific problem fixed in commit
3e9a700091) the reason why most of the
tests not only accept the expected result of SignatureState::OK but also
SignatureState::NOTVALIDATED.

Change-Id: I59b85ca651cecaccfdea729ed1e645c53079c8bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162693
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-01-30 10:23:32 +01:00
Thorsten Behrens d0dcd87788 Make wholesome ODF package encryption the default
Change-Id: I825ae7a5e4b80d390804a7bb2cfdfc3b1843bd07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162066
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-01-23 21:41:03 +01:00
Andrea Gelmini 728be4c831 Fix typo
Change-Id: Ia63ef69c17c99de0c7bc3f33e7fc41dc042c2751
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161925
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2024-01-11 21:18:49 +01:00
Michael Stahl 4d6e9d5e15 tdf#105844 add test for ODF wholesome encryption with macro signature
... plus manifest schema extension.

Change-Id: I73721db8620e97bd58556f9a71afcb0a33f6c7e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161898
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-01-11 10:50:51 +01:00
Mike Kaganski a01a642ebb UnoApiTest::loadFromURL -> UnoApiTest::loadFromFile
The old name was misleading (it doesn't take an URL, but a filename);
also, now it's easier to grep for it - doesn't get mixed with
vcl::graphic::loadFromURL.

Change-Id: Ib88d2194200a6a54d2326971e0306ba39f0c7025
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161578
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-03 07:51:28 +01:00
Stephan Bergmann 0962258708 Extended loplugin:ostr: xmlsecurity
Change-Id: I639bf4af888e5af615379515d92ad70025d8ac15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159660
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-19 20:38:12 +01:00
Stephan Bergmann 0c07a65377 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: xmlsecurity
Change-Id: I6cdabef12d60f9fa554b95c99e702e8c700329e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158296
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20 22:48:04 +02:00
Stephan Bergmann b4844c310b Repurpose loplugin:stringstatic for O[U]String vars that can be constexpr
...now that warning about O[U]String vars that could be O[U]StringLiteral is no
longer useful

Change-Id: I389e72038171f28482049b41f6224257dd11f452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15 21:15:49 +02:00
Michael Stahl aca32a5545 tdf#146547 sfx2: allow read-only documents to be modified
This is particularly useful for a Writer document that contains a
section that is set to be editable in a read-only document, so that the
user is warned when closing such a document without saving it.

Originally this check was added in commit
27db57efc5 "CWS fwkbugfix05"
"#i39869#: readonly docs should never become modified"
but the actual problem there was that the read-only document was
displayed in a wizard dialog, not in a document view, so let's instead
check that the document is some kind of "internal" document.

Also the dialog's Save button should do something, and since the
document is read-only, a Save As dialog appears appropriate.

Change-Id: I339cbe92a2c9eb74a1f5061246f921037a47f79c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153180
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-06-16 16:52:43 +02:00
Xisco Fauli a3fa0f1e53 xmlsecurity: do not run the test with HAVE_FEATURE_PDFIMPORT
The test is meant to test PDFiumLibrary

Change-Id: Ib99d1aef4857df09fa3e73a9cfdf130c7660619d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151761
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-05-16 14:18:16 +02:00
Miklos Vajna 3a759a0b0c Remove some unused includes
Mostly com/sun/star/frame/Desktop.hpp is unused after inheriting from
UnoApiTest.

Change-Id: I71b75fa5c880337ff294583b96af09c90b5059c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150514
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2023-04-17 19:01:11 +02:00
Stephan Bergmann 19691c3b68 Revert all the recent loplugin:unocast changes
...as obsoleted by ef53355355 "Rudimentary support
for dynamic_cast on UNO proxy objects".

This reverts all of:
4cfcc9ac37 "loplugin:unocast (framework::Desktop)"
03efbf72f4 "loplugin:unocast
 (vclcanvas::TextLayout)"
80099fdd51 "loplugin:unocast (SalGtkXWindow)"
cc147f576d "loplugin:unocast
 (sdext::presenter::CachablePresenterView)"
40db42be1d "loplugin:unocast
 (vclcanvas::CanvasFont)"
2d1e7995ea "loplugin:unocast (CairoColorSpace)"
4c0bbe4bd9 "loplugin:unocast
 (canvas::ParametricPolyPolygon)"
8980366662 "loplugin:unocast
 (vclcanas::CanvasBitmap)"
d5e0c2c8db "loplugin:unocast
 (sfx2::DigitalSignatures)"
c0c4519e0d "loplugin:unocast
 (VCLXAccessibleComponent)"
feb8b833a6 "loplugin:unocast (VCLXDialog)"
1fa58cc6cc "loplugin:unocast (VCLXMultiPage)"
f481f036de "loplugin:unocast
 (DocumentSettingsSerializer)"
73df933f5f "loplugin:unocast
 (css::embed::EmbeddedUpdate)"
420165ab0e "loplugin:unocast
 (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)"
9abe8ee067 "loplugin:unocast (MutableTreeNode)"
9f3022ceb0 "loplugin:unocast (VCLXTabPage)"
1be70dda02 "loplugin:unocast
 (vcl::unotools::VclCanvasBitmap)"
d6a70bb641 "loplugin:unocast
 (basegfx::unotools::UnoPolyPolygon)"
5a14f009e6 "loplugin:unocast
 (xmlsecurity::Certificate)"
99009c9535 "loplugin:unocast (sd::Annotation)"
0c7585c5fa "loplugin:unocast (sd::TextApiObject)"
24e14afd1b "loplugin:unocast
 (SignatureVerifierImpl)"
1a7ad0c10d "loplugin:unocast
 (pcr::PropertyEventTranslation)"
a97e2d2702 "loplugin:unocast (RangePageBreaks)"
19dfdf86ad "iloplugin:unocast
 (pcr::OFormattedNumericControl)"
f9785ea595 "loplugin:unocast
 (frm::OInterfaceContainer)"
5e5f40a4a9 "loplugin:unocast (ScVbaShapes)"
27b35b2c21 "loplugin:unocast (ScVbaShapeRange)"
cb3108f860 "cid#1517812 Dereference null return
 value"
feba0ddb15 "loplugin:unocast
 (weld::TransportAsXWindow)"
4d6c232165 "loplugin:unocast
 (oox::ForumlaImExportBase)"
4844c096a8 "loplugin:unocast
 (cairocanvas::SurfaceProvider)"
9a0b523e0a "loplugin:unocast
 (cairocanvas::CanvasBitmap)"
8a5648d8e5 "loplugin:unocast
 (cairocanvas::TextLayout)"
28c27a0623 "loplugin:unocast
 (cairocanvas::CanvasFont)"
53bc223cb3 "loplugin:unocast
 (cairocanvas::RepaintTarget)"
5f70b0b9f6 "loplugin:unocast (SvXMLImport)"
068187a898 "loplugin:unocast (VCLXWindow)"
88b4f96620 "loplugin:unocast
 (sfx2::sidebar::SidebarController)"
f1b7a69b28 "loplugin:unocast
 (SvxLineStyleToolBoxControl)"
ba76f0ba7e "loplugin:unocast
 (i18npool::Calendar_gregorian)"
840154daf9 "loplugin:unocast
 (framework::AddonsToolBarWrapper)"
b0e9c4c5f0 "loplugin:unocast
 (GrammarCheckingIterator)"
8ee6cfc965 "loplugin:unocast
 (ucb::ucp::ext::Content)"
5b8cd77c11 "loplugin:unocast
 (basic::SfxScriptLibraryContainer)"
9e73ff9fce "loplugin:unocast
 (sdext::presenter::PresenterNotesView)"
a98acca8fb "loplugin:unocast
 (SelectionChangeHandler)"
c0b59ad6e3 "Consistently use
 comphelper::getSomethingImpl<I>(aIdentifier, this)"
276e3ccbdd "loplugin:unocast
 (vclcanvas::RepaintTarget)"

Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-05 11:45:51 +00:00