Bug 43117 - Dangerousness of workDir setting on Context
Summary: Dangerousness of workDir setting on Context
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.26
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-14 01:09 UTC by Takayuki Kaneko
Modified: 2008-07-30 13:28 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takayuki Kaneko 2007-08-14 01:09:44 UTC
Hi, I'd like to point out the dangerousness of workDir setting on Context.

If workDir is an empty string, i.e. workDir=AA, then workDir will be set as
CATALINA_HOME.
Therefore if application will be reloaded, then the files in CATALINA_HOME will
be deleted.

I know this problem is caused by wrong configuration, but it is too dangerous,
anyway.

I propose a patch.

Index: /trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- /trunk/java/org/apache/catalina/core/StandardContext.java	(revision 565643)
+++ /trunk/java/org/apache/catalina/core/StandardContext.java	(working copy)
@@ -5006,7 +5006,7 @@
 
         // Acquire (or calculate) the work directory path
         String workDir = getWorkDir();
-        if (workDir == null) {
+        if (workDir == null || workDir.length() == 0) {
 
             // Retrieve our parent (normally a host) name
             String hostName = null;
Comment 1 Mark Thomas 2008-05-03 12:51:49 UTC
Many thanks for the patch. It has been applied to trunk and proposed for 6.0.x and 5.5.x.
Comment 2 Mark Thomas 2008-05-15 12:40:10 UTC
The patch has been applied to 6.0.x and will be in 6.0.17 onwards.
Comment 3 Mark Thomas 2008-07-30 13:28:07 UTC
This has been fixed in 5.5.x and will be included in 5.5.27 onwards.