Commit Graph
2206 Commits
Author SHA1 Message Date
Mike Kaganski 7e5f69aa33 Make tools::Time ctor taking sal_Int64 private
This ctor is meant to set the value of nTime directly; and that value
is not nanoseconds, but an encoded value, using SEC_/MIN_/HOUR_MASK.
But in some places, this ctor was misused for setting of nanoseconds,
which would only accidentally work for values less than one second.
All places that initialized tools::Time with 0, now use EMPTY.

This makes the ctor private; and for the very few cases where really
the encoded value of nTime is stored / restored, fromEncodedTime is
introduced.

Change-Id: I1f1994bd9aab1b51a41b1de637619049fe820da4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175283
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-21 10:30:58 +02:00
Xisco Fauli b237267685 tdf#163486: PVS: identical sub-expressions
Since
commit ad6f23d2a3
Author: TokieSan <eltokhy@aucegypt.edu>
Date:   Tue Jul 18 21:54:31 2023 +0300

    Added searching and filtering features to certificate chooser dialog

V501 	There are identical sub-expressions 'rCharClass.uppercase(sIssuer).indexOf(aSearchStr) < 0' to the left and to the right of the '&&' operator.

Change-Id: Ifdc4b371e6d8f79ad43236e10b86e8e5b03204a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175284
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-20 21:59:37 +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
Miklos Vajna ced420ca70 cool#9992 lok doc sign: convert the certificate chooser dialog to async
1) Move the try-catch around assing a signature inside the block that
   already got the response from the certificate chooser, it's unlikely
   that choosing the certificate (and not yet signing) would fail.

2) Convert the dialog to async and allow it to be a jsdialog.

3) Hide not relevant widgets for LOK: we have a single signing
   certificate, so the search entry is not useful.

   The refresh button has an unclear purpose, as it was initially added
   in commit fb9874231f (Caching
   Certificates in the CertificateChooser dialog session-wise, 2023-08-26),
   but later commit efe414c4a8 (Don't reuse
   CertificateChooser instances, 2024-02-07) disabled this chaching. In any
   case, the certificate won't change during the lifetime of a single LOK
   view, so hide that as well.

4) Invoke the inner certificate viewer in an async way, too.

Change-Id: Ibf618ea7632cf801d1d9180b9aa7dd193c45ffda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174215
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-30 14:55:40 +02:00
Miklos Vajna a581dbf982 cool#9992 lok doc sign: only take sign cert from the view in the cert chooser
Have two views, in case both of them haver sign certs configured in the
NSS database, then the cert chooser would present both, which is not
wanted.

The problem is that the NSS database contains sign certs from all views,
so working from the database is not what we want for the LOK case.

Fix the problem by passing the SfxViewShell from the sign dialog to the
certificate chooser dialog, and then the chooser can work from the view
in LOK mode.

Searching for other uses of getPersonalCertificates(), the comphelper/
one is not relevant for the LOK case (gpg is disabled there); the PDF
case is only for the UNO API, so those don't necessarily need adjusting.

Change-Id: Ic7027b8d218b2bde3c8bf134a4b11c14fd9c3570
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174002
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-27 10:01:30 +02:00
Miklos Vajna c57434559c cool#9992 lok doc sign: conditionally show the add button in the sign dialog
Open the sign dialog, the Add button is hidden, even if the LOK clients
initializes the view with a working signing certificate.

SfxMedium::SignContents_Impl() knows the correct view, but by the time
the execution arrives to the DigitalSignaturesDialog ctor, this info is
lost, so we don't know what is the current view.

Fix the problem by looking up the view of the object shell at UNO
command dispatch time, and passing that around, so the signature dialog
can also access it. If the view has a signing certificate configured,
then allow signing.

The certificate chooser triggered by this button still needs fixing.

Change-Id: I1fae63cea27ea1e68e938879f4507f53ade484f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173964
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-26 11:06:06 +02:00
Miklos Vajna d95ab8d3a3 cool#9992 lok doc sign: fix import of the private key
Once the signing key is taken from the matching SfxViewShell (not yet
done), signing with a certificate specified via initializeForRendering()
failed with:

warn:xmlsecurity.xmlsec:13020:13005:xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx:330: X509Certificate_NssImpl::getPrivateKey() cannot find private key
warn:xmlsecurity.xmlsec:13020:13005:xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx:812: Can't get the private key from the certificate.
warn:xmlsecurity.xmlsec:13020:13005:xmlsecurity/source/xmlsec/errorcallback.cxx:53: keys.c:1347: xmlSecKeysMngrGetKey() '' '' 45 'details=NULL'
warn:xmlsecurity.xmlsec:13020:13005:xmlsecurity/source/xmlsec/errorcallback.cxx:53: xmldsig.c:822: xmlSecDSigCtxProcessKeyInfoNode() '' '' 45 'details=NULL'
warn:xmlsecurity.xmlsec:13020:13005:xmlsecurity/source/xmlsec/errorcallback.cxx:53: xmldsig.c:537: xmlSecDSigCtxProcessSignatureNode() '' 'xmlSecDSigCtxProcessKeyInfoNode' 1 ' '
warn:xmlsecurity.xmlsec:13020:13005:xmlsecurity/source/xmlsec/errorcallback.cxx:53: xmldsig.c:301: xmlSecDSigCtxSign() '' 'xmlSecDSigCtxProcessSignatureNode' 1 ' '

The trouble was that we wanted to keep the private key in-memory,
presumably because initially the whole NSS database was in-memory for
the LOK case. This was changed in commit
87eec1b90b (NSS: create a temporary
database instead of in-memory, 2018-12-31), so there is no problem with
a not-in-memory private key anymore.

Note that the problematic codepath was only triggered when first the
certificate chooser was ran and only then we signed. So the testcase
also gets the cert flags before signing, otherwise the test would
succeed even without the fix.

Change-Id: I5086b205c91b630ddd343c0eb91bd9e63b3ea238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173892
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-25 13:14:42 +02:00
Miklos Vajna 40ba7a5c25 cool#9992 lok doc sign: implement signature removal
Open an already signed document, click on the sign icon on the status
bar, notice how the button to remove a signature is hidden.

This was added in commit 71a8bad4b9
(jsdialog: enable Digital Signatures dialog, 2022-01-24), which exposed
the signatures dialog as a read-only jsdialog. The dialog was improved
recently to be a read-write jsdialog, so this is no longer needed.

But then DigitalSignaturesDialog::canRemove() had an inner non-async
message dialog. Fix that by converting canRemove() to async.

An additional problem could be that the document is not marked as
modified, so the LOK client code doesn't notice the document is updated
(to not have a signature), but we do update the last mod timestamp of
the file, which is meant to be enough.

Change-Id: I8e7ee22e4b1b8ce59dee3617bb2f22f8d734f31d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173428
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-16 16:26:18 +02:00
Miklos Vajna 81d3aefd85 [API CHANGE] XDocumentDigitalSignatures: remove deprecated / unused functions
Some functions were already a stub and only aborted on calling them.
The *Package* functions were added in commit
c9ed2f359a (INTEGRATION: CWS xmlsec08
(1.4.24); FILE MERGED 2005/02/22 13:07:19 mt 1.4.24.1: #i36682# Accept
separate Stream for signatures..., 2005-03-10), but it seems nobody
called them.

This also means that DocumentSignatureMode is now never set to
DocumentSignatureMode::Package, so remove that as well.

It seems to be unlikely that this non-published service was used by
3rd-party code, since it was specific to the needs of sfx2/ code, not
generic functionality that could be useful in other contexts.

Change-Id: Icfed9a0e6568f6eb21f9236901af01f1915bf2f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173313
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-13 10:27:14 +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
Miklos Vajna 482c7c5851 cool#9992 lok doc sign: async read-write DigitalSignaturesDialog
This finally allows removing the hack for the LOK case in
SfxObjectShell::CheckIsReadonly() to show the signatures dialog
read-only.

