Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/actions/expire_var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace actions {

bool ExpireVar::evaluate(RuleWithActions *rule, Transaction *t) {

std::string expireExpressionExpanded(m_string->evaluate(t));
std::string expireExpressionExpanded(m_string->evaluate(t, rule));

std::string fully_qualified_var;
int expirySeconds = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/actions/log_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "modsecurity/actions/action.h"
#include "modsecurity/transaction.h"
#include "modsecurity/rule.h"
#include "modsecurity/rule_with_actions.h"
#include "modsecurity/rule_message.h"


Expand All @@ -30,7 +31,7 @@ namespace actions {


bool LogData::evaluate(RuleWithActions *rule, Transaction *transaction, RuleMessage &ruleMessage) {
ruleMessage.m_data = data(transaction);
ruleMessage.m_data = m_string->evaluate(transaction, rule);

return true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/actions/msg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "modsecurity/actions/action.h"
#include "modsecurity/transaction.h"
#include "modsecurity/rule.h"
#include "modsecurity/rule_with_actions.h"
#include "modsecurity/rule_message.h"

/*
Expand All @@ -47,7 +48,7 @@ namespace actions {


bool Msg::evaluate(RuleWithActions *rule, Transaction *transaction, RuleMessage &ruleMessage) {
const auto msg = data(transaction);
const auto msg = m_string->evaluate(transaction, rule);
ruleMessage.m_message = msg;
ms_dbg_a(transaction, 9, "Saving msg: " + msg);

Expand Down
3 changes: 1 addition & 2 deletions src/actions/set_var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ bool SetVar::evaluate(RuleWithActions *rule, Transaction *t) {

try {
std::vector<const VariableValue *> l;
RuleWithOperator *rr = dynamic_cast<RuleWithOperator *>(rule);
m_variable->evaluate(t, rr, &l);
m_variable->evaluate(t, rule, &l);
Comment thread
airween marked this conversation as resolved.
Resolved
if (l.size() == 0) {
value = 0;
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/run_time_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ std::string RunTimeString::evaluate(Transaction *t, Rule *r) {
s.append(z->m_string);
} else if (z->m_var != NULL && t != NULL) {
std::vector<const VariableValue *> l;
// FIXME: This cast should be removed.
RuleWithOperator *rr = dynamic_cast<RuleWithOperator *>(r);
auto *rr = dynamic_cast<RuleWithActions *>(r);
z->m_var->evaluate(t, rr, &l);
if (l.size() > 0) {
s.append(l[0]->getValue());
Expand Down
2 changes: 1 addition & 1 deletion src/variables/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Global_DynamicElement : public Variable {
void evaluate(Transaction *t,
RuleWithActions *rule,
std::vector<const VariableValue *> *l) override {
std::string string = m_string->evaluate(t);
std::string string = m_string->evaluate(t, rule);
t->m_collections.m_global_collection->resolveMultiMatches(
string,
t->m_collections.m_global_collection_key,
Expand Down
2 changes: 1 addition & 1 deletion src/variables/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Ip_DynamicElement : public Variable {
void evaluate(Transaction *t,
RuleWithActions *rule,
std::vector<const VariableValue *> *l) override {
std::string string = m_string->evaluate(t);
std::string string = m_string->evaluate(t, rule);
t->m_collections.m_ip_collection->resolveMultiMatches(
string,
t->m_collections.m_ip_collection_key,
Expand Down
2 changes: 1 addition & 1 deletion src/variables/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Resource_DynamicElement : public Variable {
void evaluate(Transaction *t,
RuleWithActions *rule,
std::vector<const VariableValue *> *l) override {
std::string string = m_string->evaluate(t);
std::string string = m_string->evaluate(t, rule);
t->m_collections.m_resource_collection->resolveMultiMatches(
string,
t->m_collections.m_resource_collection_key,
Expand Down
2 changes: 1 addition & 1 deletion src/variables/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Session_DynamicElement : public Variable {
void evaluate(Transaction *t,
RuleWithActions *rule,
std::vector<const VariableValue *> *l) override {
std::string string = m_string->evaluate(t);
std::string string = m_string->evaluate(t, rule);
t->m_collections.m_session_collection->resolveMultiMatches(
string,
t->m_collections.m_session_collection_key,
Expand Down
2 changes: 1 addition & 1 deletion src/variables/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Tx_DynamicElement : public Variable {
void evaluate(Transaction *t,
RuleWithActions *rule,
std::vector<const VariableValue *> *l) override {
std::string string = m_string->evaluate(t);
std::string string = m_string->evaluate(t, rule);
t->m_collections.m_tx_collection->resolveMultiMatches(string, l,
m_keyExclusion);
}
Expand Down
2 changes: 1 addition & 1 deletion src/variables/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class User_DynamicElement : public Variable {
void evaluate(Transaction *t,
RuleWithActions *rule,
std::vector<const VariableValue *> *l) override {
std::string string = m_string->evaluate(t);
std::string string = m_string->evaluate(t, rule);
t->m_collections.m_user_collection->resolveMultiMatches(
string,
t->m_collections.m_user_collection_key,
Expand Down
Loading
Loading