From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13084 invoked by alias); 24 Jul 2009 11:08:40 -0000 Received: (qmail 13075 invoked by uid 22791); 24 Jul 2009 11:08:39 -0000 X-SWARE-Spam-Status: No, hits=0.0 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_21,J_CHICKENPOX_65,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from moutng.kundenserver.de (HELO moutng.kundenserver.de) (212.227.126.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Jul 2009 11:08:32 +0000 Received: from mail.aicas.de ([195.71.148.10]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis) id 0MKxQS-1MUIdY3xJ2-000p3h; Fri, 24 Jul 2009 13:08:29 +0200 Received: from mail.aicas.burg (unknown [192.168.2.1]) by mail.aicas.de (Postfix) with ESMTP id 9A6F96AB170 for ; Fri, 24 Jul 2009 13:08:28 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aicas.burg (Postfix) with ESMTP id 956F056192A for ; Fri, 24 Jul 2009 13:08:17 +0200 (CEST) Received: from mail.aicas.burg ([127.0.0.1]) by localhost (www.aicas.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18743-08 for ; Fri, 24 Jul 2009 13:08:11 +0200 (CEST) Received: from [192.168.1.164] (unknown [192.168.1.164]) by mail.aicas.burg (Postfix) with ESMTP id D5EC8561732 for ; Fri, 24 Jul 2009 13:08:11 +0200 (CEST) Message-ID: <4A699626.6050602@aicas.com> Date: Fri, 24 Jul 2009 11:08:00 -0000 From: Mario Torre User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090703 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: mauve-patches@sources.redhat.com Subject: FIY: More security manager related fixlets Content-Type: multipart/mixed; boundary="------------020403050205040604000203" Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2009/txt/msg00017.txt.bz2 This is a multi-part message in MIME format. --------------020403050205040604000203 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 1044 2009-07-09 Mario Torre * gnu/testlet/java/lang/SecurityManager/thread.java: make sure SecurityManager is installed. * gnu/testlet/java/lang/System/security.java: clear property that we assume to be non existing (needed if test runs several time without exiting the vm). * gnu/testlet/java/net/URLClassLoader/security.java: * gnu/testlet/java/lang/Thread/security10.java Thread.enumerate does checks on ThreadGroup, but not on Thread create fake URLStreamHandler --=20 Mario Torre, Software Developer, http://www.jroller.com/neugens/ aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Stra=DFe 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-44 pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF USt-Id: DE216375633, Handelsregister HRB 109481, AG Mannheim Gesch=E4ftsf=FChrer: Dr. James J. Hunt Please, support open standards: http://endsoftpatents.org/ --------------020403050205040604000203 Content-Type: text/x-patch; name="2009-07-24-security-manager-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="2009-07-24-security-manager-2.patch" Content-length: 4067 # This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: mauve/gnu/testlet/java/lang/SecurityManager/thread.java --- mauve/gnu/testlet/java/lang/SecurityManager/thread.java Base (1.3) +++ mauve/gnu/testlet/java/lang/SecurityManager/thread.java Locally Modified (Based On 1.3) @@ -54,6 +54,10 @@ // Check we're checking TestSecurityManager sm = new TestSecurityManager(harness); + try + { + sm.install(); + sm.prepareChecks(new Permission[] { new RuntimePermission("modifyThread")}); sm.checkAccess(thread); @@ -64,4 +68,9 @@ sm.checkAccess(group); sm.checkAllChecked(); } + finally + { + sm.uninstall(); } + } +} Index: mauve/gnu/testlet/java/lang/System/security.java --- mauve/gnu/testlet/java/lang/System/security.java Base (1.6) +++ mauve/gnu/testlet/java/lang/System/security.java Locally Modified (Based On 1.6) @@ -34,6 +34,7 @@ { public void test(TestHarness harness) { + String not_a_property = "java.monkey.flump"; try { harness.checkPoint("setup"); @@ -48,12 +49,12 @@ Properties properties = System.getProperties(); String a_property = "java.vm.name"; - String not_a_property = "java.monkey.flump"; harness.check(properties.containsKey(a_property)); harness.check(!properties.containsKey(not_a_property)); + //exitVM.0 or set compare style to implies Permission[] exitVM = new Permission[] { - new RuntimePermission("exitVM")}; + new RuntimePermission("exitVM.0")}; Permission[] loadLibrary_name = new Permission[] { new RuntimePermission("loadLibrary." + library_name)}; @@ -307,6 +308,7 @@ } finally { sm.uninstall(); + System.clearProperty(not_a_property); } } catch (Exception ex) { Index: mauve/gnu/testlet/java/lang/Thread/security10.java --- mauve/gnu/testlet/java/lang/Thread/security10.java Base (1.3) +++ mauve/gnu/testlet/java/lang/Thread/security10.java Locally Modified (Based On 1.3) @@ -34,6 +34,10 @@ { throw new SecurityException(); } + public void checkAccess(ThreadGroup thread) + { + throw new SecurityException(); + } public void checkPermission(Permission perm) { @@ -63,6 +67,8 @@ Thread testThread = new Thread(); + ThreadGroup group = new ThreadGroup("MyGroup"); + System.setSecurityManager(new MySecurityManager()); Runnable run = new Runnable() @@ -115,8 +121,6 @@ h.checkPoint("Thread creation with ThreadGroup"); - ThreadGroup group = new ThreadGroup("MyGroup"); - try { Thread thread = new Thread(group, "MyThread"); @@ -267,9 +271,12 @@ try { + /** + * does not call checkAccess(Thread) but + * checkAccess(ThreadGroup) + */ Thread[] array = new Thread[1]; - array[0] = Thread.currentThread(); - testThread.enumerate(array); + Thread.enumerate(array); h.check(false); } catch (SecurityException e) Index: mauve/gnu/testlet/java/net/URLClassLoader/security.java --- mauve/gnu/testlet/java/net/URLClassLoader/security.java Base (1.2) +++ mauve/gnu/testlet/java/net/URLClassLoader/security.java Locally Modified (Based On 1.2) @@ -22,8 +22,10 @@ package gnu.testlet.java.net.URLClassLoader; +import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.net.URLConnection; import java.net.URLStreamHandler; import java.net.URLStreamHandlerFactory; import java.security.Permission; @@ -97,7 +99,13 @@ { public URLStreamHandler createURLStreamHandler(String protocol) { + return new URLStreamHandler() + { + protected URLConnection openConnection(URL u) throws IOException + { throw new RuntimeException("not implemented"); } + }; } } +} --------------020403050205040604000203--