From: <ls...@us...> - 2008-07-31 19:44:20
|
Revision: 4373 http://jnode.svn.sourceforge.net/jnode/?rev=4373&view=rev Author: lsantha Date: 2008-07-31 19:44:15 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Fixed security exeption at startup. Modified Paths: -------------- trunk/gui/descriptors/org.jnode.driver.textscreen.fb.xml trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java Modified: trunk/gui/descriptors/org.jnode.driver.textscreen.fb.xml =================================================================== --- trunk/gui/descriptors/org.jnode.driver.textscreen.fb.xml 2008-07-31 12:55:05 UTC (rev 4372) +++ trunk/gui/descriptors/org.jnode.driver.textscreen.fb.xml 2008-07-31 19:44:15 UTC (rev 4373) @@ -23,5 +23,12 @@ <export name="org.jnode.driver.textscreen.fb.*"/> </library> </runtime> + + <extension point="org.jnode.security.permissions"> + <permission class="java.lang.RuntimePermission" name="setIO"/> + + <!-- fb console is experimental, TODO: fix security --> + <permission class="java.security.AllPermission" /> + </extension> </plugin> \ No newline at end of file Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java =================================================================== --- trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java 2008-07-31 12:55:05 UTC (rev 4372) +++ trunk/gui/src/driver/org/jnode/driver/textscreen/fb/FBConsole.java 2008-07-31 19:44:15 UTC (rev 4373) @@ -1,10 +1,10 @@ package org.jnode.driver.textscreen.fb; import java.io.PrintStream; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collection; - import javax.naming.NameNotFoundException; - import org.apache.log4j.Logger; import org.jnode.driver.Device; import org.jnode.driver.DeviceManagerListener; @@ -29,7 +29,7 @@ private static final Logger log = Logger.getLogger(FBConsole.class); /** - * TODO use a listener mechanism instead + * TODO use a listener mechanism instead */ private static void waitShellManagerAvailable() { Unsafe.debug("waiting registration of a ShellManager"); @@ -43,12 +43,12 @@ } catch (NameNotFoundException e) { // not yet available } - + // not yet available Thread.yield(); } } - + public static void start() throws Exception { waitShellManagerAvailable(); @@ -68,7 +68,7 @@ public void deviceRegistered(Device device) { Unsafe.debug("device=" + device + "\n"); - if (device.implementsAPI(FrameBufferAPI.class)) { + if (device.implementsAPI(FrameBufferAPI.class)) { Unsafe.debug("got a FrameBufferDevice\n"); startFBConsole(device); } @@ -83,7 +83,7 @@ startFBConsole(dev); } } - + private static void startFBConsole(Device dev) { Unsafe.debug("startFBConsole\n"); Surface g = null; @@ -95,21 +95,26 @@ InitialNaming.unbind(TextScreenManager.NAME); InitialNaming.bind(TextScreenManager.NAME, new FbTextScreenManager(g)); - + //// ConsoleManager mgr = InitialNaming.lookup(ConsoleManager.NAME); - + // final int options = ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE; final TextConsole first = (TextConsole) mgr.createConsole( - null, options); - - mgr.registerConsole(first); + null, options); + + mgr.registerConsole(first); mgr.focus(first); - System.setOut(new PrintStream(first.getOut())); - System.setErr(new PrintStream(first.getErr())); + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + System.setOut(new PrintStream(first.getOut())); + System.setErr(new PrintStream(first.getErr())); + return null; + } + }); System.out.println(VmSystem.getBootLog()); if (first.getIn() == null) { @@ -122,11 +127,11 @@ } catch (Throwable ex) { Unsafe.debugStackTrace("Error in FBConsole", ex); } finally { - Unsafe.debug("FINALLY\n"); + Unsafe.debug("FINALLY\n"); if (g != null) { log.info("Close graphics"); g.close(); } - } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |