* FYI: Throwpoint test for java.io.FileInputStream
@ 2005-12-02 15:11 Gary Benson
2005-12-02 15:15 ` Gary Benson
0 siblings, 1 reply; 2+ messages in thread
From: Gary Benson @ 2005-12-02 15:11 UTC (permalink / raw)
To: mauve-patches
Hi,
I just added a test that checks that the file descriptor constructor
of java.io.FileInputStream is performing the appropriate security
checks.
Cheers,
Gary
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: FYI: Throwpoint test for java.io.FileInputStream
2005-12-02 15:11 FYI: Throwpoint test for java.io.FileInputStream Gary Benson
@ 2005-12-02 15:15 ` Gary Benson
0 siblings, 0 replies; 2+ messages in thread
From: Gary Benson @ 2005-12-02 15:15 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 26 bytes --]
Doh, forgot the patch :-/
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2688 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.1268
diff -u -r1.1268 ChangeLog
--- ChangeLog 1 Dec 2005 12:40:35 -0000 1.1268
+++ ChangeLog 2 Dec 2005 14:47:18 -0000
@@ -1,3 +1,7 @@
+2005-12-02 Gary Benson <gbenson@redhat.com>
+
+ * gnu/testlet/java/io/FileInputStream/security.java: New test.
+
2005-12-01 Gary Benson <gbenson@redhat.com>
* gnu/testlet/java/io/File/security.java: Annotate
Index: gnu/testlet/java/io/FileInputStream/security.java
===================================================================
RCS file: gnu/testlet/java/io/FileInputStream/security.java
diff -N gnu/testlet/java/io/FileInputStream/security.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/io/FileInputStream/security.java 2 Dec 2005 14:47:18 -0000
@@ -0,0 +1,56 @@
+// Copyright (C) 2005 Red Hat, Inc.
+// Written by Gary Benson <gbenson@redhat.com>
+
+// 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.
+
+package gnu.testlet.java.io.FileInputStream;
+
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.security.Permission;
+
+import gnu.testlet.Testlet;
+import gnu.testlet.TestHarness;
+import gnu.testlet.TestSecurityManager2;
+
+public class security implements Testlet
+{
+ public void test (TestHarness harness)
+ {
+ Permission perm = new RuntimePermission("readFileDescriptor");
+
+ TestSecurityManager2 sm = new TestSecurityManager2(harness);
+
+ try {
+ sm.install();
+
+ // security: java.io.FileInputStream-FileInputStream(FileDescriptor)
+ harness.checkPoint("FileDescriptor constructor");
+ sm.prepareChecks(new Permission[] {perm}, new Permission[] {});
+ new FileInputStream(FileDescriptor.in);
+ sm.checkAllChecked(harness);
+ }
+ catch (Throwable ex) {
+ harness.debug(ex);
+ harness.check(false, "Unexpected exception");
+ }
+ finally {
+ sm.uninstall();
+ }
+ }
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-12-02 15:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-02 15:11 FYI: Throwpoint test for java.io.FileInputStream Gary Benson
2005-12-02 15:15 ` Gary Benson
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).