From: <ls...@us...> - 2008-08-27 10:33:35
|
Revision: 4517 http://jnode.svn.sourceforge.net/jnode/?rev=4517&view=rev Author: lsantha Date: 2008-08-27 10:33:31 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Added support for configuring securty during build. Modified Paths: -------------- trunk/core/build.xml trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java trunk/jnode.properties.dist Added Paths: ----------- trunk/core/src/template/org/jnode/security/ trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java Modified: trunk/core/build.xml =================================================================== --- trunk/core/build.xml 2008-08-26 21:10:56 UTC (rev 4516) +++ trunk/core/build.xml 2008-08-27 10:33:31 UTC (rev 4517) @@ -117,6 +117,10 @@ <token name="@java.io.tmpdir@" value="${jnode.java.io.tmpdir}"/> <token name="@user.home@" value="${jnode.user.home}"/> </template> + <template file="${my-src.dir}/template/org/jnode/security/JNodeSecurityManagerSettings.java" + tofile="${my-gen.dir}/org/jnode/security/JNodeSecurityManagerSettings.java"> + <token name="@jnode.security.enabled@" value="${jnode.security.enabled}"/> + </template> </target> <!-- Compile all subproject java files --> Modified: trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java =================================================================== --- trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java 2008-08-26 21:10:56 UTC (rev 4516) +++ trunk/core/src/core/org/jnode/security/JNodeSecurityManager.java 2008-08-27 10:33:31 UTC (rev 4517) @@ -36,12 +36,13 @@ */ @Override public void checkPermission(Permission perm) { + JNodeSecurityManagerSettings.checkPermission(perm, this); + } + void defaultCheckPermission(Permission perm) { if (perm.implies(SET_SECURITY_MANAGER)) { throw new SecurityException("Cannot override security manager"); } super.checkPermission(perm); - } - } Added: trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java =================================================================== --- trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java (rev 0) +++ trunk/core/src/template/org/jnode/security/JNodeSecurityManagerSettings.java 2008-08-27 10:33:31 UTC (rev 4517) @@ -0,0 +1,19 @@ +package org.jnode.security; + +import java.security.Permission; + +/** + * @author Levente S\u00e1ntha + */ +public class JNodeSecurityManagerSettings { + private static final boolean ENABLED = false; + static void checkPermission(Permission perm, JNodeSecurityManager sm) { + boolean enabled = true; + if (ENABLED) { + enabled = Boolean.valueOf("@jnode.security.enabled@"); + } + if (enabled){ + sm.defaultCheckPermission(perm); + } + } +} Modified: trunk/jnode.properties.dist =================================================================== --- trunk/jnode.properties.dist 2008-08-26 21:10:56 UTC (rev 4516) +++ trunk/jnode.properties.dist 2008-08-27 10:33:31 UTC (rev 4517) @@ -97,3 +97,9 @@ jnode.java.home=/jnode jnode.java.io.tmpdir=/jnode/tmp jnode.user.home=/jnode/home + +# ----------------------------------------------- +# Enable or disable security under JNode +# ----------------------------------------------- + +#jnode.security.enabled=true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |