mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 12:07:46 +03:00
Using RunTimeString on setvar action
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#define SRC_VARIABLES_IP_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
#include "src/run_time_string.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
@@ -78,6 +79,23 @@ class Ip_DictElementRegexp : public Variable {
|
||||
};
|
||||
|
||||
|
||||
class Ip_DynamicElement : public Variable {
|
||||
public:
|
||||
explicit Ip_DynamicElement(std::unique_ptr<RunTimeString> dictElement)
|
||||
: Variable("IP:dynamic"),
|
||||
m_string(std::move(dictElement)) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
std::string string = m_string->evaluate(transaction);
|
||||
transaction->m_collections.resolveMultiMatches("IP:" + string, "IP", l);
|
||||
}
|
||||
|
||||
std::unique_ptr<RunTimeString> m_string;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
|
Reference in New Issue
Block a user