Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 87776 invoked by uid 500); 18 Aug 2000 17:31:45 -0000 Delivered-To: apmail-jakarta-tomcat-cvs@apache.org Received: (qmail 87772 invoked by uid 1052); 18 Aug 2000 17:31:45 -0000 Date: 18 Aug 2000 17:31:45 -0000 Message-ID: <20000818173145.87771.qmail@locus.apache.org> From: costin@locus.apache.org To: jakarta-tomcat-cvs@apache.org Subject: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup Main.java costin 00/08/18 10:31:45 Modified: src/share/org/apache/tomcat/context PolicyInterceptor.java src/share/org/apache/tomcat/startup Main.java Log: Missing piece in PolicyInterceptor - set the policy file. No longer need to add java options ( -Djava.security.manager and -Djava.security.policy), all you need to do for security is insert the policy interceptr. You can set alternate policy files using normal server.xml ( policyFile attribute of PolicyInterceptor ). That also means "java -jar" makes one step forward ( no need for .sh or .bat files to worry about that ) Revision Changes Path 1.5 +11 -0 jakarta-tomcat/src/share/org/apache/tomcat/context/PolicyInterceptor.java Index: PolicyInterceptor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/PolicyInterceptor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PolicyInterceptor.java 2000/07/11 03:48:40 1.4 +++ PolicyInterceptor.java 2000/08/18 17:31:44 1.5 @@ -101,6 +101,17 @@ public void engineInit(ContextManager cm) throws TomcatException { if( System.getSecurityManager() != null ) return; try { + if( null == System.getProperty("java.security.policy")) { + if( policyFile==null ) { + // XXX ugly API - change CM + File f=cm.getAbsolute(new File("conf/tomcat.policy")); + policyFile=f.getPath(); + } + log("Setting policy file to " + policyFile); + System.setProperty("java.security.policy", + policyFile); + + } Class c=Class.forName(securityManagerClass); Object o=c.newInstance(); System.setSecurityManager((SecurityManager)o); 1.4 +17 -7 jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java Index: Main.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Main.java 2000/08/18 04:51:01 1.3 +++ Main.java 2000/08/18 17:31:44 1.4 @@ -167,15 +167,25 @@ ex.printStackTrace(); } } - + // if( ! path.endsWith("jar")) { + // // it may be a directory - support for /classes + // File f=new File( path ); + // if( f.isDirectory() ) { + // File f2=new File( path, "org/apache/tomcat/startup/Main.class"); + // if( f2.exists() ) { + // int ending="classes".length(); + // if( path.endsWith( "/" ) || path.endsWith("\\")) + // ending++; + // if( path.length() > ending ) { + // h=path.substring(0, path.length() - ending); + // return path; + // } + // } + // } + // } } - return h; - - - - - + return null; }