Return-Path: Delivered-To: apmail-sling-commits-archive@www.apache.org Received: (qmail 8428 invoked from network); 30 Apr 2010 07:36:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Apr 2010 07:36:35 -0000 Received: (qmail 2028 invoked by uid 500); 30 Apr 2010 07:36:35 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 1974 invoked by uid 500); 30 Apr 2010 07:36:35 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 1967 invoked by uid 99); 30 Apr 2010 07:36:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Apr 2010 07:36:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Apr 2010 07:36:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3E6B823889B3; Fri, 30 Apr 2010 07:35:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r939572 - in /sling/trunk/bundles/servlets/resolver/src/main: java/org/apache/sling/servlets/resolver/internal/ java/org/apache/sling/servlets/resolver/internal/helper/ resources/OSGI-INF/metatype/ Date: Fri, 30 Apr 2010 07:35:41 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100430073541.3E6B823889B3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Fri Apr 30 07:35:40 2010 New Revision: 939572 URL: http://svn.apache.org/viewvc?rev=939572&view=rev Log: Allow exact path matches Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java?rev=939572&r1=939571&r2=939572&view=diff ============================================================================== --- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java (original) +++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java Fri Apr 30 07:35:40 2010 @@ -875,9 +875,6 @@ public class SlingServletResolver implem if ( path == null || path.length() == 0 || path.equals("/") ) { hasRoot = true; } - if ( !path.endsWith("/") ) { - this.executionPaths[i] = path + '/'; - } } if ( hasRoot ) { this.executionPaths = null; Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java?rev=939572&r1=939571&r2=939572&view=diff ============================================================================== --- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java (original) +++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java Fri Apr 30 07:35:40 2010 @@ -179,12 +179,19 @@ public abstract class AbstractResourceCo return isPathAllowed(path, this.executionPaths); } + /** + * This method checks whether a path is allowed to be executed. + */ public static boolean isPathAllowed(final String path, final String[] executionPaths) { if ( executionPaths == null ) { return true; } - for(final String prefix : executionPaths ) { - if ( path.startsWith(prefix) ) { + for(final String config : executionPaths ) { + if ( config.endsWith("/") ) { + if ( path.startsWith(config) ) { + return true; + } + } else if ( path.equals(config) ) { return true; } } Modified: sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=939572&r1=939571&r2=939572&view=diff ============================================================================== --- sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties (original) +++ sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties Fri Apr 30 07:35:40 2010 @@ -64,4 +64,5 @@ servletresolver.useDefaultWorkspace.desc servletresolver.paths.name = Execution Paths servletresolver.paths.description = The paths to search for executable scripts. If no path is configured \ this is treated like the default (/ = root) which allows to execute all scripts. By configuring some \ - path prefixes the execution of scripts can be limited to some sub trees. \ No newline at end of file + paths the execution of scripts can be limited. If a configured value ends with a slash, the whole sub tree \ + is allowed. Without a slash an exact matching script is allowed. \ No newline at end of file