mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Checkin fix to rule removal code to avoid placeholders.
This commit is contained in:
parent
9e9bb318b3
commit
2bf4556cd0
39
apache2/re.c
39
apache2/re.c
@ -1028,31 +1028,34 @@ static int msre_ruleset_phase_rule_remove_with_exception(msre_ruleset *ruleset,
|
|||||||
if (mode == 0) { /* Looking for next rule. */
|
if (mode == 0) { /* Looking for next rule. */
|
||||||
int remove_rule = 0;
|
int remove_rule = 0;
|
||||||
|
|
||||||
switch(re->type) {
|
/* Only remove non-placeholder rules */
|
||||||
case RULE_EXCEPTION_REMOVE_ID :
|
if (rule->placeholder == RULE_PH_NONE) {
|
||||||
if ((rule->actionset != NULL)&&(rule->actionset->id != NULL)) {
|
switch(re->type) {
|
||||||
int ruleid = atoi(rule->actionset->id);
|
case RULE_EXCEPTION_REMOVE_ID :
|
||||||
|
if ((rule->actionset != NULL)&&(rule->actionset->id != NULL)) {
|
||||||
|
int ruleid = atoi(rule->actionset->id);
|
||||||
|
|
||||||
if (rule_id_in_range(ruleid, re->param)) {
|
if (rule_id_in_range(ruleid, re->param)) {
|
||||||
remove_rule = 1;
|
remove_rule = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RULE_EXCEPTION_REMOVE_MSG :
|
case RULE_EXCEPTION_REMOVE_MSG :
|
||||||
if ((rule->actionset != NULL)&&(rule->actionset->msg != NULL)) {
|
if ((rule->actionset != NULL)&&(rule->actionset->msg != NULL)) {
|
||||||
char *my_error_msg = NULL;
|
char *my_error_msg = NULL;
|
||||||
|
|
||||||
int rc = msc_regexec(re->param_data,
|
int rc = msc_regexec(re->param_data,
|
||||||
rule->actionset->msg, strlen(rule->actionset->msg),
|
rule->actionset->msg, strlen(rule->actionset->msg),
|
||||||
&my_error_msg);
|
&my_error_msg);
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
remove_rule = 1;
|
remove_rule = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remove_rule) {
|
if (remove_rule) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user