Author: markt
Date: Thu May 15 12:57:09 2008
New Revision: 656815

URL: http://svn.apache.org/viewvc?rev=656815&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=43079
Patch by John Kewl
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=43080
Move odd url-pattern warning to StandardContext so a) we catch all patterns and 
b) it isn't logged to the wrong webapp

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/SecurityCollection.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=656815&r1=656814&r2=656815&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May 15 12:57:09 2008
@@ -51,15 +51,6 @@
   +1: jfclere, rjung, fhanik, remm, pero
   -1:
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=43079
-  and https://issues.apache.org/bugzilla/show_bug.cgi?id=43080
-  http://svn.apache.org/viewvc?rev=653195&view=rev
-  Move odd url-pattern warning to StandardContext so a) we catch all patterns
-  and b) it isn't logged to the wrong webapp
-  Based on a patch by John Kewl
-  +1: markt, remm, billbarker
-  -1: 
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44021
   and https://issues.apache.org/bugzilla/show_bug.cgi?id=43013
   Add support for # to signify multi-level contexts for directories and

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=656815&r1=656814&r2=656815&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Thu 
May 15 12:57:09 2008
@@ -5076,20 +5076,38 @@
             return (false);
         }
         if (urlPattern.startsWith("*.")) {
-            if (urlPattern.indexOf('/') < 0)
+            if (urlPattern.indexOf('/') < 0) {
+                checkUnusualURLPattern(urlPattern);
                 return (true);
-            else
+            } else
                 return (false);
         }
         if ( (urlPattern.startsWith("/")) &&
-                (urlPattern.indexOf("*.") < 0))
+                (urlPattern.indexOf("*.") < 0)) {
+            checkUnusualURLPattern(urlPattern);
             return (true);
-        else
+        } else
             return (false);
 
     }
 
 
+    /**
+     * Check for unusual but valid <code>&lt;url-pattern&gt;</code>s.
+     * See Bugzilla 34805, 43079 & 43080
+     */
+    private void checkUnusualURLPattern(String urlPattern) {
+        if (log.isInfoEnabled()) {
+            if(urlPattern.endsWith("*") && (urlPattern.length() < 2 ||
+                    urlPattern.charAt(urlPattern.length()-2) != '/')) {
+                log.info("Suspicious url pattern: \"" + urlPattern + "\"" +
+                        " in context [" + getName() + "] - see" +
+                        " section SRV.11.2 of the Servlet specification" );
+            }
+        }
+    }
+
+
     // ------------------------------------------------------------- Operations
 
 

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/SecurityCollection.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/SecurityCollection.java?rev=656815&r1=656814&r2=656815&view=diff
==============================================================================
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/SecurityCollection.java 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/SecurityCollection.java 
Thu May 15 12:57:09 2008
@@ -21,9 +21,6 @@
 
 import org.apache.catalina.util.RequestUtil;
 
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-
 import java.io.Serializable;
 
 
@@ -44,9 +41,6 @@
 
 public class SecurityCollection implements Serializable {
 
-    private static Log log = LogFactory.getLog(SecurityCollection.class);
-
-
     // ----------------------------------------------------------- Constructors
 
 
@@ -188,17 +182,6 @@
         if (pattern == null)
             return;
 
-        // Bugzilla 34805: add friendly warning.
-        if(pattern.endsWith("*")) {
-          if (pattern.charAt(pattern.length()-1) != '/') {
-            if (log.isDebugEnabled()) {
-              log.warn("Suspicious url pattern: \"" + pattern + "\"" +
-                       " - see 
http://java.sun.com/aboutJava/communityprocess/first/jsr053/servlet23_PFD.pdf"; +
-                       "  section 11.2" );
-            }
-          }
-        }
-
         pattern = RequestUtil.URLDecode(pattern);
         String results[] = new String[patterns.length + 1];
         for (int i = 0; i < patterns.length; i++) {

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=656815&r1=656814&r2=656815&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu May 15 12:57:09 2008
@@ -47,6 +47,14 @@
         using the webapp class loader when we create them. (markt)
       </fix>
       <fix>
+        <bug>43079</bug>: Fix identification of suspicious URL patterns. Patch
+        provided by John Kew. (markt)
+      </fix>
+      <fix>
+        <bug>43080</bug>: Log suspicious URL patterns to the correct web app.
+        (markt)
+      </fix>
+      <fix>
         <bug>43117</bug>: Setting an empty workDir could result in all of
         CATALINA_HOME being deleted. Patch provided by Takayuki Kaneko. (markt)
       </fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to