You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by gl...@apache.org on 2001/04/25 06:15:39 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources DirContextURLConnection.java

glenn       01/04/24 21:15:39

  Modified:    catalina/src/share/org/apache/naming/resources
                        DirContextURLConnection.java
  Log:
  Java SecurityManager implementation changes
  -------------------------------------------
  
  Changed the naming convention for JNDI DirContextURL to
  "jndi:/hostname/webappname/" and "jar:jndi:/hostname/webappname/...".
  This works better with java.io.FilePermission.
  
  Modified how permissions are granted to the codeBase for a
  web application so that different permissions can be granted.
  Permissions assigned to the root of a web application apply
  to JSP pages.  Different permissions can be assigned to the
  /WEB-INF/classes/ directory, the /WEB-INF/lib/ directory,
  or even to individual jar files in /WEB-INF/lib/.  This allows
  much finer control of permissions granted within a web
  application.
  
  Fixed Jasper so that it uses the correct codeBase for a
  web application, it had been using the work dir instead
  of the context dir for getting permissions from the
  policy file.
  
  Added more default read FilePermissions for classes
  loaded from within a web application so that getResources()
  works. Added:
  
  "jndi:/hostname/webappname/-"
  "jar:jndi:/hostname/webappname/WEB-INF/lib/-"
  "file:/realcontextpath/-"
  
  Revision  Changes    Path
  1.7       +7 -6      jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java
  
  Index: DirContextURLConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DirContextURLConnection.java	2001/04/06 19:31:59	1.6
  +++ DirContextURLConnection.java	2001/04/25 04:15:38	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v 1.6 2001/04/06 19:31:59 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/04/06 19:31:59 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v 1.7 2001/04/25 04:15:38 glenn Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/04/25 04:15:38 $
    *
    * ====================================================================
    *
  @@ -91,7 +91,7 @@
    * content is directly returned.
    * 
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class DirContextURLConnection 
       extends URLConnection {
  @@ -179,11 +179,12 @@
                       String hostName = proxyDirContext.getHostName();
                       String contextName = proxyDirContext.getContextName();
                       if (hostName != null) {
  -                        if (!url.getHost().equalsIgnoreCase(hostName))
  +                        if (!path.startsWith("/" + hostName + "/"))
                               return;
  +                        path = path.substring(hostName.length()+ 1);
                       }
                       if (contextName != null) {
  -                        if (!path.startsWith(contextName)) {
  +                        if (!path.startsWith(contextName + "/")) {
                               return;
                           } else {
                               path = path.substring(contextName.length());