summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/doc/objmisc.cxx6
-rw-r--r--sfx2/source/doc/objserv.cxx10
-rw-r--r--sfx2/source/doc/objstor.cxx2
3 files changed, 18 insertions, 0 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 97a0839a59dd..1e86b854f074 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -938,6 +938,12 @@ void SfxObjectShell::BreakMacroSign_Impl( bool bBreakMacroSign )
void SfxObjectShell::CheckSecurityOnLoading_Impl()
{
+ if (GetErrorCode() == ERRCODE_IO_BROKENPACKAGE)
+ { // safety first: don't run any macros from broken package.
+ pImpl->aMacroMode.disallowMacroExecution();
+ return; // do not get signature status - needs to be done after RepairPackage
+ }
+
// make sure LO evaluates the macro signatures, so it can be preserved
GetScriptingSignatureState();
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f0bc6172ab1d..895bec13f0c0 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1837,6 +1837,16 @@ SignatureState SfxObjectShell::ImplGetSignatureState( bool bScriptingContent )
uno::Sequence< security::DocumentSignatureInformation > aInfos = GetDocumentSignatureInformation( bScriptingContent );
*pState = DocumentSignatures::getSignatureState(aInfos);
+
+ // repaired package cannot be trusted
+ if (*pState != SignatureState::NOSIGNATURES)
+ {
+ SfxBoolItem const*const pRepairItem{GetMedium()->GetItemSet()->GetItem(SID_REPAIRPACKAGE, false)};
+ if (pRepairItem && pRepairItem->GetValue())
+ {
+ *pState = SignatureState::BROKEN;
+ }
+ }
}
if ( *pState == SignatureState::OK || *pState == SignatureState::NOTVALIDATED
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 9ef664d1cb2f..30b02aba97cc 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -380,6 +380,8 @@ void SfxObjectShell::PrepareSecondTryLoad_Impl()
{
// only for internal use
pImpl->m_xDocStorage.clear();
+ pImpl->nDocumentSignatureState = SignatureState::UNKNOWN;
+ pImpl->nScriptingSignatureState = SignatureState::UNKNOWN;
pImpl->m_bIsInit = false;
ResetError();
}