Also fix a case while signing PDFs where the file stream was on the
stack, but now that we finish signing in an async callback, signing
crashed due to a use-after-free.

Fix that by giving the std::unique_ptr to the utl::OStreamWrapper ctor,
which knows to take over ownership in this case, and that wrapper is
reference-counted.

Next problem is that the add/remove buttons in the dialog are still
hidden in the LOK case, that's not yet fixed here.

Change-Id: I71ee50ae55d4e62f5d265a35e3810e3b2b63a9b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173155
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-11 12:34:13 +02:00
Miklos Vajna 07df95e75a cool#9992 lok doc sign: async DocumentDigitalSignatures::ImplViewSignatures()
Currently SfxObjectShell::CheckIsReadonly() has a hack for the LOK case
to show the signatures dialog read-only, as only that is async.

The next step is to make DocumentDigitalSignatures::ImplViewSignatures()
async, though that requires all callers of the function to be async, so
make DocumentDigitalSignatures::signScriptingContent() async as well.
There is also DocumentDigitalSignatures::signPackage(), but turns out
that's dead code, so just remove it.

Once this is in place, we had a problem that the callbacks tried to
interact with libxmlsec, but the dialog was still alive in
DocumentDigitalSignatures::ImplViewSignatures() by the time the callback
was running, so there were two DocumentSignatureManager instances at the
same time, and both assumes it should call the global libxmlsec
init/uninit, which resulted in failing to verify the just created
signature.

Fix this similar to how Tomaz fixed the same problem around pdfium in
commit 067a8a954c (pdfium: only init
pdfium library one and destroy on LO exit, 2020-06-03).

Change-Id: I3fb63c06195564732e1576dbd755157e676fb762
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173117
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-10 11:27:46 +02:00
Miklos Vajna caff013bee cool#9992 lok doc sign: async DocumentDigitalSignatures::signDocumentContent()
Currently SfxObjectShell::CheckIsReadonly() has a hack for the LOK case
to show the signatures dialog read-only, as only that is async.

The next step is to make
DocumentDigitalSignatures::signDocumentContent() async, but passing an
std::function via the UNO API is tricky.

Notice how DocumentDigitalSignatures in xmlsecurity/ also implements
sfx2::DigitalSignatures, add a new SignDocumentContentAsync() there and
adapt all uses of signDocumentContent() to go with that instead.

This requires introducing some lambdas for code after
signDocumentContent() in general and for ODF/OOXML specific code in
particular, to avoid code duplication.

Change-Id: If771ced711041364988af45ad9dd0dd1a2a8660d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173060
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-09 17:30:28 +02:00
Caolán McNamara beb7dc01eb cid#1607713 silence Overflowed constant
Change-Id: I0b3b924689685cfb7ae5cd64db5e3ef371541769
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172700
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-31 22:55:04 +02:00
Moritz Duge 6c640ee266 tdf#161909: show where the certs in the CertificateChooser are from
The NSS password dialog naming the Mozilla profile only shows up for
X.509 certs outside Windows. And the user may wrongly assume GPG keys
are from Thunderbird.

Change-Id: I23706309d57fe30cddcbcac16d7f3e20ee397f16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171645
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-08-13 01:09:51 +02:00
Moritz Duge 684b7b5a8b tdf#161909: show NSS cert DB path (MOZ profile) in password dialog
When selecting a X.509 cert on Unix/Linux/macOS. (ODF+PDF signing)

Helps the user to know which password is requested.
Previously only asked for the "NSS Certificate DB" password.

Change-Id: Ic44d3c4b2f98185c07b11f9880d64016aa0b60ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171641
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-08-13 01:09:28 +02:00
Moritz Duge 8f9f042976 tdf#161909: make showing GPG keys only an explicit functionality
Before this change, selecting only GPG keys for ODF encrpytion relied on
the fact, that all X.509 implementations (nss+mscrypt) implement listing
public keys (getAllCertificates) as a stub.
See previous change Ia6b8ecb9

