uui/source/secmacrowarnings.cxx | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
New commits: commit 37b381e2877c60c84547b22117663a72ab02fadc Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Mon Dec 11 15:06:54 2023 +0100 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Thu Dec 14 08:11:04 2023 +0100 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.mehrbr...@allotropia.de> 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()); }