[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - 2 commits - configure.ac include/sfx2 sfx2/source

Thorsten Behrens (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 29 22:44:03 UTC 2021


Rebased ref, commits from common ancestor:
commit a2aa89cbefebd63afb6228c87524d2d767bc5f47
Author:     Thorsten Behrens <thorsten.behrens at allotropia.de>
AuthorDate: Fri Jan 29 21:30:24 2021 +0100
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Fri Jan 29 23:43:22 2021 +0100

    Bump version to 6.1.7.23
    
    Change-Id: Ice98e3e1bb542bf0eade8e9efd913b8210a752c3

diff --git a/configure.ac b/configure.ac
index 6e01348944d5..373cd216d423 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
 
-AC_INIT([LibreOffice powered by CIB],[6.1.7.22],[],[],[https://libreoffice.cib.eu/])
+AC_INIT([LibreOffice powered by CIB],[6.1.7.23],[],[],[https://libreoffice.cib.eu/])
 
 AC_PREREQ([2.59])
 
commit 7df8b437b721b25561995346abfb55dca0d500b5
Author:     Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
AuthorDate: Mon Jan 18 15:24:48 2021 +0100
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Fri Jan 29 23:43:22 2021 +0100

    Improve macro checks
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109552
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
    (cherry picked from commit 1dc71daf7fa7204a98c75dac680af664ab9c8edb)
    
    Change-Id: Ie40801df8866b52c1458e020ffa9cba120720af7

diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx
index 7e1511625086..19199f7a410e 100644
--- a/include/sfx2/docmacromode.hxx
+++ b/include/sfx2/docmacromode.hxx
@@ -218,7 +218,8 @@ namespace sfx2
                 <TRUE/> if and only if macro execution in this document is allowed.
         */
         bool    adjustMacroMode(
-                    const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction
+                    const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction,
+                    bool bHasValidContentSignature = false
                 );
 
         /** determines whether macro execution is disallowed
@@ -284,11 +285,13 @@ namespace sfx2
         */
         bool
                 checkMacrosOnLoading(
-                    const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction
+                    const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction,
+                    bool bHasValidContentSignature = false
                 );
 
     private:
         std::shared_ptr< DocumentMacroMode_Data >   m_xData;
+        bool m_bNeedsContentSigned;
     };
 
 
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index dc84f4e58598..4c27b767c80d 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -111,6 +111,10 @@ namespace sfx2
 #endif
         }
 
+        void lcl_showMacrosDisabledUnsignedContentError( const Reference< XInteractionHandler >& rxHandler, bool& rbAlreadyShown )
+        {
+            lcl_showGeneralSfxErrorOnce( rxHandler, ERRCODE_SFX_DOCUMENT_MACRO_DISABLED, rbAlreadyShown );
+        }
 
         bool lcl_showMacroWarning( const Reference< XInteractionHandler >& rxHandler,
             const OUString& rDocumentLocation )
@@ -123,7 +127,8 @@ namespace sfx2
 
     //= DocumentMacroMode
     DocumentMacroMode::DocumentMacroMode( IMacroDocumentAccess& rDocumentAccess )
-        :m_xData( new DocumentMacroMode_Data( rDocumentAccess ) )
+        :m_xData( new DocumentMacroMode_Data( rDocumentAccess ) ),
+        m_bNeedsContentSigned(false)
     {
     }
 
@@ -139,7 +144,7 @@ namespace sfx2
         return false;
     }
 
-    bool DocumentMacroMode::adjustMacroMode( const Reference< XInteractionHandler >& rxInteraction )
+    bool DocumentMacroMode::adjustMacroMode( const Reference< XInteractionHandler >& rxInteraction, bool bHasValidContentSignature )
     {
         sal_uInt16 nMacroExecutionMode = m_xData->m_rDocumentAccess.getCurrentMacroExecMode();
 
@@ -236,6 +241,14 @@ namespace sfx2
                         lcl_showDocumentMacrosDisabledError(rxInteraction, m_xData->m_bDocMacroDisabledMessageShown);
                     return disallowMacroExecution();
                 }
+                else if ( m_xData->m_rDocumentAccess.macroCallsSeenWhileLoading() &&
+                          bHasTrustedMacroSignature &&
+                          !bHasValidContentSignature)
+                {
+                    // When macros are signed, and the document has events which call macros, the document content needs to be signed too.
+                    lcl_showMacrosDisabledUnsignedContentError(rxInteraction, m_xData->m_bDocMacroDisabledMessageShown);
+                    return disallowMacroExecution();
+                }
                 else if ( bHasTrustedMacroSignature )
                 {
                     // there is trusted macro signature, allow macro execution
@@ -395,7 +408,7 @@ namespace sfx2
     }
 
 
-    bool DocumentMacroMode::checkMacrosOnLoading( const Reference< XInteractionHandler >& rxInteraction )
+    bool DocumentMacroMode::checkMacrosOnLoading( const Reference< XInteractionHandler >& rxInteraction, bool bHasValidContentSignature )
     {
         bool bAllow = false;
         if ( SvtSecurityOptions().IsMacroDisabled() )
@@ -407,7 +420,9 @@ namespace sfx2
         {
             if (m_xData->m_rDocumentAccess.documentStorageHasMacros() || hasMacroLibrary() || m_xData->m_rDocumentAccess.macroCallsSeenWhileLoading())
             {
-                bAllow = adjustMacroMode( rxInteraction );
+                if (m_xData->m_rDocumentAccess.macroCallsSeenWhileLoading())
+                    m_bNeedsContentSigned = true;
+                bAllow = adjustMacroMode( rxInteraction, bHasValidContentSignature );
             }
             else if ( !isMacroExecutionDisallowed() )
             {
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 7473a23e3783..91817a637620 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -937,7 +937,8 @@ void SfxObjectShell::CheckSecurityOnLoading_Impl()
     CheckEncryption_Impl( xInteraction );
 
     // check macro security
-    pImpl->aMacroMode.checkMacrosOnLoading( xInteraction );
+    const bool bHasValidContentSignature = HasValidSignatures();
+    pImpl->aMacroMode.checkMacrosOnLoading( xInteraction, bHasValidContentSignature );
 }
 
 


More information about the Libreoffice-commits mailing list