summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-12-11 15:06:54 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2023-12-14 16:11:42 +0100
commita75a17219d95b6180a03d02a526234ef461c9172 (patch)
tree97c5be4c8164a6bef09603d265ec3979d4b15f6f /uui
parent9b56334615d9cdb42542aba746caaa8985566001 (diff)
tdf#158576 Allow trusting certificates only once
Macro mode "high" says that only signed macros from trusted sources can be run. When opening a document with a signed macro from an untrusted certificate, the user can either disable macros, or add the certificate to the list of trusted sources permanently and enable macros. This adds the possibility to trust the certificate only for the current document in the given scenario. Change-Id: Idf272498d930afc8a3f8be7f30889b77bf402d52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160598 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> (cherry picked from commit 37b381e2877c60c84547b22117663a72ab02fadc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160752 Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'uui')
-rw-r--r--uui/source/secmacrowarnings.cxx29
1 files changed, 14 insertions, 15 deletions
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 7e62c8556a66..d7a5b257b341 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -103,20 +103,19 @@ IMPL_LINK_NOARG(MacroWarning, ViewSignsBtnHdl, weld::Button&, void)
uno::Reference< security::XDocumentDigitalSignatures > xD(
security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), maODFVersion));
- if( xD.is() )
- {
- xD->setParentWindow(m_xDialog->GetXWindow());
- if( mxCert.is() )
- {
- xD->showCertificate( mxCert );
- mxAlwaysTrustCB->set_sensitive(true);
- }
- else if( mxStore.is() )
- {
- xD->showScriptingContentSignatures( mxStore, uno::Reference< io::XInputStream >() );
- mxAlwaysTrustCB->set_sensitive(true);
- }
- }
+ if( !xD.is() )
+ return;
+
+ xD->setParentWindow(m_xDialog->GetXWindow());
+ if( mxCert.is() )
+ xD->showCertificate( mxCert );
+ else if( mxStore.is() )
+ xD->showScriptingContentSignatures( mxStore, uno::Reference< io::XInputStream >() );
+ else
+ return;
+
+ mxAlwaysTrustCB->set_sensitive(true);
+ mxEnableBtn->set_sensitive(true);
}
IMPL_LINK_NOARG(MacroWarning, EnableBtnHdl, weld::Button&, void)
@@ -147,7 +146,7 @@ IMPL_LINK_NOARG(MacroWarning, DisableBtnHdl, weld::Button&, void)
IMPL_LINK_NOARG(MacroWarning, AlwaysTrustCheckHdl, weld::Toggleable&, void)
{
- const bool bEnable = (mnActSecLevel < 2 || mxAlwaysTrustCB->get_active());
+ const bool bEnable = (mnActSecLevel < 3 || mxAlwaysTrustCB->get_active());
mxEnableBtn->set_sensitive(bEnable);
mxDisableBtn->set_sensitive(!mxAlwaysTrustCB->get_active());
}