]> granicus.if.org Git - apache/commitdiff
Forbid some directives in .htaccess because of AllowOverrideList:
authorStefan Fritsch <sf@apache.org>
Wed, 3 Aug 2011 22:10:27 +0000 (22:10 +0000)
committerStefan Fritsch <sf@apache.org>
Wed, 3 Aug 2011 22:10:27 +0000 (22:10 +0000)
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

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

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

index e868363dd68fe5925cc521ab7d4bf49d7bdb056c..75db852700e7491794309a35ec4771a908a765b1 100644 (file)
@@ -64,6 +64,9 @@ static const char *authn_dbd_prepare(cmd_parms *cmd, void *cfg, const char *quer
 {
     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);
index 40de423a9a703ef4b2ba1cf414edea439684135a..b3ae99c9101b17b1d827b9e772079cf18c0cdc92 100644 (file)
@@ -78,6 +78,9 @@ static const char *authz_dbd_prepare(cmd_parms *cmd, void *cfg,
 {
     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);
index 9d9faaac197a687d6fcf2c7ab4ff47bd75a95a65..1c44879f0dcbdd8d52fbc4b5a5d920b2277a194e 100644 (file)
@@ -111,11 +111,17 @@ static const char *set_script(cmd_parms *cmd, void *m_v,
                               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";
index d6ea2b73f8f05087d01936626fe3c21153aa86a2..52c3ee7ae0be72f4045375bd48cfcba2077b2804 100644 (file)
@@ -1860,7 +1860,10 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
     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,
index d11bbe60653192a72aff2519bb020661ca55fc92..14b401b587910f8d0980af9777b2adaaf7ac83b5 100644 (file)
@@ -1570,6 +1570,7 @@ static const char *set_override(cmd_parms *cmd, void *d_, const char *l)
     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_parms *cmd, void *d_, const char *l)
                      "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_parms *cmd, void *d_, int argc, char *c
 {
     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_parms *cmd, void *d_, int argc, char *c
                      "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);