-
Enhancement
-
Resolution: Fixed
-
P3
-
1.2.0
-
None
-
1.2beta4
-
generic
-
solaris_2.5.1
-
Not verified
If there is a syntax error in the policy file, the system does not
show the syntax errors and silently discards the policy file.
This will be very confusing for the user. Instead, it should give
syntax errors to the user.
Here is a way to reproduce the problem:
dodda:/home/satyad/Bugs/beta3I2( 267 )%!257
java -new -usepolicy:=test1.jp Test
Permission NOT granted for = (java.lang.RuntimePermission System.test )
dodda:/home/satyad/Bugs/beta3I2( 268 )%!258
java -new -usepolicy:=test2.jp Test
Permission granted for = (java.lang.RuntimePermission System.test )
dodda:/home/satyad/Bugs/beta3I2( 270 )%cat Test.java
import java.io.*;
import java.security.*;
public class Test {
/**
* Test the permissions
*/
void check(String str, PrintStream out) {
RuntimePermission r = new RuntimePermission(str);
try {
AccessController.checkPermission(r);
out.println("Permission granted for = " + r );
} catch (AccessControlException ace) {
out.println("Permission NOT granted for = " + r );
}
}
public void run(String args[], PrintStream log, PrintStream out) {
try {
AccessController.beginPrivileged();
check("System.test", out);
} finally {
AccessController.endPrivileged();
}
}
/**
* The Main method
*/
public static void main(String args[]) {
Test jstest = new Test();
jstest.run(args, System.err, System.out);
}
}
dodda:/home/satyad/Bugs/beta3I2( 271 )%cat test1.jp
keystore "./sjkeystore;
grant {
permission java.lang.RuntimePermission "exit";
permission java.lang.RuntimePermission "System.test";
};
dodda:/home/satyad/Bugs/beta3I2( 269 )%diff test1.jp test2.jp
1c1
< keystore "./sjkeystore;
---
> keystore "./sjkeystore";
dodda:/home/satyad/Bugs/beta3I2( 270 )%cat Test.java
import java.io.*;
import java.security.*;
public class Test {
/**
* Test the permissions
*/
void check(String str, PrintStream out) {
RuntimePermission r = new RuntimePermission(str);
try {
AccessController.checkPermission(r);
out.println("Permission granted for = " + r );
} catch (AccessControlException ace) {
out.println("Permission NOT granted for = " + r );
}
}
public void run(String args[], PrintStream log, PrintStream out) {
try {
AccessController.beginPrivileged();
check("System.test", out);
} finally {
AccessController.endPrivileged();
}
}
/**
* The Main method
*/
public static void main(String args[]) {
Test jstest = new Test();
jstest.run(args, System.err, System.out);
}
}
dodda:/home/satyad/Bugs/beta3I2( 271 )%cat test1.jp
keystore "./sjkeystore;
grant {
permission java.lang.RuntimePermission "exit";
permission java.lang.RuntimePermission "System.test";
};
show the syntax errors and silently discards the policy file.
This will be very confusing for the user. Instead, it should give
syntax errors to the user.
Here is a way to reproduce the problem:
dodda:/home/satyad/Bugs/beta3I2( 267 )%!257
java -new -usepolicy:=test1.jp Test
Permission NOT granted for = (java.lang.RuntimePermission System.test )
dodda:/home/satyad/Bugs/beta3I2( 268 )%!258
java -new -usepolicy:=test2.jp Test
Permission granted for = (java.lang.RuntimePermission System.test )
dodda:/home/satyad/Bugs/beta3I2( 270 )%cat Test.java
import java.io.*;
import java.security.*;
public class Test {
/**
* Test the permissions
*/
void check(String str, PrintStream out) {
RuntimePermission r = new RuntimePermission(str);
try {
AccessController.checkPermission(r);
out.println("Permission granted for = " + r );
} catch (AccessControlException ace) {
out.println("Permission NOT granted for = " + r );
}
}
public void run(String args[], PrintStream log, PrintStream out) {
try {
AccessController.beginPrivileged();
check("System.test", out);
} finally {
AccessController.endPrivileged();
}
}
/**
* The Main method
*/
public static void main(String args[]) {
Test jstest = new Test();
jstest.run(args, System.err, System.out);
}
}
dodda:/home/satyad/Bugs/beta3I2( 271 )%cat test1.jp
keystore "./sjkeystore;
grant {
permission java.lang.RuntimePermission "exit";
permission java.lang.RuntimePermission "System.test";
};
dodda:/home/satyad/Bugs/beta3I2( 269 )%diff test1.jp test2.jp
1c1
< keystore "./sjkeystore;
---
> keystore "./sjkeystore";
dodda:/home/satyad/Bugs/beta3I2( 270 )%cat Test.java
import java.io.*;
import java.security.*;
public class Test {
/**
* Test the permissions
*/
void check(String str, PrintStream out) {
RuntimePermission r = new RuntimePermission(str);
try {
AccessController.checkPermission(r);
out.println("Permission granted for = " + r );
} catch (AccessControlException ace) {
out.println("Permission NOT granted for = " + r );
}
}
public void run(String args[], PrintStream log, PrintStream out) {
try {
AccessController.beginPrivileged();
check("System.test", out);
} finally {
AccessController.endPrivileged();
}
}
/**
* The Main method
*/
public static void main(String args[]) {
Test jstest = new Test();
jstest.run(args, System.err, System.out);
}
}
dodda:/home/satyad/Bugs/beta3I2( 271 )%cat test1.jp
keystore "./sjkeystore;
grant {
permission java.lang.RuntimePermission "exit";
permission java.lang.RuntimePermission "System.test";
};