mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-09 17:54:37 +03:00
Update msr->r to the current r whenever we receive control from Apache.
This commit is contained in:
@@ -38,6 +38,8 @@ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out,
|
||||
return APR_EGENERAL;
|
||||
}
|
||||
|
||||
msr->r = f->r;
|
||||
|
||||
if ((msr->if_status == IF_STATUS_COMPLETE)||(msr->if_status == IF_STATUS_NONE)) {
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
msr_log(msr, 4, "Input filter: Input forwarding already complete, skipping (f %x, r %x).", f, f->r);
|
||||
@@ -392,6 +394,8 @@ apr_status_t output_filter(ap_filter_t *f, apr_bucket_brigade *bb_in) {
|
||||
return send_error_bucket(f, HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
msr->r = r;
|
||||
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
msr_log(msr, 4, "Output filter: Receiving output (f %x, r %x).", f, f->r);
|
||||
}
|
||||
|
||||
@@ -227,13 +227,14 @@ int perform_interception(modsec_rec *msr) {
|
||||
* Retrieves a previously stored transaction context by
|
||||
* looking at the main request, and the previous requests.
|
||||
*/
|
||||
static modsec_rec *retrieve_tx_context(const request_rec *r) {
|
||||
static modsec_rec *retrieve_tx_context(request_rec *r) {
|
||||
modsec_rec *msr = NULL;
|
||||
request_rec *rx = NULL;
|
||||
|
||||
/* Look in the current request first. */
|
||||
msr = (modsec_rec *)apr_table_get(r->notes, NOTE_MSR);
|
||||
if (msr != NULL) {
|
||||
msr->r = r;
|
||||
return msr;
|
||||
}
|
||||
|
||||
@@ -241,6 +242,7 @@ static modsec_rec *retrieve_tx_context(const request_rec *r) {
|
||||
if (r->main != NULL) {
|
||||
msr = (modsec_rec *)apr_table_get(r->main->notes, NOTE_MSR);
|
||||
if (msr != NULL) {
|
||||
msr->r = r;
|
||||
return msr;
|
||||
}
|
||||
}
|
||||
@@ -250,6 +252,7 @@ static modsec_rec *retrieve_tx_context(const request_rec *r) {
|
||||
while(rx != NULL) {
|
||||
msr = (modsec_rec *)apr_table_get(rx->notes, NOTE_MSR);
|
||||
if (msr != NULL) {
|
||||
msr->r = r;
|
||||
return msr;
|
||||
}
|
||||
rx = rx->prev;
|
||||
@@ -577,8 +580,6 @@ static int hook_request_late(request_rec *r) {
|
||||
*/
|
||||
return DECLINED;
|
||||
}
|
||||
msr->r = r;
|
||||
msr->remote_user = r->user;
|
||||
|
||||
/* Has this phase been completed already? */
|
||||
if (msr->phase_request_body_complete) {
|
||||
@@ -593,6 +594,8 @@ static int hook_request_late(request_rec *r) {
|
||||
}
|
||||
msr->phase_request_body_complete = 1;
|
||||
|
||||
msr->remote_user = r->user;
|
||||
|
||||
/* Get the second configuration context. */
|
||||
msr->dcfg2 = (directory_config *)ap_get_module_config(r->per_dir_config,
|
||||
&security2_module);
|
||||
@@ -683,7 +686,7 @@ static void hook_error_log(const char *file, int line, int level, apr_status_t s
|
||||
error_message *em = NULL;
|
||||
|
||||
if (r == NULL) return;
|
||||
msr = retrieve_tx_context(r);
|
||||
msr = retrieve_tx_context((request_rec *)r);
|
||||
if (msr == NULL) return;
|
||||
|
||||
/* Store the error message for later */
|
||||
@@ -865,6 +868,7 @@ static void hook_insert_filter(request_rec *r) {
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
msr_log(msr, 4, "Hook insert_filter: Processing disabled, skipping.");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user