mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
22
apache2/re.c
22
apache2/re.c
@@ -32,12 +32,15 @@ static const char *const severities[] = {
|
|||||||
* Remove actions with the same cardinality group from the actionset.
|
* Remove actions with the same cardinality group from the actionset.
|
||||||
*/
|
*/
|
||||||
static void msre_actionset_cardinality_fixup(msre_actionset *actionset, msre_action *action) {
|
static void msre_actionset_cardinality_fixup(msre_actionset *actionset, msre_action *action) {
|
||||||
const apr_array_header_t *tarr = apr_table_elts(actionset->actions);
|
const apr_array_header_t *tarr = NULL;
|
||||||
const apr_table_entry_t *telts = (const apr_table_entry_t*)tarr->elts;
|
const apr_table_entry_t *telts = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((actionset == NULL) || (action == NULL)) return;
|
if ((actionset == NULL) || (action == NULL)) return;
|
||||||
|
|
||||||
|
tarr = apr_table_elts(actionset->actions);
|
||||||
|
telts = (const apr_table_entry_t*)tarr->elts;
|
||||||
|
|
||||||
for (i = 0; i < tarr->nelts; i++) {
|
for (i = 0; i < tarr->nelts; i++) {
|
||||||
msre_action *target = (msre_action *)telts[i].val;
|
msre_action *target = (msre_action *)telts[i].val;
|
||||||
if (target->metadata->cardinality_group == action->metadata->cardinality_group) {
|
if (target->metadata->cardinality_group == action->metadata->cardinality_group) {
|
||||||
@@ -52,11 +55,16 @@ static void msre_actionset_cardinality_fixup(msre_actionset *actionset, msre_act
|
|||||||
*/
|
*/
|
||||||
char *msre_actionset_generate_action_string(apr_pool_t *pool, const msre_actionset *actionset)
|
char *msre_actionset_generate_action_string(apr_pool_t *pool, const msre_actionset *actionset)
|
||||||
{
|
{
|
||||||
const apr_array_header_t *tarr = apr_table_elts(actionset->actions);
|
const apr_array_header_t *tarr = NULL;
|
||||||
const apr_table_entry_t *telts = (const apr_table_entry_t*)tarr->elts;
|
const apr_table_entry_t *telts = NULL;
|
||||||
char *actions = NULL;
|
char *actions = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (actionset == NULL) return apr_pstrdup(pool, "");
|
||||||
|
|
||||||
|
tarr = apr_table_elts(actionset->actions);
|
||||||
|
telts = (const apr_table_entry_t*)tarr->elts;
|
||||||
|
|
||||||
for (i = 0; i < tarr->nelts; i++) {
|
for (i = 0; i < tarr->nelts; i++) {
|
||||||
msre_action *action = (msre_action *)telts[i].val;
|
msre_action *action = (msre_action *)telts[i].val;
|
||||||
int use_quotes = 0;
|
int use_quotes = 0;
|
||||||
@@ -84,7 +92,7 @@ char *msre_actionset_generate_action_string(apr_pool_t *pool, const msre_actions
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actions;
|
return (actions == NULL) ? apr_pstrdup(pool, "") : actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,6 +102,8 @@ static void msre_actionset_action_add(msre_actionset *actionset, msre_action *ac
|
|||||||
{
|
{
|
||||||
msre_action *add_action = action;
|
msre_action *add_action = action;
|
||||||
|
|
||||||
|
if ((actionset == NULL)) return;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "block" action is just a placeholder for the parent action.
|
* The "block" action is just a placeholder for the parent action.
|
||||||
*/
|
*/
|
||||||
@@ -103,6 +113,8 @@ static void msre_actionset_action_add(msre_actionset *actionset, msre_action *ac
|
|||||||
add_action = actionset->parent_intercept_action_rec;
|
add_action = actionset->parent_intercept_action_rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((add_action == NULL)) return;
|
||||||
|
|
||||||
if (add_action->metadata->cardinality_group != ACTION_CGROUP_NONE) {
|
if (add_action->metadata->cardinality_group != ACTION_CGROUP_NONE) {
|
||||||
msre_actionset_cardinality_fixup(actionset, add_action);
|
msre_actionset_cardinality_fixup(actionset, add_action);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user