Change-Id: Icb36a4cefd60b94407129ff73fe62f9250bfbee5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171639
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-08-13 01:09:01 +02:00
Moritz Duge 9383f83b05 tdf#161909: request GPG keys exclusively for chooseCertificatesImpl
For ODF encryption, only GPG keys are allowed. And key selection for this currently only works correctly, because all X.509 implementations (nss and mscrypt) yield empty results when asked for public keys (encryption).

This commit is a first step to make the selection for GPG keys explicit.
Other code still needs to be changed to make use of this new function
argument.

Change-Id: Ia6b8ecb901c0f54a9a58b1bd0efaa7154ffbd285
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171638
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-08-13 01:07:28 +02:00
Moritz Duge 156c3c1e5a tdf#161909: Show key type in CertificateViewer.
Change-Id: I4277e342c573525dd668d0365b1d686fe33fd914
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171500
Reviewed-by: Moritz Duge <moritz.duge@allotropia.de>
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
Tested-by: Jenkins
2024-08-08 10:34:29 +02:00
Sarper Akdemir 9786f8ea59 tdf#159040 tdf#162206: better the user key selection and test sign with default
fix GPG CertificateImpl::getSHA1Thumbprint not returning a
sequence of bytes as the thumbprint. (that is what the
documented API states, and what all of the code assumed.)

now /org.openoffice.UserProfile/Data/signingkey and
encryptionkey stores the key's SHA1Thumbprint for better
identification of keys. Previously on the key name was being
used.

fix annoying NSS Certificate Database password prompt
appearing on Tools->Options if the certificate database is
password protected.

improve Tools->Options->UserData user key selection and
display of information.

add a ui test for "Sign with default certificate"
interaction in the save dialog.

Change-Id: I1036856003f58f494838e0f81ca0fe18e821f528
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171395
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
2024-08-05 13:15:31 +02:00
Caolán McNamara 1b61a652c1 cid#1556583 COPY_INSTEAD_OF_MOVE
and

cid#1556585 COPY_INSTEAD_OF_MOVE
cid#1556588 COPY_INSTEAD_OF_MOVE
cid#1556593 COPY_INSTEAD_OF_MOVE
cid#1556597 COPY_INSTEAD_OF_MOVE
cid#1556605 COPY_INSTEAD_OF_MOVE
cid#1556617 COPY_INSTEAD_OF_MOVE
cid#1556635 COPY_INSTEAD_OF_MOVE
cid#1556790 COPY_INSTEAD_OF_MOVE
cid#1556792 COPY_INSTEAD_OF_MOVE
cid#1556796 COPY_INSTEAD_OF_MOVE
cid#1556799 COPY_INSTEAD_OF_MOVE
cid#1556815 COPY_INSTEAD_OF_MOVE
cid#1556836 COPY_INSTEAD_OF_MOVE
cid#1556840 COPY_INSTEAD_OF_MOVE
cid#1556842 COPY_INSTEAD_OF_MOVE
cid#1556859 COPY_INSTEAD_OF_MOVE
cid#1556860 COPY_INSTEAD_OF_MOVE
cid#1556866 COPY_INSTEAD_OF_MOVE
cid#1556869 COPY_INSTEAD_OF_MOVE
cid#1556870 COPY_INSTEAD_OF_MOVE

Change-Id: I3df8698a4aecbb03999c084517e37e12ff46ee97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171435
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-04 15:38:31 +02:00
Moritz Duge 36a5899896 tdf#161909: Fix resizing and behavior for "View Certificate" dialog.
- Set appropriate larger default size.
- Disable editing of details area.
- Add comments to distinguish GPG and X.509 code.

Change-Id: Idcca012c1eef96c6daa78498e85da6f70c97a90f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170004
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-07-25 10:21:39 +02:00
Samuel Mehrbrodt a19aa47546 tdf#161871 Revert "Removed Type and Usage Columns from Certificate Chooser"
The commit broke the display of all columns except the first one in all
backends except gtk3.

Also it's not clear why those columns are deemed superfluous;
see discussion in tdf#161871

This reverts commit 9f327102c4.

