You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/08/03 23:36:20 UTC

svn commit: r1153676 - in /httpd/httpd/trunk: CHANGES docs/manual/developer/new_api_2_4.html.en docs/manual/developer/new_api_2_4.xml include/ap_mmn.h include/http_config.h server/core.c

Author: sf
Date: Wed Aug  3 21:36:18 2011
New Revision: 1153676

URL: http://svn.apache.org/viewvc?rev=1153676&view=rev
Log:
cleanups related to new AllowOverrideList functionality:
- add new NOT_IN_HTACCESS flag for ap_check_cmd_context() 
- describe the need for this in new_api_2_4.xml
- forbid Define and UnDefine in .htaccess

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/developer/new_api_2_4.html.en
    httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_config.h
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1153676&r1=1153675&r2=1153676&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Aug  3 21:36:18 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.15
 
+  *) core: Add ap_check_cmd_context()-check if a command is executed in
+     .htaccess file. [Stefan Fritsch]
+
   *) mod_deflate: Fix endless loop if first bucket is metadata. PR 51590.
      [Torsten Foertsch <torsten foertsch gmx net>]
 

Modified: httpd/httpd/trunk/docs/manual/developer/new_api_2_4.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/new_api_2_4.html.en?rev=1153676&r1=1153675&r2=1153676&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/new_api_2_4.html.en (original)
+++ httpd/httpd/trunk/docs/manual/developer/new_api_2_4.html.en Wed Aug  3 21:36:18 2011
@@ -111,6 +111,11 @@
       <li>New ap_process_fnmatch_configs() to process wildcards</li>
       <li>Change ap_configfile_t, ap_cfg_getline(), ap_cfg_getc() to return error
           code, new ap_pcfg_strerror().</li>
+      <li>Any config directive permitted in ACCESS_CONF context must now
+          correctly handle being called from an .htaccess file via the new
+          <code class="directive"><a href="../mod/core.html#allowoverridelist">AllowOverrideList</a></code> directive.
+          ap_check_cmd_context() accepts a new flag NOT_IN_HTACCESS to detect
+          this case.</li>
     </ul>
   
 

Modified: httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml?rev=1153676&r1=1153675&r2=1153676&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml (original)
+++ httpd/httpd/trunk/docs/manual/developer/new_api_2_4.xml Wed Aug  3 21:36:18 2011
@@ -111,6 +111,11 @@
       <li>New ap_process_fnmatch_configs() to process wildcards</li>
       <li>Change ap_configfile_t, ap_cfg_getline(), ap_cfg_getc() to return error
           code, new ap_pcfg_strerror().</li>
+      <li>Any config directive permitted in ACCESS_CONF context must now
+          correctly handle being called from an .htaccess file via the new
+          <directive module="core">AllowOverrideList</directive> directive.
+          ap_check_cmd_context() accepts a new flag NOT_IN_HTACCESS to detect
+          this case.</li>
     </ul>
   </section>
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1153676&r1=1153675&r2=1153676&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed Aug  3 21:36:18 2011
@@ -345,6 +345,7 @@
  * 20110724.0 (2.3.14-dev) Add override_list as parameter to ap_parse_htaccess
  *                         Add member override_list to cmd_parms_struct,
  *                         core_dir_config and htaccess_result
+ * 20110724.1 (2.3.15-dev) add NOT_IN_HTACCESS
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -352,7 +353,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20110724
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 0                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 1                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/http_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_config.h?rev=1153676&r1=1153675&r2=1153676&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_config.h (original)
+++ httpd/httpd/trunk/include/http_config.h Wed Aug  3 21:36:18 2011
@@ -881,6 +881,7 @@ AP_DECLARE(const char *) ap_check_cmd_co
 #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_HTACCESS        0x20 /**< Forbidden in .htaccess files */
 /** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&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; */

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1153676&r1=1153675&r2=1153676&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Aug  3 21:36:18 2011
@@ -1104,6 +1104,11 @@ AP_DECLARE(const char *) ap_check_cmd_co
                            "section", NULL);
     }
 
+    if ((forbidden & NOT_IN_HTACCESS) && (cmd->pool == cmd->temp_pool)) {
+         return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
+                            " cannot occur within htaccess files", NULL);
+    }
+
     if ((forbidden & NOT_IN_DIR_LOC_FILE) == NOT_IN_DIR_LOC_FILE) {
         if (cmd->path != NULL) {
             return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
@@ -1268,6 +1273,9 @@ static void init_config_defines(apr_pool
 static const char *set_define(cmd_parms *cmd, void *dummy,
                               const char *name, const char *value)
 {
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
+    if (err)
+        return err;
     if (ap_strchr_c(name, ':') != NULL)
         return "Variable name must not contain ':'";
 
@@ -1291,6 +1299,9 @@ static const char *unset_define(cmd_parm
 {
     int i;
     char **defines;
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
+    if (err)
+        return err;
     if (ap_strchr_c(name, ':') != NULL)
         return "Variable name must not contain ':'";