Last straw - AccessControlException problem

2001-11-14 Thread Antony Bowesman

Hi,

I'm getting an AccessControlException when trying to read the file
H:\Apache\jakarta-tomcat-4.0\bin\user.txt

Top part of stack trace is

java.security.AccessControlException: access denied
(java.io.FilePermission user.txt read)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at
java.security.AccessController.checkPermission(AccessController.java:399)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkRead(SecurityManager.java:890)
at java.io.FileInputStream.init(FileInputStream.java:61)
at java.io.FileReader.init(FileReader.java:38)
at
com.teamware.phoenix.security.auth.spi.TestLoginModule.login(Unknown
Source)
at
com.teamware.phoenix.security.auth.spi.ProxyLoginModule.login(ProxyLoginModule.java:152)

My ProxyLoginModule is in file:${catalina.home}/bin/jaasproxylogin.jar
and catalina.policy has the following grant entry

grant codeBase file:${catalina.home}/bin/jaasproxylogin.jar {
   permission java.lang.RuntimePermission getClassLoader;
   permission java.util.PropertyPermission log4j.configuration,
read;
   permission java.util.PropertyPermission log4j.configDebug,
read;
   permission java.util.PropertyPermission user.dir, read;
   permission java.util.FilePermission
H:\\Apache\\jakarta-tomcat-4.0\\bin\\user.txt, read;
   permission java.util.FilePermission user.txt, read;
};

The code does

  String fileName = user.txt; 
  File f = new File(fileName);
  System.out.println(Path= + f.getAbsolutePath());
  BufferedReader br = new BufferedReader(new FileReader(fileName));

The output is

Path=H:\Apache\jakarta-tomcat-4.0\bin\user.txt

If I remove the PropertyPermission for user.dir I get an ACE on the
getAbsolutePath() call, this shows it is taking the grant entry.  Can
anyone see what's wrong with the grant entry.  I've tried the same with
no codebase and it does not work.  I've tried 

   permission java.util.FilePermission ALL FILES, read;

still doesn't work.

I'm running 4.0 on WinXP.

Antony


-- 
Antony Bowesman
Teamware Group 
[EMAIL PROTECTED]
phone: +358 9 5128 2562
fax  : +358 9 5128 2705

intra / extra / Internet solutions at www.teamware.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Last straw - AccessControlException problem

2001-11-14 Thread Antony Bowesman

Aargh,

Problem solved, I had java.util.FilePermission in my policy not
java.io.FilePermission...  Can't see the wood for the trees.

Antony

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]