Change-Id: Idc3496122137f98c23bb7df8e36b17281fc948d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170491
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-07-15 13:00:41 +02:00
Samuel Mehrbrodt 0e1592094e tdf#108828 Prevent leaking keys from previous signing sessions
Usuccessful signing sessions (e.g. abort when password is requested)
left their key in the context.
On the next try, the former key would also be used to sign.

Change-Id: I55b9201df229cae40863a0a19b238029607d1848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170388
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Tested-by: Jenkins
2024-07-15 06:26:06 +02:00
Caolán McNamara 069fd3f54e cid#1608236 COPY_INSTEAD_OF_MOVE
Change-Id: I3f46c1d7e68dbf79ddbc9dc50d2735ebe1727b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170445
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-14 15:15:58 +02:00
Samuel Mehrbrodt b7a6d5752a tdf#108828 Show certificate selector again after cancelling password dialog
Change-Id: I0a57204c1885ca300d22832e5469d8918aec9ba6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170384
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-07-11 20:57:40 +02:00
U-AMANDAQUARESMA\quare fc3e2c8bba tdf#145538 Use range based for loops
Change-Id: Ib672cd1968de7bb99cd5f8737a09ce02b0490bf8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167995
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-05-23 19:25:13 +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
Caolán McNamara 970ee1d96c WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I19824cd8fdc3ac5b5afb4e769527bf71513212fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167553
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-12 19:39:01 +02:00
Caolán McNamara 880e093555 WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I6ef2f39cca9e657a05b9b55d8ff87607261dd1ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167369
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-05-09 09:30:32 +02:00
Caolán McNamara e5aa87aeeb drop requirement for rtl_random_getBytes to have "Pool" arg
Seeing as since:

commit e9531b792d
Date:   Tue Feb 6 14:39:47 2024 +0100

    sal: rtlRandomPool: require OS random device, abort if not present

    Both rtl_random_createPool() and rtl_random_getBytes() first try to get
    random data from the OS, via /dev/urandom or rand_s() (documented to
    call RtlGenRandom(), see [1]).

we don't use the initial arg to rtl_random_getBytes anymore, drop the
requirement to have one. Then simplify our usages of that, and
addtionally deprecate rtl_random_createPool and rtl_random_destroyPool.

Change-Id: I13dcc067714a8a741a4e8f2bfcf2006373f832c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167067
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-08 11:29:54 +02:00
Caolán McNamara 3752d82833 WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I68acd56b28b0f989a4010cd939f2452970d158ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167103
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-04 14:19:55 +02:00
Moritz Duge 3bb9b0565a fix crash in CertificateChooser for GPG
mvUserData is still needed to keep it's content from being deleted.

Revert "Drop unused instance variable."

This reverts commit 687ae6ca01.

Change-Id: I689cfdaf8d4d62a3b53ff7fb318dc8c70b9e1c2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167020
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Tested-by: Jenkins
2024-05-03 15:39:52 +02:00
Caolán McNamara 50419ba811 cid#1596704 COPY_INSTEAD_OF_MOVE
Change-Id: I52867ef0a094e546a307b98089c259f9e8bbdabf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166984
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-02 09:23:52 +02:00
Moritz Duge 687ae6ca01 Drop unused instance variable.
Change-Id: Iee32e4348526e54e0cc45a54e55eddb6479248e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166968
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-05-02 08:41:17 +02:00
Moritz Duge 906e5d44f2 Lazy load additional GPG key data.
Change-Id: I7f52b318b083535422202dacbee928333cb3ac78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166639
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-04-27 08:29:15 +02:00
Moritz Duge 7c0a776f3a Locally simplify getCertificatesImpl.
Change-Id: I13117b36bb063b0afc498ef237b9255c0a900131
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166638
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Tested-by: Jenkins
2024-04-27 08:26:52 +02:00
Gabor Kelemen 4aa43e62e4 tdf#146619 Drop unused 'using namespace' in: xmlsecurity/
Change-Id: I95b84eff5d8bb288aa704620db328d89062efdf4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165689
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-04-09 10:43:32 +02:00
Stephan Bergmann 64909a84a3 Missing include, again
At least the Emscripten build was hit again by what had been fixed with
bddb0d87e8 "Missing include", after
a0c53ab438 "tdf#146619 Remove unused #includes
from C/C++ files".

