1ecb24514e
applications whose response headers are malicious or exploitable (CVE-2024-38476) Resolves: RHEL-53022 - Regression introduced by CVE-2024-38474 fix
267 lines
11 KiB
Diff
267 lines
11 KiB
Diff
diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c
|
|
index 965fef5..6df3bf4 100644
|
|
--- a/modules/cluster/mod_heartmonitor.c
|
|
+++ b/modules/cluster/mod_heartmonitor.c
|
|
@@ -782,7 +782,7 @@ static int hm_handler(request_rec *r)
|
|
hmserver.seen = apr_time_now();
|
|
hm_update_stat(ctx, &hmserver, r->pool);
|
|
|
|
- ap_set_content_type(r, "text/plain");
|
|
+ ap_set_content_type_ex(r, "text/plain", 1);
|
|
ap_set_content_length(r, 2);
|
|
ap_rputs("OK", r);
|
|
ap_rflush(r);
|
|
diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c
|
|
index 792b514..28479b9 100644
|
|
--- a/modules/dav/main/mod_dav.c
|
|
+++ b/modules/dav/main/mod_dav.c
|
|
@@ -323,7 +323,7 @@ static int dav_error_response(request_rec *r, int status, const char *body)
|
|
r->status = status;
|
|
r->status_line = ap_get_status_line(status);
|
|
|
|
- ap_set_content_type(r, "text/html; charset=ISO-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/html; charset=ISO-8859-1", 1);
|
|
|
|
/* begin the response now... */
|
|
ap_rvputs(r,
|
|
@@ -354,7 +354,7 @@ static int dav_error_response_tag(request_rec *r,
|
|
{
|
|
r->status = err->status;
|
|
|
|
- ap_set_content_type(r, DAV_XML_CONTENT_TYPE);
|
|
+ ap_set_content_type_ex(r, DAV_XML_CONTENT_TYPE, 1);
|
|
|
|
ap_rputs(DAV_XML_HEADER DEBUG_CR
|
|
"<D:error xmlns:D=\"DAV:\"", r);
|
|
@@ -512,7 +512,7 @@ DAV_DECLARE(void) dav_begin_multistatus(apr_bucket_brigade *bb,
|
|
{
|
|
/* Set the correct status and Content-Type */
|
|
r->status = status;
|
|
- ap_set_content_type(r, DAV_XML_CONTENT_TYPE);
|
|
+ ap_set_content_type_ex(r, DAV_XML_CONTENT_TYPE, 1);
|
|
|
|
/* Send the headers and actual multistatus response now... */
|
|
ap_fputs(r->output_filters, bb, DAV_XML_HEADER DEBUG_CR
|
|
@@ -1923,7 +1923,7 @@ static int dav_method_options(request_rec *r)
|
|
|
|
/* send the options response */
|
|
r->status = HTTP_OK;
|
|
- ap_set_content_type(r, DAV_XML_CONTENT_TYPE);
|
|
+ ap_set_content_type_ex(r, DAV_XML_CONTENT_TYPE, 1);
|
|
|
|
/* send the headers and response body */
|
|
ap_rputs(DAV_XML_HEADER DEBUG_CR
|
|
@@ -3191,7 +3191,7 @@ static int dav_method_lock(request_rec *r)
|
|
(*locks_hooks->close_lockdb)(lockdb);
|
|
|
|
r->status = HTTP_OK;
|
|
- ap_set_content_type(r, DAV_XML_CONTENT_TYPE);
|
|
+ ap_set_content_type_ex(r, DAV_XML_CONTENT_TYPE, 1);
|
|
|
|
ap_rputs(DAV_XML_HEADER DEBUG_CR "<D:prop xmlns:D=\"DAV:\">" DEBUG_CR, r);
|
|
if (lock == NULL)
|
|
diff --git a/modules/examples/mod_example_hooks.c b/modules/examples/mod_example_hooks.c
|
|
index d818dc1..4d79b86 100644
|
|
--- a/modules/examples/mod_example_hooks.c
|
|
+++ b/modules/examples/mod_example_hooks.c
|
|
@@ -993,7 +993,7 @@ static int x_handler(request_rec *r)
|
|
* Set the Content-type header. Note that we do not actually have to send
|
|
* the headers: this is done by the http core.
|
|
*/
|
|
- ap_set_content_type(r, "text/html");
|
|
+ ap_set_content_type_ex(r, "text/html", 1);
|
|
/*
|
|
* If we're only supposed to send header information (HEAD request), we're
|
|
* already there.
|
|
diff --git a/modules/filters/mod_data.c b/modules/filters/mod_data.c
|
|
index d083d32..489e76c 100644
|
|
--- a/modules/filters/mod_data.c
|
|
+++ b/modules/filters/mod_data.c
|
|
@@ -117,7 +117,7 @@ static apr_status_t data_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
|
}
|
|
}
|
|
|
|
- ap_set_content_type(r, "text/plain");
|
|
+ ap_set_content_type_ex(r, "text/plain", 1);
|
|
|
|
}
|
|
|
|
diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c
|
|
index a46a944..05f994c 100644
|
|
--- a/modules/filters/mod_include.c
|
|
+++ b/modules/filters/mod_include.c
|
|
@@ -3971,7 +3971,7 @@ static int include_fixup(request_rec *r)
|
|
if (r->handler && (strcmp(r->handler, "server-parsed") == 0))
|
|
{
|
|
if (!r->content_type || !*r->content_type) {
|
|
- ap_set_content_type(r, "text/html");
|
|
+ ap_set_content_type_ex(r, "text/html", 1);
|
|
}
|
|
r->handler = "default-handler";
|
|
}
|
|
diff --git a/modules/filters/mod_proxy_html.c b/modules/filters/mod_proxy_html.c
|
|
index ea6bf03..8b619e8 100644
|
|
--- a/modules/filters/mod_proxy_html.c
|
|
+++ b/modules/filters/mod_proxy_html.c
|
|
@@ -933,7 +933,7 @@ static apr_status_t proxy_html_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, f->r, APLOGNO(01422)
|
|
"No i18n support found. Install mod_xml2enc if required");
|
|
enc = XML_CHAR_ENCODING_NONE;
|
|
- ap_set_content_type(f->r, "text/html;charset=utf-8");
|
|
+ ap_set_content_type_ex(f->r, "text/html;charset=utf-8", 1);
|
|
}
|
|
else {
|
|
/* if we wanted a non-default charset_out, insert the
|
|
@@ -949,7 +949,7 @@ static apr_status_t proxy_html_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
|
cenc, NULL));
|
|
}
|
|
else /* Normal case, everything worked, utf-8 output */
|
|
- ap_set_content_type(f->r, "text/html;charset=utf-8");
|
|
+ ap_set_content_type_ex(f->r, "text/html;charset=utf-8", 1);
|
|
}
|
|
|
|
ap_fputs(f->next, ctxt->bb, ctxt->cfg->doctype);
|
|
diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c
|
|
index 66cd31c..4650d18 100644
|
|
--- a/modules/generators/mod_cgi.c
|
|
+++ b/modules/generators/mod_cgi.c
|
|
@@ -795,7 +795,7 @@ static apr_status_t include_cgi(include_ctx_t *ctx, ap_filter_t *f,
|
|
/* Force sub_req to be treated as a CGI request, even if ordinary
|
|
* typing rules would have called it something else.
|
|
*/
|
|
- ap_set_content_type(rr, CGI_MAGIC_TYPE);
|
|
+ ap_set_content_type_ex(rr, CGI_MAGIC_TYPE, 1);
|
|
|
|
/* Run it. */
|
|
rr_status = ap_run_sub_req(rr);
|
|
diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c
|
|
index 102d2b3..57e119f 100644
|
|
--- a/modules/generators/mod_cgid.c
|
|
+++ b/modules/generators/mod_cgid.c
|
|
@@ -1801,7 +1801,7 @@ static apr_status_t include_cgi(include_ctx_t *ctx, ap_filter_t *f,
|
|
/* Force sub_req to be treated as a CGI request, even if ordinary
|
|
* typing rules would have called it something else.
|
|
*/
|
|
- ap_set_content_type(rr, CGI_MAGIC_TYPE);
|
|
+ ap_set_content_type_ex(rr, CGI_MAGIC_TYPE, 1);
|
|
|
|
/* Run it. */
|
|
rr_status = ap_run_sub_req(rr);
|
|
diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c
|
|
index e5e63de..67df675 100644
|
|
--- a/modules/generators/mod_info.c
|
|
+++ b/modules/generators/mod_info.c
|
|
@@ -777,7 +777,7 @@ static int display_info(request_rec * r)
|
|
return DECLINED;
|
|
}
|
|
|
|
- ap_set_content_type(r, "text/html; charset=ISO-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/html; charset=ISO-8859-1", 1);
|
|
|
|
ap_rputs(DOCTYPE_XHTML_1_0T
|
|
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
|
|
diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c
|
|
index 5bada07..2cb38c7 100644
|
|
--- a/modules/generators/mod_status.c
|
|
+++ b/modules/generators/mod_status.c
|
|
@@ -273,7 +273,7 @@ static int status_handler(request_rec *r)
|
|
if (r->method_number != M_GET)
|
|
return DECLINED;
|
|
|
|
- ap_set_content_type(r, "text/html; charset=ISO-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/html; charset=ISO-8859-1", 1);
|
|
|
|
/*
|
|
* Simple table-driven form data set parser that lets you alter the header
|
|
@@ -301,7 +301,7 @@ static int status_handler(request_rec *r)
|
|
no_table_report = 1;
|
|
break;
|
|
case STAT_OPT_AUTO:
|
|
- ap_set_content_type(r, "text/plain; charset=ISO-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/plain; charset=ISO-8859-1", 1);
|
|
short_report = 1;
|
|
break;
|
|
}
|
|
diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c
|
|
index 16cb23c..27c44b2 100644
|
|
--- a/modules/http/http_filters.c
|
|
+++ b/modules/http/http_filters.c
|
|
@@ -1245,7 +1245,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
|
}
|
|
}
|
|
|
|
- ap_set_content_type(r, "message/http");
|
|
+ ap_set_content_type_ex(r, "message/http", 1);
|
|
|
|
/* Now we recreate the request, and echo it back */
|
|
|
|
diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c
|
|
index 417fee6..d003aea 100644
|
|
--- a/modules/http/http_protocol.c
|
|
+++ b/modules/http/http_protocol.c
|
|
@@ -1423,10 +1423,10 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
|
|
request_conf->suppress_charset = 1; /* avoid adding default
|
|
* charset later
|
|
*/
|
|
- ap_set_content_type(r, "text/html");
|
|
+ ap_set_content_type_ex(r, "text/html", 1);
|
|
}
|
|
else {
|
|
- ap_set_content_type(r, "text/html; charset=iso-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/html; charset=iso-8859-1", 1);
|
|
}
|
|
|
|
if ((status == HTTP_METHOD_NOT_ALLOWED)
|
|
diff --git a/modules/http/http_request.c b/modules/http/http_request.c
|
|
index e873aab..3521cfb 100644
|
|
--- a/modules/http/http_request.c
|
|
+++ b/modules/http/http_request.c
|
|
@@ -709,7 +709,7 @@ AP_DECLARE(void) ap_internal_fast_redirect(request_rec *rr, request_rec *r)
|
|
r->args = rr->args;
|
|
r->finfo = rr->finfo;
|
|
r->handler = rr->handler;
|
|
- ap_set_content_type(r, rr->content_type);
|
|
+ ap_set_content_type_ex(r, rr->content_type, AP_REQUEST_IS_TRUSTED_CT(rr));
|
|
r->content_encoding = rr->content_encoding;
|
|
r->content_languages = rr->content_languages;
|
|
r->per_dir_config = rr->per_dir_config;
|
|
diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c
|
|
index eecb3f7..b71dc98 100644
|
|
--- a/modules/ldap/util_ldap.c
|
|
+++ b/modules/ldap/util_ldap.c
|
|
@@ -125,7 +125,7 @@ static int util_ldap_handler(request_rec *r)
|
|
st = (util_ldap_state_t *) ap_get_module_config(r->server->module_config,
|
|
&ldap_module);
|
|
|
|
- ap_set_content_type(r, "text/html; charset=ISO-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/html; charset=ISO-8859-1", 1);
|
|
|
|
if (r->header_only)
|
|
return OK;
|
|
diff --git a/modules/mappers/mod_imagemap.c b/modules/mappers/mod_imagemap.c
|
|
index 187a500..3e14933 100644
|
|
--- a/modules/mappers/mod_imagemap.c
|
|
+++ b/modules/mappers/mod_imagemap.c
|
|
@@ -475,7 +475,7 @@ static int imap_reply(request_rec *r, const char *redirect)
|
|
|
|
static void menu_header(request_rec *r, char *menu)
|
|
{
|
|
- ap_set_content_type(r, "text/html; charset=ISO-8859-1");
|
|
+ ap_set_content_type_ex(r, "text/html; charset=ISO-8859-1", 1);
|
|
|
|
ap_rvputs(r, DOCTYPE_HTML_3_2, "<html><head>\n<title>Menu for ",
|
|
ap_escape_html(r->pool, r->uri),
|
|
diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c
|
|
index c599e1a..d5c20af 100644
|
|
--- a/modules/proxy/mod_proxy_balancer.c
|
|
+++ b/modules/proxy/mod_proxy_balancer.c
|
|
@@ -1480,7 +1480,7 @@ static int balancer_handler(request_rec *r)
|
|
|
|
if (apr_table_get(params, "xml")) {
|
|
char date[APR_RFC822_DATE_LEN];
|
|
- ap_set_content_type(r, "text/xml");
|
|
+ ap_set_content_type_ex(r, "text/xml", 1);
|
|
ap_rputs("<?xml version='1.0' encoding='UTF-8' ?>\n", r);
|
|
ap_rputs("<httpd:manager xmlns:httpd='http://httpd.apache.org'>\n", r);
|
|
ap_rputs(" <httpd:balancers>\n", r);
|