diff options
author | Eric Covener <covener@apache.org> | 2018-08-14 23:47:22 +0200 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2018-08-14 23:47:22 +0200 |
commit | 19e9326dbf9fc6b54245d22df5cddf074b4dcdbf (patch) | |
tree | 74343454c2e8009b0a8b28ae24309d25ca934ea1 /server/core.c | |
parent | don't use workaround on trunk (diff) | |
download | apache2-19e9326dbf9fc6b54245d22df5cddf074b4dcdbf.tar.xz apache2-19e9326dbf9fc6b54245d22df5cddf074b4dcdbf.zip |
Add StrictHostCheck
.. to allow ucnonfigured hostnames to be rejected.
The checks happen during NVH mapping and checks that the
mapped VH itself has the host as a name or alias.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1838055 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/core.c')
-rw-r--r-- | server/core.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/server/core.c b/server/core.c index ffaa647f4b..d3f2d256b9 100644 --- a/server/core.c +++ b/server/core.c @@ -525,6 +525,7 @@ static void *create_core_server_config(apr_pool_t *a, server_rec *s) conf->protocols = apr_array_make(a, 5, sizeof(const char *)); conf->protocols_honor_order = -1; conf->async_filter = 0; + conf->strict_host_check= AP_CORE_CONFIG_UNSET; return (void *)conf; } @@ -620,6 +621,12 @@ static void *merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv) ? virt->flush_max_pipelined : base->flush_max_pipelined; + conf->strict_host_check = (virt->strict_host_check != AP_CORE_CONFIG_UNSET) + ? virt->strict_host_check + : base->strict_host_check; + + AP_CORE_MERGE_FLAG(strict_host_check, conf, base, virt); + return conf; } @@ -1962,7 +1969,12 @@ static const char *set_qualify_redirect_url(cmd_parms *cmd, void *d_, int flag) return NULL; } - +static const char *set_core_server_flag(cmd_parms *cmd, void *s_, int flag) +{ + core_server_config *conf = + ap_get_core_module_config(cmd->server->module_config); + return ap_set_flag_slot(cmd, conf, flag); +} static const char *set_override_list(cmd_parms *cmd, void *d_, int argc, char *const argv[]) { core_dir_config *d = d_; @@ -4816,7 +4828,10 @@ AP_INIT_TAKE2("CGIVar", set_cgi_var, NULL, OR_FILEINFO, AP_INIT_FLAG("QualifyRedirectURL", set_qualify_redirect_url, NULL, OR_FILEINFO, "Controls whether the REDIRECT_URL environment variable is fully " "qualified"), - +AP_INIT_FLAG("StrictHostCheck", set_core_server_flag, + (void *)APR_OFFSETOF(core_server_config, strict_host_check), + RSRC_CONF, + "Controls whether a hostname match is required"), AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower, (void *)APR_OFFSETOF(core_dir_config, mime_type), OR_FILEINFO, "a mime type that overrides other configured type"), @@ -5891,4 +5906,3 @@ AP_DECLARE_MODULE(core) = { core_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; - |