Change-Id: I632ab297bc51aa07019e4bb0cb4ef8f6372a1374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165795
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-04-04 18:19:45 +02:00
Rafał Dobrakowski a0c53ab438 tdf#146619 Remove unused #includes from C/C++ files
the 'xmlsecurity' module was cleaned

Change-Id: If8fae797ed5586888022ecb09bab690d68ae7bd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165593
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-04-02 17:30:55 +02:00
Andrea Gelmini 12e2826788 Fix typo
Change-Id: I3e20fda4b841458e979258dd5dc83c7f89f48083
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165497
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-28 22:01:16 +01:00
Stephan Bergmann bddb0d87e8 Missing include
...presumably since 50897e3fe0 "Drop transitional
header xmlsecurity/xmlsec-wrapper.h",

> xmlsecurity/source/xmlsec/xmlsec_init.cxx:29:9: error: use of undeclared identifier 'xmlSecInit'
>    29 |     if( xmlSecInit() < 0 ) {
>       |         ^
> xmlsecurity/source/xmlsec/xmlsec_init.cxx:55:9: error: use of undeclared identifier 'xmlSecShutdown'
>    55 |         xmlSecShutdown() ;
>       |         ^

etc.

Change-Id: I1aab4bb3601102c4ac0025833b03fa35adc9434e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165465
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-28 20:46:43 +01:00
Gabor Kelemen 50897e3fe0 Drop transitional header xmlsecurity/xmlsec-wrapper.h
It was introduced with
commit ec52e5e5a2
and the reason of that was the XMLSEC_NO_SIZE_T behavior consolidation.

But this was removed later with
commit bfd479abf0

Change-Id: Ib5350d9ab5554d1412821b762cd3ee7906b65b64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165440
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-28 12:51:00 +01: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
Patrick Luby 6a049e417b tdf#160184 ask user if they want to trust an untrusted certificate
gpgme contexts uses the "auto" trust model by default which only
allows encrypting with keys that have their trust level set to
"Ultimate". The gpg command, however, gives the user the option
to encrypt with a certificate that has a lower trust level so
emulate that bahavior by asking the user if they want to trust
the certificate for just this operation only.

Also, abort saving if no certificates are selected which is an
indication that the user cancelled the Select Certificate dialog.

Change-Id: I20951b1e31b2dcf8adb82243742f8c00fbaca8c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165260
Tested-by: Jenkins
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-26 10:01:31 +01:00
Rafael Lima 6178387f7b tdf#159985 Warn about the need to reload file after changing macro security level
Change-Id: I191fd5d676d6d54fb0ef15652420afdceab2fc78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164810
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2024-03-19 14:48:34 +01:00
Gabor Kelemen f35ff76607 Remove SaveODFItem class
This is effectively unused since:
commit d22ab7b444

Change-Id: I6f646b7daf845035196fc9dde4ff270b8143d37a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164645
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-12 18:49:26 +01:00
Patrick Luby ce8d6b6836 Related: tdf#152524 eliminate UserData struct name collision
The cui module has its own UserData struct and when building with
--enable-mergelibs=more, this data collision will cause a crash
when deleting a UserData instance in the xmlsecurity module because
the cui module already has its own, unrelated UserData struct.

Change-Id: I6418b049c72a2e902c9b5076b72fd240f65a593d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164404
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-05 18:35:14 +01:00
Mike Kaganski 3502484d53 Use SAL_WNODEPRECATED_DECLARATIONS_(PUSH|POP)
Change-Id: I2810d22e8f5e1c81647b9e9b15519de65939630a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163895
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-25 05:20:41 +01:00
seturaj b508e4f081 tdf#42982: Improve UNO error reporting. Make exceptions more descriptive
Change-Id: Idb292c508029efeb23ed969c9fad566154cb424c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162354
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-02-16 10:52:16 +01:00