tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28147] - JasperException for jsp files that are symbolic links
Date Fri, 09 Apr 2004 18:01:25 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28147>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28147

JasperException for jsp files that are symbolic links





------- Additional Comments From rickkw@yahoo.com  2004-04-09 18:01 -------
Hi, 
Please consider patching this.  
Thanks,
Rick
--


Index: JspC.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.69
diff -u -r1.69 JspC.java
--- JspC.java	6 Apr 2004 17:58:59 -0000	1.69
+++ JspC.java	8 Apr 2004 20:39:59 -0000
@@ -830,7 +830,7 @@
             Enumeration e = pages.elements();
             while (e.hasMoreElements()) {
                 String nextjsp = e.nextElement().toString();
-                try {
+                // try {
                     File fjsp = new File(nextjsp);
                     if (!fjsp.exists()) {
                         if (log.isWarnEnabled()) {
@@ -839,14 +839,21 @@
                         }
                         continue;
                     }
-                    String s = fjsp.getCanonicalPath();
+                    // BZ#28147 getCanonicalPath() dereferences symbolic links.
 If the file
+                    //          is a symbolic link to a file in a different
directory, 
+                    //          getCanonicalPath() will cause the following
s.startWith()
+                    //          to fail to match the uriRoot, resulting in
file-not-found
+                    //          error.  Changing to getAbsolutePath() will
allow files that
+                    //          are symbolic links to be found correctly.
+                    // String s = fjsp.getCanonicalPath();
+                    String s = fjsp.getAbsolutePath();
                     //System.out.println("**" + s);
                     if (s.startsWith(uriRoot)) {
                         nextjsp = s.substring(uriRoot.length());
                     }
-                } catch (IOException ioe) {
+                // } catch (IOException ioe) {
                     // if we got problems dont change the file name
-                }
+                // }
 
                 if (nextjsp.startsWith("." + File.separatorChar)) {
                     nextjsp = nextjsp.substring(2);

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message