Skip to content

Commit

Permalink
Minor changes to RuleWithActions::executeTransformation
Browse files Browse the repository at this point in the history
- Make it private as it's only called by
  RuleWithActions::executeTransformations
  • Loading branch information
eduar-hte committed May 5, 2024
1 parent 96f2476 commit 53c54fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions headers/modsecurity/rule_with_actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,6 @@ class RuleWithActions : public Rule {
void executeTransformations(
Transaction *trasn, const std::string &value, TransformationResults &ret);

inline void executeTransformation(
actions::transformations::Transformation *a,
std::shared_ptr<std::string> *value,
Transaction *trans,
TransformationResults *ret,
std::string *path,
int *nth) const;


void performLogging(Transaction *trans,
std::shared_ptr<RuleMessage> ruleMessage,
bool lastLog = true,
Expand Down Expand Up @@ -166,6 +157,14 @@ class RuleWithActions : public Rule {
RuleWithActions *m_chainedRuleParent;

private:
inline void executeTransformation(
actions::transformations::Transformation *a,
std::shared_ptr<std::string> *value,
Transaction *trans,
TransformationResults *ret,
std::string *path,
int *nth) const;

/* actions */
actions::Action *m_disruptiveAction;
actions::LogData *m_logData;
Expand Down
6 changes: 3 additions & 3 deletions src/rule_with_actions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ inline void RuleWithActions::executeTransformation(
std::string *path,
int *nth) const {

std::string *oldValue = (*value).get();
std::string newValue = a->evaluate(*oldValue, trans);
const auto &oldValue = *value->get();
const auto newValue = a->evaluate(oldValue, trans);

if (newValue != *oldValue) {
if (newValue != oldValue) {
auto u = std::make_shared<std::string>(newValue);
if (m_containsMultiMatchAction) {
ret->push_back({u, a->m_name});
Expand Down

0 comments on commit 53c54fb

Please sign in to comment.