remm 2002/09/18 06:54:33
Modified: catalina/src/share/org/apache/naming/resources
FileDirContext.java
Log:
- Case sensitivity check will always be made, based on the value of the flag,
regardless of this OS.
- Add a flag to allow sym linking.
- I'll wait to port the patch to 5.0 based on the feedback.
Revision Changes Path
1.14 +31 -7
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/FileDirContext.java
Index: FileDirContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/FileDirContext.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FileDirContext.java 17 Mar 2002 00:03:13 -0000 1.13
+++ FileDirContext.java 18 Sep 2002 13:54:33 -0000 1.14
@@ -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 (caseSensitive) {
String fileAbsPath = file.getAbsolutePath();
if (fileAbsPath.endsWith("."))
fileAbsPath = fileAbsPath + "/";
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>