uui/source/secmacrowarnings.cxx |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

New commits:
commit a75a17219d95b6180a03d02a526234ef461c9172
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Mon Dec 11 15:06:54 2023 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Dec 14 16:11:42 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>
    (cherry picked from commit 37b381e2877c60c84547b22117663a72ab02fadc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160752
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

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());
 }

Reply via email to