Adds support to SecRuleUpdateTargetById

This commit is contained in:
Felipe Zimmerle
2017-07-04 11:47:39 -07:00
parent 9ce7d022c2
commit e14dc602e5
10 changed files with 4989 additions and 4741 deletions

View File

@@ -559,6 +559,7 @@ using modsecurity::operators::Operator;
CONFIG_SEC_REMOTE_RULES_FAIL_ACTION "CONFIG_SEC_REMOTE_RULES_FAIL_ACTION"
CONFIG_SEC_RULE_REMOVE_BY_ID "CONFIG_SEC_RULE_REMOVE_BY_ID"
CONFIG_SEC_RULE_UPDATE_TARGET_BY_TAG "CONFIG_SEC_RULE_UPDATE_TARGET_BY_TAG"
CONFIG_SEC_RULE_UPDATE_TARGET_BY_ID "CONFIG_SEC_RULE_UPDATE_TARGET_BY_ID"
CONFIG_UPDLOAD_KEEP_FILES "CONFIG_UPDLOAD_KEEP_FILES"
CONFIG_UPDLOAD_SAVE_TMP_FILES "CONFIG_UPDLOAD_SAVE_TMP_FILES"
CONFIG_UPLOAD_DIR "CONFIG_UPLOAD_DIR"
@@ -1186,6 +1187,32 @@ expression:
YYERROR;
}
}
| CONFIG_SEC_RULE_UPDATE_TARGET_BY_ID variables
{
std::string error;
double ruleId;
try {
ruleId = std::stod($1);
} catch (...) {
std::stringstream ss;
ss << "SecRuleUpdateTargetById: failed to load:";
ss << "The input \"" + $1 + "\" does not ";
ss << "seems to be a valid rule id.";
ss << ". ";
driver.error(@0, ss.str());
YYERROR;
}
if (driver.m_exceptions.loadUpdateTargetById(ruleId, std::move($2), &error) == false) {
std::stringstream ss;
ss << "SecRuleUpdateTargetById: failed to load:";
ss << $1;
ss << ". ";
ss << error;
driver.error(@0, ss.str());
YYERROR;
}
}
/* Debug log: start */
| CONFIG_DIR_DEBUG_LVL
{