]> granicus.if.org Git - apache/commitdiff
Satisfy directives now can be influenced by a surrounding <Limit>
authorAndré Malo <nd@apache.org>
Sun, 14 Mar 2004 16:24:55 +0000 (16:24 +0000)
committerAndré Malo <nd@apache.org>
Sun, 14 Mar 2004 16:24:55 +0000 (16:24 +0000)
container.

PR: 14726.

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

CHANGES
include/http_core.h
server/core.c

diff --git a/CHANGES b/CHANGES
index c5b88b0aa63e931d9aff75a83e6b6667b849ed1d..20180618d4969d05898319c061d12691033c711c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Satisfy directives now can be influenced by a surrounding <Limit>
+     container.  PR 14726.  [André Malo]
+
   *) htpasswd: use apr_temp_dir_get() and general cleanup
      [Guenter Knauf <eflash gmx.net>, Thom May]
 
index 2aa81e52c72773a97cce1fd7d91728f5378736d0..2d068764deb68f2495512e9c92c96bcc5750c257 100644 (file)
@@ -415,7 +415,7 @@ typedef struct {
   
     /* Authentication stuff.  Groan... */
     
-    int satisfy;
+    int *satisfy; /* for every method one */
     char *ap_auth_type;
     char *ap_auth_name;
     apr_array_header_t *ap_requires;
index b62586265c47bcbe5ec6a2115decc5bc9882223e..70d5f669049838fb727267935b4721c086de3ef4 100644 (file)
@@ -85,6 +85,7 @@ AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
 static void *create_core_dir_config(apr_pool_t *a, char *dir)
 {
     core_dir_config *conf;
+    int i;
 
     conf = (core_dir_config *)apr_pcalloc(a, sizeof(core_dir_config));
 
@@ -100,7 +101,10 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir)
     conf->use_canonical_name = USE_CANONICAL_NAME_UNSET;
 
     conf->hostname_lookups = HOSTNAME_LOOKUP_UNSET;
-    conf->satisfy = SATISFY_NOSPEC;
+    conf->satisfy = apr_palloc(a, sizeof(*conf->satisfy) * METHODS);
+    for (i = 0; i < METHODS; ++i) {
+        conf->satisfy[i] = SATISFY_NOSPEC;
+    }
 
 #ifdef RLIMIT_CPU
     conf->limit_cpu = NULL;
@@ -329,8 +333,10 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
     /* Otherwise we simply use the base->sec_file array
      */
 
-    if (new->satisfy != SATISFY_NOSPEC) {
-        conf->satisfy = new->satisfy;
+    for (i = 0; i < METHODS; ++i) {
+        if (new->satisfy[i] != SATISFY_NOSPEC) {
+            conf->satisfy[i] = new->satisfy[i];
+        }
     }
 
     if (new->server_signature != srv_sig_unset) {
@@ -662,7 +668,7 @@ AP_DECLARE(int) ap_satisfies(request_rec *r)
     conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
                                                    &core_module);
 
-    return conf->satisfy;
+    return conf->satisfy[r->method_number];
 }
 
 /* Should probably just get rid of this... the only code that cares is
@@ -1479,17 +1485,25 @@ static const char *set_enable_sendfile(cmd_parms *cmd, void *d_,
 static const char *satisfy(cmd_parms *cmd, void *c_, const char *arg)
 {
     core_dir_config *c = c_;
+    int satisfy = SATISFY_NOSPEC;
+    int i;
 
     if (!strcasecmp(arg, "all")) {
-        c->satisfy = SATISFY_ALL;
+        satisfy = SATISFY_ALL;
     }
     else if (!strcasecmp(arg, "any")) {
-        c->satisfy = SATISFY_ANY;
+        satisfy = SATISFY_ANY;
     }
     else {
         return "Satisfy either 'any' or 'all'.";
     }
 
+    for (i = 0; i < METHODS; ++i) {
+        if (cmd->limited & (AP_METHOD_BIT << i)) {
+            c->satisfy[i] = satisfy;
+        }
+    }
+
     return NULL;
 }