mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-13 06:57:10 +03:00
Update msr->r to the current r whenever we receive control from Apache.
This commit is contained in:
@@ -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