summaryrefslogtreecommitdiff
path: root/uui/source
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-12-11 15:06:54 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-12-14 08:11:04 +0100
commit37b381e2877c60c84547b22117663a72ab02fadc (patch)
treecc07d5659adf653f63f339ba477be274cff05ad9 /uui/source
parent4a859b3d2ffa4f427cd24bc4aacdc055d4c7826e (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>
Diffstat (limited to 'uui/source')
-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 0a295fba30a4..e5e1a46fdb97 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -78,20 +78,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)
@@ -122,7 +121,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());
}