Author: markt
Date: Fri Mar 11 18:40:13 2011
New Revision: 1080719
URL: http://svn.apache.org/viewvc?rev=1080719&view=rev
Log:
Don't unpack WAR files if they are not located in the Host's appBase.
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1080719&r1=1080718&r2=1080719&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Mar 11
18:40:13 2011
@@ -672,12 +672,6 @@ public class ContextConfig
Host host = (Host) context.getParent();
String appBase = host.getAppBase();
- boolean unpackWARs = true;
- if (host instanceof StandardHost) {
- unpackWARs = ((StandardHost) host).isUnpackWARs()
- && ((StandardContext) context).getUnpackWAR();
- }
-
File canonicalAppBase = new File(appBase);
if (canonicalAppBase.isAbsolute()) {
canonicalAppBase = canonicalAppBase.getCanonicalFile();
@@ -711,6 +705,13 @@ public class ContextConfig
context.getWebappVersion());
String pathName = cn.getBaseName();
+ boolean unpackWARs = true;
+ if (host instanceof StandardHost) {
+ unpackWARs = ((StandardHost) host).isUnpackWARs() &&
+ ((StandardContext) context).getUnpackWAR() &&
+ (docBase.startsWith(canonicalAppBase.getPath()));
+ }
+
if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") &&
!file.isDirectory() && unpackWARs) {
URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() +
"!/");
docBase = ExpandWar.expand(host, war, pathName);
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1080719&r1=1080718&r2=1080719&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Mar 11 18:40:13 2011
@@ -50,6 +50,10 @@
inside server.xml and log a warning that the configuration has been
corrected. (markt)
</add>
+ <fix>
+ Don't unpack WAR files if they are not located in the Host's
+ appBase. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]