aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1381225 - in /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal: AriesSubsystem.java StartAction.java
Date Wed, 05 Sep 2012 15:28:02 GMT
Author: jwross
Date: Wed Sep  5 15:28:01 2012
New Revision: 1381225

URL: http://svn.apache.org/viewvc?rev=1381225&view=rev
Log:
ARIES-920: Calls to setAutostart are now privileged when starting or stopping a subsystem.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java?rev=1381225&r1=1381224&r2=1381225&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/AriesSubsystem.java
Wed Sep  5 15:28:01 2012
@@ -19,6 +19,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -259,14 +260,34 @@ public class AriesSubsystem implements R
 	@Override
 	public void start() {
 		SecurityManager.checkExecutePermission(this);
-		setAutostart(true);
+		// Changing the autostart setting must be privileged because of file IO.
+		// It cannot be done within SartAction because we only want to change it
+		// on an explicit start operation but StartAction is also used for
+		// implicit operations.
+		AccessController.doPrivileged(new PrivilegedAction<Object>() {
+			@Override
+			public Object run() {
+				setAutostart(true);
+				return null;
+			}
+		});
 		AccessController.doPrivileged(new StartAction(this, this, this));
 	}
 
 	@Override
 	public void stop() {
 		SecurityManager.checkExecutePermission(this);
-		setAutostart(false);
+		// Changing the autostart setting must be privileged because of file IO.
+		// It cannot be done within StopAction because we only want to change it
+		// on an explicit stop operation but StopAction is also used for
+		// implicit operations.
+		AccessController.doPrivileged(new PrivilegedAction<Object>() {
+			@Override
+			public Object run() {
+				setAutostart(false);
+				return null;
+			}
+		});
 		AccessController.doPrivileged(new StopAction(this, this, !isRoot()));
 	}
 

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java?rev=1381225&r1=1381224&r2=1381225&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/StartAction.java
Wed Sep  5 15:28:01 2012
@@ -237,6 +237,8 @@ public class StartAction extends Abstrac
 	
 	private void startBundleResource(Resource resource, Coordination coordination) throws BundleException
{
 		if (target.isRoot())
+			// Starting the root subsystem should not affect bundles within the
+			// root region.
 			return;
 		final Bundle bundle = ((BundleRevision)resource).getBundle();
 		if ((bundle.getState() & (Bundle.STARTING | Bundle.ACTIVE)) != 0)



Mime
View raw message