summaryrefslogtreecommitdiff
path: root/scripting/source
diff options
context:
space:
mode:
authorDuncan Foster <dfoster@openoffice.org>2003-10-29 14:44:30 +0000
committerDuncan Foster <dfoster@openoffice.org>2003-10-29 14:44:30 +0000
commit8a8bfb21ae9412a45b0e580d51555f362d515c77 (patch)
tree43621f9f31846ee6da7e03f1afd8ff682c041a78 /scripting/source
parent706da18a5b40e406159efe999f324a45bf010b4d (diff)
#i21624#
Added security check to the ScriptProtocolHandler. Needed dep on the sfx2 lib. Hence the changes to the makefile.
Diffstat (limited to 'scripting/source')
-rw-r--r--scripting/source/protocolhandler/makefile.mk7
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx35
2 files changed, 37 insertions, 5 deletions
diff --git a/scripting/source/protocolhandler/makefile.mk b/scripting/source/protocolhandler/makefile.mk
index ca772a0974a2..250207b3c8be 100644
--- a/scripting/source/protocolhandler/makefile.mk
+++ b/scripting/source/protocolhandler/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: dfoster $ $Date: 2002-09-20 14:33:11 $
+# last change: $Author: dfoster $ $Date: 2003-10-29 15:44:30 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -79,9 +79,10 @@ COMP1TYPELIST=$(TARGET)
SLOFILES=\
$(SLO)$/scripthandler.obj\
-SHL1TARGET= $(TARGET)
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
SHL1STDLIBS= \
+ $(SFXLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index 9fa065e29d34..d5bd259dab9c 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scripthandler.cxx,v $
*
-* $Revision: 1.13 $
+* $Revision: 1.14 $
*
-* last change: $Author: toconnor $ $Date: 2003-10-29 15:26:02 $
+* last change: $Author: dfoster $ $Date: 2003-10-29 15:44:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,8 +66,12 @@
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <sfx2/objsh.hxx>
+#include <sfx2/frame.hxx>
+
#include <cppuhelper/factory.hxx>
#include <util/util.hxx>
@@ -166,6 +170,33 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
{
try
{
+ // obtain the SfxObject shell for our security check
+ SfxObjectShell* pDocShell = NULL;
+ Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
+ if ( xFrame.is() )
+ {
+ SfxFrame* pFrame=0;
+ for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
+ {
+ if ( pFrame->GetFrameInterface() == xFrame )
+ break;
+ }
+
+ if ( pFrame )
+ pDocShell = pFrame->GetCurrentDocument();
+ }
+
+ // Security check
+ pDocShell->AdjustMacroMode( String() );
+ OSL_TRACE( "ScriptProtocolHandler::dispatchWithNotification: MacroMode = %d", pDocShell->GetMacroMode() );
+ if ( pDocShell->GetMacroMode() == ::com::sun::star::document::MacroExecMode::NEVER_EXECUTE )
+ {
+ // check forbids execution
+ ::rtl::OUString temp = OUSTR( "ScriptProtocolHandler::dispatchWithNotification: execution permission denied. " );
+ throw RuntimeException( temp, Reference< XInterface >() );
+ }
+
+
// Creates a ScriptProvider ( if one is not created allready )
createScriptProvider( aURL.Complete );