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/04 00:10:29 UTC

svn commit: r1153687 - in /httpd/httpd/trunk: modules/aaa/mod_authn_dbd.c modules/aaa/mod_authz_dbd.c modules/mappers/mod_actions.c modules/proxy/mod_proxy.c server/core.c

Author: sf
Date: Wed Aug  3 22:10:27 2011
New Revision: 1153687

URL: http://svn.apache.org/viewvc?rev=1153687&view=rev
Log:
Forbid some directives in .htaccess because of AllowOverrideList:

core:          AllowOverride, AllowOverrideList
mod_authn_dbd: AuthDBDUserPWQuery, AuthDBDUserRealmQuery
mod_authz_dbd: AuthzDBDQuery, AuthzDBDRedirectQuery
mod_proxy:     BalancerMember, ProxySet

Adjust for use in .htaccess:
mod_actions:   Script

Modified:
    httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c
    httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c
    httpd/httpd/trunk/modules/mappers/mod_actions.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c?rev=1153687&r1=1153686&r2=1153687&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authn_dbd.c Wed Aug  3 22:10:27 2011
@@ -64,6 +64,9 @@ static const char *authn_dbd_prepare(cmd
 {
     static unsigned int label_num = 0;
     char *label;
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
+    if (err)
+        return err;
 
     if (authn_dbd_prepare_fn == NULL) {
         authn_dbd_prepare_fn = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_prepare);

Modified: httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c?rev=1153687&r1=1153686&r2=1153687&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_authz_dbd.c Wed Aug  3 22:10:27 2011
@@ -78,6 +78,9 @@ static const char *authz_dbd_prepare(cmd
 {
     static unsigned int label_num = 0;
     char *label;
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
+    if (err)
+        return err;
 
     if (dbd_prepare == NULL) {
         dbd_prepare = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_prepare);

Modified: httpd/httpd/trunk/modules/mappers/mod_actions.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_actions.c?rev=1153687&r1=1153686&r2=1153687&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_actions.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_actions.c Wed Aug  3 22:10:27 2011
@@ -111,11 +111,17 @@ static const char *set_script(cmd_parms 
                               const char *method, const char *script)
 {
     action_dir_config *m = (action_dir_config *)m_v;
-
-    /* ap_method_register recognizes already registered methods,
-     * so don't bother to check its previous existence explicitely.
-     */
-    int methnum = ap_method_register(cmd->pool, method);
+    int methnum;
+    if (cmd->pool == cmd->temp_pool) {
+        /* In .htaccess, we can't globally register new methods. */
+        methnum = ap_method_number_of(method);
+    }
+    else {
+        /* ap_method_register recognizes already registered methods,
+         * so don't bother to check its previous existence explicitely.
+         */
+        methnum = ap_method_register(cmd->pool, method);
+    }
 
     if (methnum == M_TRACE) {
         return "TRACE not allowed for Script";

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1153687&r1=1153686&r2=1153687&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Aug  3 22:10:27 2011
@@ -1860,7 +1860,10 @@ static const char *add_member(cmd_parms 
     const apr_table_entry_t *elts;
     int reuse = 0;
     int i;
-    const char *err;
+    /* XXX: Should this be NOT_IN_DIRECTORY|NOT_IN_FILES? */
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
+    if (err)
+        return err;
 
     if (cmd->path)
         path = apr_pstrdup(cmd->pool, cmd->path);
@@ -1949,8 +1952,11 @@ static const char *
     char *word, *val;
     proxy_balancer *balancer = NULL;
     proxy_worker *worker = NULL;
-    const char *err;
     int in_proxy_section = 0;
+    /* XXX: Should this be NOT_IN_DIRECTORY|NOT_IN_FILES? */
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
+    if (err)
+        return err;
 
     if (cmd->directive->parent &&
         strncasecmp(cmd->directive->parent->directive,

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1153687&r1=1153686&r2=1153687&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Aug  3 22:10:27 2011
@@ -1570,6 +1570,7 @@ static const char *set_override(cmd_parm
     core_dir_config *d = d_;
     char *w;
     char *k, *v;
+    const char *err;
 
     /* Throw a warning if we're in <Location> or <Files> */
     if (ap_check_cmd_context(cmd, NOT_IN_LOCATION | NOT_IN_FILES)) {
@@ -1577,6 +1578,8 @@ static const char *set_override(cmd_parm
                      "Useless use of AllowOverride in line %d of %s.",
                      cmd->directive->line_num, cmd->directive->filename);
     }
+    if ((err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS)) != NULL)
+        return err;
 
     d->override = OR_NONE;
     while (l[0]) {
@@ -1627,6 +1630,7 @@ static const char *set_override_list(cmd
 {
     core_dir_config *d = d_;
     int i;
+    const char *err;
 
     /* Throw a warning if we're in <Location> or <Files> */
     if (ap_check_cmd_context(cmd, NOT_IN_LOCATION | NOT_IN_FILES)) {
@@ -1634,6 +1638,8 @@ static const char *set_override_list(cmd
                      "Useless use of AllowOverrideList in line %d of %s.",
                      cmd->directive->line_num, cmd->directive->filename);
     }
+    if ((err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS)) != NULL)
+        return err;
 
     d->override_list = apr_table_make(cmd->pool, 1);