Adds support to MATCHED_VARS variable

This commit is contained in:
Felipe Zimmerle
2015-07-21 14:12:15 -03:00
parent 9d69501961
commit 09867791c7
5 changed files with 101 additions and 2 deletions

View File

@@ -113,15 +113,19 @@ bool Rule::evaluate(Assay *assay) {
assay->debug(4, "Running action: " + a->action);
a->evaluate(assay);
}
if (this->chained && this->chainedRule == NULL) {
assay->debug(4, "Rule is marked as chained but there isn't a subsequent rule.");
}
if (this->chained && this->chainedRule != NULL) {
assay->debug(4, "Executing chained rule.");
if (assay->update_variable_first("MATCHED_VAR",
value) == false) {
assay->store_variable("MATCHED_VAR", value);
}
assay->store_variable("MATCHED_VARS:" + v.first, value);
this->chainedRule->evaluate(assay);
assay->update_variable_first("MATCHED_VAR", "");
assay->delete_variable("MATCHED_VARS:" + v.first);
}
} else {
assay->debug(4, "Rule returned 0.");