]> granicus.if.org Git - apache/commitdiff
Merge r1406493, r1406495 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 17 Dec 2012 11:49:56 +0000 (11:49 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 17 Dec 2012 11:49:56 +0000 (11:49 +0000)
Make <If> sections in virtual host context fill in cmd->path so that
other directive notice that they are in a config section.

This fixes LogLevel not working in <If> sections that are not in
Location/Directory/File sections.

Make ap_check_cmd_context() treat <If> sections like <File> sections.
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.

Submitted by: sf
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1422877 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
include/http_config.h
server/core.c

diff --git a/CHANGES b/CHANGES
index a1be9216c0f59aa08ac91934e566ce362fdd12eb..40e0228971756c409deb6a4545fdc0fc65ef45bd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,14 @@
 
 Changes with Apache 2.4.4
 
+  *) 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.
+     [Stefan Fritsch]
   *) mod_xml2enc: Fix problems with charset conversion altering the
      Content-Length. [Micha Lenk <micha lenk info>]
 
diff --git a/STATUS b/STATUS
index 7520105a4a4dee5880c76f6ab56647b57e6dfc95..8db7d7b79b87ce2d27119b7fa3adb1df5b51da58 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -91,22 +91,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * <If>:
-     - Make <If> sections in virtual host context fill in cmd->path so that
-       other directive notice that they are in a config section.
-       Fixes 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.
-     - Make ap_check_cmd_context() treat <If> sections like <File> sections.
-       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.
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1406493
-                  http://svn.apache.org/viewvc?view=revision&revision=1406495
-     2.4.x patch: Trunk patchs work.
-     +1: rjung, sf, jim
-
    * mod_cache: Install cache_common.h as required by mod_cache.h. Allows
      external modules to use mod_cache.
      trunk patch: http://svn.apache.org/viewvc?rev=1422855&view=rev
index 617ab2a682b74f320e6d6298bbb25de27854b75a..7ee3760d987f6fa03660b5e4e7bc1ca65cefc062 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 a09c8a05cb2ab7bb8ae66cd4957048a86fc2f9cb..c94bc3eb620148ddf7209c948c43e18952629b5a 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);
@@ -2354,7 +2357,11 @@ static const char *ifsection(cmd_parms *cmd, void *mconfig, const char *arg)
 
     arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
 
-
+    /*
+     * Set a dummy value so that other directives notice that they are inside
+     * a config section.
+     */
+    cmd->path = "*If";
     /* Only if not an .htaccess file */
     if (!old_path) {
         cmd->override = OR_ALL|ACCESS_CONF;