From: Gary Benson <gbenson@redhat.com>
To: mauve-patches@sources.redhat.com
Subject: FYI: New java.lang.SecurityManager tests
Date: Thu, 17 Nov 2005 16:45:00 -0000 [thread overview]
Message-ID: <20051117164540.GH8018@redhat.com> (raw)
In-Reply-To: <20051116174614.GE5193@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
Hi,
I just spotted that the thread and thread group access permissions
checks were broken in Classpath so I added a regression test. This
will fail under Classpath without the patch I just mailed there.
Cheers,
Gary
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3349 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.1238
diff -u -r1.1238 ChangeLog
--- ChangeLog 16 Nov 2005 21:30:34 -0000 1.1238
+++ ChangeLog 17 Nov 2005 16:38:58 -0000
@@ -1,3 +1,8 @@
+2005-11-16 Gary Benson <gbenson@redhat.com>
+
+ * gnu/testlet/java/lang/SecurityManager: New directory.
+ * gnu/testlet/java/lang/SecurityManager/thread.java: New test.
+
2005-11-16 Anthony Balkissoon <abalkiss@redhat.com>
* gnu/testlet/javax/swing/JSplitPane/Constructor.java: Added several
Index: gnu/testlet/java/lang/SecurityManager/thread.java
===================================================================
RCS file: gnu/testlet/java/lang/SecurityManager/thread.java
diff -N gnu/testlet/java/lang/SecurityManager/thread.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/lang/SecurityManager/thread.java 17 Nov 2005 16:38:58 -0000
@@ -0,0 +1,67 @@
+// Copyright (C) 2005, Red Hat, Inc.
+//
+// This file is part of Mauve.
+//
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+//
+// Tags: JDK1.2
+
+package gnu.testlet.java.lang.SecurityManager;
+
+import java.security.Permission;
+
+import gnu.testlet.Testlet;
+import gnu.testlet.TestHarness;
+import gnu.testlet.TestSecurityManager2;
+
+public class thread implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ // The 1.4.2 javadoc for SecurityManager.checkAccess(Thread) says
+ // that checkAccess will check RuntimePermission("modifyThread")
+ // for system threads, and do nothing for other threads. It
+ // defines a system thread as one belonging to a thread group
+ // with a null parent. SecurityManager.checkAccess(ThreadGroup)
+ // similarly performs checks only when the group's parent is null.
+
+ harness.checkPoint("checkAccess");
+
+ // Get ourselves a system thread and group
+ Thread thread = Thread.currentThread();
+
+ ThreadGroup group = thread.getThreadGroup();
+ harness.check(group != null);
+
+ while (group.getParent() != null)
+ group = group.getParent();
+ if (thread.getThreadGroup() != group)
+ thread = new Thread(group, "dummy");
+
+ // Check we're checking
+ TestSecurityManager2 sm = new TestSecurityManager2(harness);
+
+ sm.prepareChecks(new Permission[] {
+ new RuntimePermission("modifyThread")}, new Permission[] {});
+ sm.checkAccess(thread);
+ sm.checkAllChecked(harness);
+
+ sm.prepareChecks(new Permission[] {
+ new RuntimePermission("modifyThreadGroup")}, new Permission[] {});
+ sm.checkAccess(group);
+ sm.checkAllChecked(harness);
+ }
+}
prev parent reply other threads:[~2005-11-17 16:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-16 17:46 Patch: New java.io.FilePermission.implies action tests Gary Benson
2005-11-16 17:49 ` Tom Tromey
2005-11-16 17:55 ` Gary Benson
2005-11-16 17:56 ` Tom Tromey
2005-11-16 17:54 ` Gary Benson
2005-11-17 16:45 ` Gary Benson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051117164540.GH8018@redhat.com \
--to=gbenson@redhat.com \
--cc=mauve-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).