summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/impldde.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-07-14 19:09:11 +0000
committerArmin Le Grand <alg@apache.org>2014-07-14 19:09:11 +0000
commit3c1d4742e649fe9c8aed8c2817fe3e1f3364f298 (patch)
treee0c6e02c89aa9227726c9469da1001b3e29c41df /sfx2/source/appl/impldde.cxx
parentc5c31e2aeaedbdf76e1f38d3c385e34f5ed875ca (diff)
Resync to trunk, windows non-pro buildaoo/aw080
Diffstat (limited to 'sfx2/source/appl/impldde.cxx')
-rw-r--r--sfx2/source/appl/impldde.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index c4d8ae6463b4..3fbcaa77cc9a 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -49,6 +49,8 @@
#include <svl/svdde.hxx>
#include <sot/formats.hxx>
+#include <unotools/securityoptions.hxx>
+
#define DDELINK_COLD 0
#define DDELINK_HOT 1
@@ -255,15 +257,23 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink )
}
#if defined(WNT)
-
- // Server nicht da, starten und nochmal versuchen
- if( !bInWinExec )
+ // check the suitability of starting the DDE server
+ const SvtSecurityOptions aSecOpts;
+ bool bForbidden = (aSecOpts.GetMacroSecurityLevel() == eNEVER_EXECUTE);
+ bForbidden |= (sServer.SearchChar( L":./%\\") != STRING_NOTFOUND);
+ static const char* aBadServers[] = { "cmd", "rundll32" };
+ for( int i = 0; i < sizeof(aBadServers)/sizeof(*aBadServers); ++i)
+ bForbidden |= (sServer.CompareIgnoreCaseToAscii( aBadServers[i]) == COMPARE_EQUAL);
+
+ // try to start the DDE server if it is not there already
+ bForbidden |= (bInWinExec != sal_False);
+ if( !bForbidden )
{
ByteString aCmdLine( sServer, RTL_TEXTENCODING_ASCII_US );
aCmdLine.Append( ".exe " );
aCmdLine.Append( ByteString( sTopic, RTL_TEXTENCODING_ASCII_US ) );
- if( WinExec( aCmdLine.GetBuffer(), SW_SHOWMINIMIZED ) < 32 )
+ if( WinExec( aCmdLine.GetBuffer(), SW_SHOWMINIMIZED ) < 32 ) // TODO: use CreateProcess() instead
nError = DDELINK_ERROR_APP;
else
{