Adds support the variable rule

Issue #1016
This commit is contained in:
Felipe Zimmerle
2016-06-20 13:52:45 -03:00
parent 45bfb594b9
commit 56d084a7f4
12 changed files with 415 additions and 6 deletions

View File

@@ -65,6 +65,7 @@ class Driver;
#include "variables/time_year.h"
#include "variables/tx.h"
#include "variables/xml.h"
#include "variables/rule.h"
using modsecurity::ModSecurity;
@@ -247,6 +248,7 @@ using modsecurity::Variables::XML;
%token <std::string> RUN_TIME_VAR_TIME_WDAY
%token <std::string> RUN_TIME_VAR_TIME_YEAR
%token <std::string> RUN_TIME_VAR_XML
%token <std::string> RUN_TIME_VAR_RULE
%token <std::string> CONFIG_SEC_REMOTE_RULES_FAIL_ACTION
@@ -891,6 +893,17 @@ var:
if (!var) { var = new XML(name); }
$$ = var;
}
| RUN_TIME_VAR_RULE
{
std::string name($1);
CHECK_VARIATION_DECL
CHECK_VARIATION(&) { var = new Count(
new modsecurity::Variables::Rule(name)); }
CHECK_VARIATION(!) { var = new Exclusion(
new modsecurity::Variables::Rule(name)); }
if (!var) { var = new modsecurity::Variables::Rule(name); }
$$ = var;
}
;
act: