]> granicus.if.org Git - apache/commitdiff
Make ap_check_cmd_context() treat <If> sections like <File> sections.
authorStefan Fritsch <sf@apache.org>
Wed, 7 Nov 2012 08:33:05 +0000 (08:33 +0000)
committerStefan Fritsch <sf@apache.org>
Wed, 7 Nov 2012 08:33:05 +0000 (08:33 +0000)
This is necessary to properly disallow directives that don't work in
<If>.

A separate NOT_IN_IF flag may be nicer, but would create much more
hassle when being backported to 2.4.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1406495 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/http_config.h
server/core.c

diff --git a/CHANGES b/CHANGES
index ba2aef91a0a604712b2f964d02efd145cf65f75e..e52da26a06c13bb7fe9163643ecfbc701052dc2d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) Be more correct about rejecting directives that cannot work in <If>
+     sections. [Stefan Fritsch]
+
   *) core: Fix directives like LogLevel that need to know if they are invoked
      at virtual host context or in Directory/Files/Location/If sections to
      work properly in If sections that are not in a Directory/Files/Location.
index 9d6b013b5ea521ad20b690162cdd6eab76ca7376..52dce724025dba8513b734d6a07db1b34c958595 100644 (file)
@@ -901,11 +901,11 @@ AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd,
 #define  NOT_IN_LIMIT           0x02 /**< Forbidden in &lt;Limit&gt; */
 #define  NOT_IN_DIRECTORY       0x04 /**< Forbidden in &lt;Directory&gt; */
 #define  NOT_IN_LOCATION        0x08 /**< Forbidden in &lt;Location&gt; */
-#define  NOT_IN_FILES           0x10 /**< Forbidden in &lt;Files&gt; */
+#define  NOT_IN_FILES           0x10 /**< Forbidden in &lt;Files&gt; or &lt;If&gt;*/
 #define  NOT_IN_HTACCESS        0x20 /**< Forbidden in .htaccess files */
-/** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;*/
+/** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;&lt;If&gt;*/
 #define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES)
-/** Forbidden in &lt;VirtualHost&gt;/&lt;Limit&gt;/&lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt; */
+/** Forbidden in &lt;VirtualHost&gt;/&lt;Limit&gt;/&lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;/&lt;If&gt; */
 #define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
 
 /** @} */
index 818ddbfb518cc73826a8142176fce1d7d7725eb7..bbaadd7d77830049c62180f55c7e49590f414d56 100644 (file)
@@ -1144,7 +1144,10 @@ AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd,
                 || (found = find_parent(cmd->directive, "<LocationMatch"))))
         || ((forbidden & NOT_IN_FILES)
             && ((found = find_parent(cmd->directive, "<Files"))
-                || (found = find_parent(cmd->directive, "<FilesMatch"))))) {
+                || (found = find_parent(cmd->directive, "<FilesMatch"))
+                || (found = find_parent(cmd->directive, "<If"))
+                || (found = find_parent(cmd->directive, "<ElseIf"))
+                || (found = find_parent(cmd->directive, "<Else"))))) {
         return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
                            " cannot occur within ", found->directive,
                            "> section", NULL);