From 093bd929736edf2d9023a95f02f34a9ddccc3546 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Sun, 14 Mar 2004 16:24:55 +0000 Subject: [PATCH] Satisfy directives now can be influenced by a surrounding container. PR: 14726. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102954 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ include/http_core.h | 2 +- server/core.c | 26 ++++++++++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index c5b88b0aa6..20180618d4 100644 --- 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 + container. PR 14726. [André Malo] + *) htpasswd: use apr_temp_dir_get() and general cleanup [Guenter Knauf , Thom May] diff --git a/include/http_core.h b/include/http_core.h index 2aa81e52c7..2d068764de 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -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; diff --git a/server/core.c b/server/core.c index b62586265c..70d5f66904 100644 --- a/server/core.c +++ b/server/core.c @@ -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; } -- 2.50.1