You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/11/06 11:00:08 UTC

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

remm        2002/11/06 02:00:05

  Modified:    catalina/src/share/org/apache/naming/resources
                        FileDirContext.java
  Log:
  - Port all changes.
  
  Revision  Changes    Path
  1.2       +31 -7     jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/FileDirContext.java
  
  Index: FileDirContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/FileDirContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileDirContext.java	18 Jul 2002 16:47:33 -0000	1.1
  +++ FileDirContext.java	6 Nov 2002 10:00:05 -0000	1.2
  @@ -154,6 +154,12 @@
       protected boolean caseSensitive = true;
   
   
  +    /**
  +     * Allow linking.
  +     */
  +    protected boolean allowLinking = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -208,6 +214,22 @@
       }
   
   
  +    /**
  +     * Set allow linking.
  +     */
  +    public void setAllowLinking(boolean allowLinking) {
  +        this.allowLinking = allowLinking;
  +    }
  +
  +
  +    /**
  +     * Is linking allowed.
  +     */
  +    public boolean getAllowLinking() {
  +        return allowLinking;
  +    }
  +
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -217,6 +239,7 @@
       public void release() {
   
           caseSensitive = true;
  +        allowLinking = false;
           absoluteBase = null;
           base = null;
           super.release();
  @@ -866,12 +889,13 @@
               if (canPath == null)
                   return null;
   
  -            if (!canPath.startsWith(absoluteBase)) {
  +            // Check to see if going outside of the web application root
  +            if ((!allowLinking) && (!canPath.startsWith(absoluteBase))) {
                   return null;
               }
   
  -            // Windows only check
  -            if ((caseSensitive) && (File.separatorChar  == '\\')) {
  +            // Case sensitivity check
  +            if (!allowLinking && caseSensitive) {
                   String fileAbsPath = file.getAbsolutePath();
                   if (fileAbsPath.endsWith("."))
                       fileAbsPath = fileAbsPath + "/";
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>