summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-12-18 16:37:16 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-12-21 11:06:31 +0100
commite377a29bcf9bc383749edfb5a9d0c0dcbd8dfe59 (patch)
treeed0b525cf7d496b40335710ce9c0e69c4ca77155
parent4cba1d7cdf89e885353db7a806cc39b415b80008 (diff)
tdf#158375: disable DDE when DisableActiveContent is set
Change-Id: I167f6ea5d740b5a53cd02a9b865e65ff980a8877 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160922 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins (cherry picked from commit 21f8e08c60cde2599f45b9e02c2b7d0cead2f625) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161029 Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx4
-rw-r--r--include/comphelper/embeddedobjectcontainer.hxx3
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx4
-rw-r--r--sfx2/source/appl/linkmgr2.cxx10
-rw-r--r--sfx2/source/appl/lnkbase2.cxx4
-rw-r--r--svl/source/svdde/ddecli.cxx17
-rw-r--r--svl/source/svdde/ddesvr.cxx17
-rw-r--r--sw/source/uibase/app/docsh2.cxx2
9 files changed, 50 insertions, 13 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 9a971b41b3f6..23915d3e13ab 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -46,6 +46,8 @@
#include <cppuhelper/weakref.hxx>
#include <sal/log.hxx>
+#include <officecfg/Office/Common.hxx>
+
#include <algorithm>
#include <unordered_map>
@@ -1492,6 +1494,8 @@ bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< embed::
bool EmbeddedObjectContainer::getUserAllowsLinkUpdate() const
{
+ if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return false;
return pImpl->mbUserAllowsLinkUpdate;
}
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
index cc040da152c3..8c75718dce35 100644
--- a/include/comphelper/embeddedobjectcontainer.hxx
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -182,7 +182,10 @@ public:
*/
bool SetPersistentEntries(const css::uno::Reference< css::embed::XStorage >& _xStorage,bool _bClearModifiedFlag = true);
+ // if DisableActiveContent configuration option is set, this always returns false
bool getUserAllowsLinkUpdate() const;
+
+ // if DisableActiveContent configuration option is set, this has no effect
void setUserAllowsLinkUpdate(bool bNew);
};
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 27e7eba04007..53aa213ac80d 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2520,7 +2520,7 @@
<prop oor:name="DisableActiveContent" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies whether or not to disable active content. Right now
- only disables active embedded content (OLE).</desc>
+ only disables active embedded content (OLE) and DDE.</desc>
</info>
<value>false</value>
</prop>
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f8a33f91d1e8..964515743c27 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -109,6 +109,7 @@
#include <helpids.h>
#include <editeng/eeitem.hxx>
#include <editeng/langitem.hxx>
+#include <officecfg/Office/Common.hxx>
#include <svx/xdef.hxx>
@@ -2501,6 +2502,9 @@ bool ScDocShell::DdeSetData( const OUString& rItem,
::sfx2::SvLinkSource* ScDocShell::DdeCreateLinkSource( const OUString& rItem )
{
+ if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return nullptr;
+
// only check for valid item string - range is parsed again in ScServerObject ctor
// named range?
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index f529fb11d468..a20501a1bad6 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -21,6 +21,7 @@
#include <sfx2/linkmgr.hxx>
#include <sfx2/sfxsids.hrc>
#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <officecfg/Office/Common.hxx>
#include <osl/file.hxx>
#include <sfx2/objsh.hxx>
#include <svl/urihelper.hxx>
@@ -281,6 +282,11 @@ void LinkManager::UpdateAllLinks(
bool bUpdateGrfLinks,
weld::Window* pParentWin )
{
+ // when active content is disabled don't bother updating all links
+ // also (when bAskUpdate == true) don't show the pop up.
+ if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return;
+
// First make a copy of the array in order to update links
// links in ... no contact between them!
std::vector<SvBaseLink*> aTmpArr;
@@ -354,8 +360,12 @@ SvLinkSourceRef LinkManager::CreateObj( SvBaseLink const * pLink )
case SvBaseLinkObjectType::ClientOle:
return new SvFileObject;
case SvBaseLinkObjectType::Internal:
+ if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return SvLinkSourceRef();
return new SvxInternalLink;
case SvBaseLinkObjectType::ClientDde:
+ if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return SvLinkSourceRef();
return new SvDDEObject;
default:
return SvLinkSourceRef();
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index 7fd3b3d530d5..eea1751cd57e 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -33,6 +33,7 @@
#include <tools/debug.hxx>
#include <svl/svdde.hxx>
#include <osl/diagnose.h>
+#include <officecfg/Office/Common.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -301,6 +302,9 @@ void SvBaseLink::clearStreamToLoadFrom()
bool SvBaseLink::Update()
{
+ if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return false;
+
if( isClientType(mnObjType) )
{
AddNextRef();
diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index 7ad4c1e097b3..835bdf2269c6 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -22,6 +22,7 @@
#include <algorithm>
#include "ddeimp.hxx"
#include <svl/svdde.hxx>
+#include <officecfg/Office/Common.hxx>
#include <osl/thread.h>
#include <comphelper/solarmutex.hxx>
@@ -150,12 +151,16 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic )
pInst->nInstanceCli++;
if ( !pInst->hDdeInstCli )
{
- pImp->nStatus = DdeInitializeW( &pInst->hDdeInstCli,
- DdeInternal::CliCallback,
- APPCLASS_STANDARD | APPCMD_CLIENTONLY |
- CBF_FAIL_ALLSVRXACTIONS |
- CBF_SKIP_REGISTRATIONS |
- CBF_SKIP_UNREGISTRATIONS, 0L );
+ pImp->nStatus = DMLERR_SYS_ERROR;
+ if ( !officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() )
+ {
+ pImp->nStatus = DdeInitializeW( &pInst->hDdeInstCli,
+ DdeInternal::CliCallback,
+ APPCLASS_STANDARD | APPCMD_CLIENTONLY |
+ CBF_FAIL_ALLSVRXACTIONS |
+ CBF_SKIP_REGISTRATIONS |
+ CBF_SKIP_UNREGISTRATIONS, 0L );
+ }
}
pService = new DdeString( pInst->hDdeInstCli, rService );
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index 327fb9a8f5d3..3df8b5a570a5 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -26,6 +26,7 @@
#include <osl/thread.h>
#include <o3tl/sorted_vector.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <officecfg/Office/Common.hxx>
namespace {
@@ -354,12 +355,16 @@ DdeService::DdeService( const OUString& rService )
if ( !pInst->hDdeInstSvr )
{
- nStatus = sal::static_int_cast< short >(
- DdeInitializeW( &pInst->hDdeInstSvr,
- DdeInternal::SvrCallback,
- APPCLASS_STANDARD |
- CBF_SKIP_REGISTRATIONS |
- CBF_SKIP_UNREGISTRATIONS, 0 ) );
+ nStatus = DMLERR_SYS_ERROR;
+ if ( !officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() )
+ {
+ nStatus = sal::static_int_cast< short >(
+ DdeInitializeW( &pInst->hDdeInstSvr,
+ DdeInternal::SvrCallback,
+ APPCLASS_STANDARD |
+ CBF_SKIP_REGISTRATIONS |
+ CBF_SKIP_UNREGISTRATIONS, 0 ) );
+ }
pInst->pServicesSvr = new DdeServices;
}
else
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index e812abb5d543..9e3e7317bf9d 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1395,6 +1395,8 @@ bool SwDocShell::DdeSetData( const OUString& rItem, const OUString& /*rMimeType*
::sfx2::SvLinkSource* SwDocShell::DdeCreateLinkSource( const OUString& rItem )
{
+ if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return nullptr;
return m_xDoc->getIDocumentLinksAdministration().CreateLinkSource( rItem );
}