Adds checks for the NO_LOGS definition and improved the vars resolution time

This commit is contained in:
Felipe Zimmerle
2015-09-17 17:41:38 -03:00
parent 3e067e7409
commit ed86c24df6
46 changed files with 294 additions and 62 deletions

View File

@@ -21,6 +21,7 @@
#include "modsecurity/assay.h"
#include "src/rule.h"
#include "src/macro_expansion.h"
#include "src/utils.h"
namespace ModSecurity {
namespace actions {
@@ -57,6 +58,7 @@ bool SetVar::init(std::string *error) {
pos = action.find(".");
if (pos != std::string::npos) {
collectionName = std::string(action, 0, pos);
collectionName = toupper(collectionName);
} else {
error->assign("Missing the collection and/or variable name");
return false;
@@ -140,8 +142,10 @@ bool SetVar::evaluate(Rule *rule, Assay *assay) {
break;
}
#ifndef NO_LOGS
assay->debug(8, "Saving variable: " + collectionName + ":" + \
variableName + " with value: " + targetValue);
#endif
assay->setCollection(collectionName, variableName, targetValue);
return true;