summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorJohn Rice <jmrice@openoffice.org>2003-03-07 10:02:42 +0000
committerJohn Rice <jmrice@openoffice.org>2003-03-07 10:02:42 +0000
commit32ef4ef3045ea3256ef5be643846bd1cd789c1ff (patch)
tree9b70e4bae06d1fc6e5e16952df7ed456cca99ff4 /scripting
parent259492e7945bceec2bfc670ae78c6aaef0b833f3 (diff)
Bug #12119 Checking Add to path applied even if user selects not to run
SecurityManager - code review updates
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java16
-rwxr-xr-xscripting/source/storage/ScriptSecurityManager.cxx38
-rwxr-xr-xscripting/source/storage/ScriptSecurityManager.hxx12
3 files changed, 44 insertions, 22 deletions
diff --git a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java
index 81992e4536bd..ff3c945d0d10 100644
--- a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java
+++ b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java
@@ -2,9 +2,9 @@
*
* $RCSfile: SecurityDialog.java,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dfoster $ $Date: 2003-03-04 12:33:34 $
+ * last change: $Author: jmrice $ $Date: 2003-03-07 11:02:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -493,13 +493,15 @@ XInitialization {
_xDialog.execute();
ScriptRuntimeForJava.DEBUG("*DF* After execute " );
- if ( _pushed.equals( _runButtonName ) )
+ // 12119: Checking Add to path applied even if user selects not to run
+ if ( _pushed.equals( _runButtonName ) )
{
result += 1;
- }
- if ( _checkBoxState == 1 )
- {
- result +=2;
+
+ if ( _checkBoxState == 1 )
+ {
+ result +=2;
+ }
}
return result;
}
diff --git a/scripting/source/storage/ScriptSecurityManager.cxx b/scripting/source/storage/ScriptSecurityManager.cxx
index 07e8eacf9edd..0be7bb538725 100755
--- a/scripting/source/storage/ScriptSecurityManager.cxx
+++ b/scripting/source/storage/ScriptSecurityManager.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ScriptSecurityManager.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: dfoster $ $Date: 2003-03-05 11:36:08 $
+ * last change: $Author: jmrice $ $Date: 2003-03-07 11:02:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -109,6 +109,9 @@ static const int PERMISSION_NEVER = 0;
static const int PERMISSION_PATHLIST = 1;
static const int PERMISSION_ALWAYS = 2;
+static const int ALLOW_RUN = 1;
+static const int ADD_TO_PATH = 2;
+
//*************************************************************************
// ScriptSecurityManager Constructor
ScriptSecurityManager::ScriptSecurityManager(
@@ -182,11 +185,11 @@ throw ( RuntimeException )
Sequence< ::rtl::OUString > logicalNames = xScriptInfoAccess->getScriptLogicalNames();
if( !logicalNames.getLength() ) // we have no logical names
{
- m_permissionSettings[ scriptStorageURL ] = newPerm;
return;
}
// we have some scripts so read config & decide on that basis
+ // Setup flags: m_runMacroSetting, m_warning, m_confirmationRequired,
readConfiguration();
}
catch ( RuntimeException & rte )
@@ -216,11 +219,10 @@ throw ( RuntimeException )
bool match = isSecureURL( path );
if( match && ( m_warning == sal_True ) )
{
- OUString dummyStr;
OSL_TRACE("path match & warning dialog");
- int result = (int)executeDialog( dummyStr );
+ int result = (int)executeStandardDialog();
OSL_TRACE("result = %d", (int)result);
- if ( (result&1) == 1 )
+ if ( (result&ALLOW_RUN) == ALLOW_RUN )
{
newPerm.execPermission=sal_True;
}
@@ -235,13 +237,13 @@ throw ( RuntimeException )
else if( m_confirmationRequired == sal_True )
{
OSL_TRACE("no path match & confirmation dialog");
- int result = (int)executeDialog( path );
+ int result = (int)executePathDialog( path );
OSL_TRACE("result = %d", (int)result);
- if ( (result&1) == 1 )
+ if ( (result&ALLOW_RUN) == ALLOW_RUN )
{
newPerm.execPermission=sal_True;
}
- if ( (result&2) == 2 )
+ if ( (result&ADD_TO_PATH) == ADD_TO_PATH )
{
/* if checkbox clicked then need to add path to registry*/
addToSecurePaths(path);
@@ -253,9 +255,8 @@ throw ( RuntimeException )
if( m_warning == sal_True )
{
OSL_TRACE("always & warning dialog");
- OUString dummyStr;
- short result = executeDialog( dummyStr );
- if ( result&1 == 1 )
+ short result = executeStandardDialog();
+ if ( (result&ALLOW_RUN) == ALLOW_RUN )
{
newPerm.execPermission=sal_True;
}
@@ -318,6 +319,19 @@ bool ScriptSecurityManager::isSecureURL( const OUString & path )
return match;
}
+short ScriptSecurityManager::executeStandardDialog()
+throw ( RuntimeException )
+{
+ OUString dummyString;
+ return executeDialog( dummyString );
+}
+
+short ScriptSecurityManager::executePathDialog( const OUString & path )
+throw ( RuntimeException )
+{
+ return executeDialog( path );
+}
+
short ScriptSecurityManager::executeDialog( const OUString & path )
throw ( RuntimeException )
{
diff --git a/scripting/source/storage/ScriptSecurityManager.hxx b/scripting/source/storage/ScriptSecurityManager.hxx
index be98d8bfa8d3..71926a1c1cd0 100755
--- a/scripting/source/storage/ScriptSecurityManager.hxx
+++ b/scripting/source/storage/ScriptSecurityManager.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ScriptSecurityManager.hxx,v $
*
-* $Revision: 1.9 $
+* $Revision: 1.10 $
*
-* last change: $Author: dfoster $ $Date: 2003-03-05 11:36:08 $
+* last change: $Author: jmrice $ $Date: 2003-03-07 11:02:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -108,9 +108,15 @@ public:
void removePermissionSettings ( ::rtl::OUString & scriptStorageURL );
private:
void readConfiguration() throw (css::uno::RuntimeException);
+
short executeDialog ( const rtl::OUString & path )
throw (css::uno::RuntimeException);
- void addToSecurePaths ( const rtl::OUString & path )
+ short executeStandardDialog()
+ throw ( css::uno::RuntimeException );
+ short executePathDialog(const rtl::OUString & path)
+ throw ( css::uno::RuntimeException );
+
+ void addToSecurePaths ( const rtl::OUString & path )
throw (css::uno::RuntimeException);
bool isSecureURL( const rtl::OUString & path );
css::uno::Reference< css::uno::XComponentContext > m_xContext;