* FYI: More java.lang.System throwpoint tests
@ 2006-01-30 15:38 Gary Benson
0 siblings, 0 replies; only message in thread
From: Gary Benson @ 2006-01-30 15:38 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 246 bytes --]
Hi again,
My last commit added more throwpoint checks for java.lang.System. One
I missed, the rest weren't on the list of methods and the permissions
they require but I found them in the javadoc while looking up the one
I missed.
Cheers,
Gary
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3871 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.1400
diff -u -r1.1400 ChangeLog
--- ChangeLog 30 Jan 2006 14:34:13 -0000 1.1400
+++ ChangeLog 30 Jan 2006 15:34:51 -0000
@@ -1,3 +1,7 @@
+2006-01-30 Gary Benson <gbenson@redhat.com>
+
+ * gnu/testlet/java/lang/System/security.java: More new tests.
+
2006-01-30 Gary Benson <gbenson@redhat.com>
* gnu/testlet/java/lang/System/security.java: New test.
2006-01-30 Roman Kennke <kennke@aicas.com>
Index: gnu/testlet/java/lang/System/security.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/System/security.java,v
retrieving revision 1.1
diff -u -r1.1 security.java
--- gnu/testlet/java/lang/System/security.java 30 Jan 2006 14:34:13 -0000 1.1
+++ gnu/testlet/java/lang/System/security.java 30 Jan 2006 15:34:51 -0000
@@ -38,6 +38,11 @@
String library_name = "blah";
String library_path = "/path/to/libnothing.so";
+ String a_variable = "PATH";
+ String not_a_variable = "PITH";
+ harness.check(System.getenv(a_variable) != null);
+ harness.check(System.getenv(not_a_variable) == null);
+
Properties properties = System.getProperties();
String a_property = "java.vm.name";
@@ -53,6 +58,11 @@
Permission[] loadLibrary_path = new Permission[] {
new RuntimePermission("loadLibrary." + library_path)};
+ Permission[] readVariable = new Permission[] {
+ new RuntimePermission("getenv." + a_variable)};
+ Permission[] readNonVariable = new Permission[] {
+ new RuntimePermission("getenv." + not_a_variable)};
+
Permission[] readWriteAllProperties = new Permission[] {
new PropertyPermission("*", "read,write")};
@@ -141,6 +151,29 @@
}
}
+ // security: TODO: java.lang.System-getenv()
+
+ // security: java.lang.System-getenv(String)
+ harness.checkPoint("getenv(String)");
+ try {
+ sm.prepareChecks(readVariable, noPerms);
+ System.getenv(a_variable);
+ sm.checkAllChecked(harness);
+ }
+ catch (SecurityException ex) {
+ harness.debug(ex);
+ harness.check(false, "unexpected check");
+ }
+ try {
+ sm.prepareChecks(readNonVariable, noPerms);
+ System.getenv(not_a_variable);
+ sm.checkAllChecked(harness);
+ }
+ catch (SecurityException ex) {
+ harness.debug(ex);
+ harness.check(false, "unexpected check");
+ }
+
// security: java.lang.System-getProperties
harness.checkPoint("getProperties");
try {
@@ -165,8 +198,8 @@
harness.check(false, "unexpected check");
}
- // security: java.lang.System-getProperty
- harness.checkPoint("getProperty");
+ // security: java.lang.System-getProperty(String)
+ harness.checkPoint("getProperty(String)");
try {
sm.prepareChecks(readProperty, noPerms);
System.getProperty(a_property);
@@ -186,6 +219,27 @@
harness.check(false, "unexpected check");
}
+ // security: java.lang.System-getProperty(String, String)
+ harness.checkPoint("getProperty(String, String)");
+ try {
+ sm.prepareChecks(readProperty, noPerms);
+ System.getProperty(a_property, "quadrant");
+ sm.checkAllChecked(harness);
+ }
+ catch (SecurityException ex) {
+ harness.debug(ex);
+ harness.check(false, "unexpected check");
+ }
+ try {
+ sm.prepareChecks(readNonProperty, noPerms);
+ System.getProperty(not_a_property, "blade");
+ sm.checkAllChecked(harness);
+ }
+ catch (SecurityException ex) {
+ harness.debug(ex);
+ harness.check(false, "unexpected check");
+ }
+
// security: java.lang.System-setIn
harness.checkPoint("setIn");
try {
@@ -243,6 +297,8 @@
harness.check(false, "unexpected check");
}
+ // security: TODO: java.lang.System-clearProperty
+
// security: java.lang.System-setSecurityManager
harness.checkPoint("setSecurityManager");
try {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-01-30 15:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-30 15:38 FYI: More java.lang.System throwpoint tests 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).