mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds support to the TX collection and setvar action
This commit is contained in:
@@ -17,6 +17,7 @@ class Driver;
|
||||
}
|
||||
|
||||
#include "actions/action.h"
|
||||
#include "actions/set_var.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
#include "operators/operator.h"
|
||||
#include "rule.h"
|
||||
@@ -40,6 +41,7 @@ class Driver;
|
||||
#include "variables/time_year.h"
|
||||
|
||||
using ModSecurity::actions::Action;
|
||||
using ModSecurity::actions::SetVar;
|
||||
using ModSecurity::actions::transformations::Transformation;
|
||||
using ModSecurity::operators::Operator;
|
||||
using ModSecurity::Rule;
|
||||
@@ -62,6 +64,7 @@ using ModSecurity::Variables::TimeWDay;
|
||||
using ModSecurity::Variables::TimeYear;
|
||||
using ModSecurity::Variables::Variable;
|
||||
|
||||
|
||||
#define CHECK_VARIATION_DECL \
|
||||
Variable *var = NULL; \
|
||||
bool t = false;
|
||||
@@ -182,6 +185,7 @@ using ModSecurity::Variables::Variable;
|
||||
%token <std::string> OPERATOR
|
||||
%token <std::string> ACTION
|
||||
%token <std::string> ACTION_SEVERITY
|
||||
%token <std::string> ACTION_SETVAR
|
||||
%token <std::string> TRANSFORMATION
|
||||
|
||||
%token <double> CONFIG_VALUE_NUMBER
|
||||
@@ -596,6 +600,49 @@ actions:
|
||||
actions->push_back(Action::instantiate($1));
|
||||
$$ = actions;
|
||||
}
|
||||
| actions COMMA ACTION_SETVAR
|
||||
{
|
||||
std::vector<Action *> *a = $1;
|
||||
std::string error;
|
||||
SetVar *setVar = new SetVar($3);
|
||||
|
||||
if (setVar->init(&error) == false) {
|
||||
driver.parserError << error;
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
a->push_back(setVar);
|
||||
$$ = $1;
|
||||
}
|
||||
| SPACE ACTION_SETVAR
|
||||
{
|
||||
std::vector<Action *> *actions = new std::vector<Action *>;
|
||||
std::string error;
|
||||
SetVar *setVar = new SetVar($2);
|
||||
|
||||
if (setVar->init(&error) == false) {
|
||||
driver.parserError << error;
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
actions->push_back(setVar);
|
||||
$$ = actions;
|
||||
|
||||
}
|
||||
| ACTION_SETVAR
|
||||
{
|
||||
std::vector<Action *> *actions = new std::vector<Action *>;
|
||||
std::string error;
|
||||
SetVar *setVar = new SetVar($1);
|
||||
|
||||
if (setVar->init(&error) == false) {
|
||||
driver.parserError << error;
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
actions->push_back(setVar);
|
||||
$$ = actions;
|
||||
}
|
||||
|
||||
|
||||
%%
|
||||
|
Reference in New Issue
Block a user