mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Added logging of target variable expansion. See #62.
This commit is contained in:
parent
820ba5f1d2
commit
5a6ce01429
4
CHANGES
4
CHANGES
@ -1,7 +1,9 @@
|
||||
?? ??? 2007 - 2.5.0-trunk
|
||||
-------------------------
|
||||
|
||||
* Cleaned up some documentation.
|
||||
* Enhanced debug logging.
|
||||
|
||||
* Cleaned up and clarified some documentation.
|
||||
|
||||
* Performance improvements and greater control over caching transformations.
|
||||
|
||||
|
18
apache2/re.c
18
apache2/re.c
@ -1042,6 +1042,7 @@ msre_rule *msre_rule_create(msre_ruleset *ruleset,
|
||||
if (rule == NULL) return NULL;
|
||||
rule->ruleset = ruleset;
|
||||
rule->targets = apr_array_make(ruleset->mp, 10, sizeof(const msre_var *));
|
||||
rule->p1 = apr_pstrdup(ruleset->mp, targets);
|
||||
rule->filename = apr_pstrdup(ruleset->mp, fn);
|
||||
rule->line_num = line;
|
||||
|
||||
@ -1345,6 +1346,23 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Log the target variable expansion */
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
const char *expnames = NULL;
|
||||
|
||||
arr = apr_table_elts(tartab);
|
||||
te = (apr_table_entry_t *)arr->elts;
|
||||
if (arr->nelts > 0) {
|
||||
expnames = apr_pstrdup(mptmp, ((msre_var *)te[0].val)->name);
|
||||
for(i = 1; i < arr->nelts; i++) {
|
||||
expnames = apr_psprintf(mptmp, "%s|%s", expnames, ((msre_var *)te[i].val)->name);
|
||||
}
|
||||
if (strcmp(rule->p1, expnames) != 0) {
|
||||
msr_log(msr, 4, "Expanded \"%s\" to \"%s\".", rule->p1, expnames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop through targets on the final target list,
|
||||
* perform transformations as necessary, and invoke
|
||||
* the operator.
|
||||
|
@ -117,6 +117,7 @@ struct msre_rule {
|
||||
msre_op_metadata *op_metadata;
|
||||
unsigned int op_negated;
|
||||
msre_actionset *actionset;
|
||||
const char *p1;
|
||||
const char *filename;
|
||||
int line_num;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user