mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Having default actions as o shared pointer
This commit is contained in:
@@ -33,7 +33,7 @@ bool Block::evaluate(Rule *rule, Transaction *transaction,
|
||||
std::shared_ptr<RuleMessage> rm) {
|
||||
ms_dbg_a(transaction, 8, "Marking request as disruptive.");
|
||||
|
||||
for (Action *a : transaction->m_rules->m_defaultActions[rule->m_phase]) {
|
||||
for (auto &a : transaction->m_rules->m_defaultActions[rule->m_phase]) {
|
||||
if (a->isDisruptive() == false) {
|
||||
continue;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1194,7 +1194,8 @@ expression:
|
||||
}
|
||||
|
||||
for (actions::Action *a : checkedActions) {
|
||||
driver.m_defaultActions[definedPhase].push_back(a);
|
||||
driver.m_defaultActions[definedPhase].push_back(
|
||||
std::unique_ptr<actions::Action>(a));
|
||||
}
|
||||
|
||||
delete actions;
|
||||
|
12
src/rule.cc
12
src/rule.cc
@@ -389,13 +389,13 @@ std::list<std::pair<std::shared_ptr<std::string>,
|
||||
// Notice that first we make sure that won't be a t:none
|
||||
// on the target rule.
|
||||
if (none == 0) {
|
||||
for (Action *a : trans->m_rules->m_defaultActions[this->m_phase]) {
|
||||
for (auto &a : trans->m_rules->m_defaultActions[this->m_phase]) {
|
||||
if (a->action_kind \
|
||||
!= actions::Action::RunTimeBeforeMatchAttemptKind) {
|
||||
continue;
|
||||
}
|
||||
|
||||
executeTransformation(a, &value, trans, &ret, &path,
|
||||
executeTransformation(a.get(), &value, trans, &ret, &path,
|
||||
&transformations);
|
||||
}
|
||||
}
|
||||
@@ -570,12 +570,12 @@ void Rule::executeActionsAfterFullMatch(Transaction *trans,
|
||||
bool containsBlock, std::shared_ptr<RuleMessage> ruleMessage) {
|
||||
bool disruptiveAlreadyExecuted = false;
|
||||
|
||||
for (Action *a : trans->m_rules->m_defaultActions[this->m_phase]) {
|
||||
if (a->action_kind != actions::Action::RunTimeOnlyIfMatchKind) {
|
||||
for (auto &a : trans->m_rules->m_defaultActions[this->m_phase]) {
|
||||
if (a.get()->action_kind != actions::Action::RunTimeOnlyIfMatchKind) {
|
||||
continue;
|
||||
}
|
||||
if (!a->isDisruptive()) {
|
||||
executeAction(trans, containsBlock, ruleMessage, a, true);
|
||||
if (!a.get()->isDisruptive()) {
|
||||
executeAction(trans, containsBlock, ruleMessage, a.get(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user