mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-16 08:27:10 +03:00
Cosmetics: Using VariableValues instead of std::vector<...>
Making the code more readable.
This commit is contained in:
@@ -28,7 +28,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void Duration::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
double e = utils::cpu_seconds() - transaction->m_creationTimeStamp;
|
||||
|
||||
transaction->m_variableDuration.assign(std::to_string(e));
|
||||
|
||||
@@ -35,7 +35,7 @@ class Duration : public Variable {
|
||||
m_retName("DURATION") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void Env::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
for (char **current = environ; *current; current++) {
|
||||
std::string env = std::string(*current);
|
||||
size_t pos = env.find_first_of("=");
|
||||
|
||||
@@ -34,7 +34,7 @@ class Env : public Variable {
|
||||
: Variable(_name) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
};
|
||||
|
||||
} // namespace variables
|
||||
|
||||
@@ -40,7 +40,7 @@ class Global_DictElement : public Variable {
|
||||
m_dictElement("GLOBAL:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_global_collection->resolveMultiMatches(
|
||||
*getVariableKey(), t->m_collections.m_global_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -56,7 +56,7 @@ class Global_NoDictElement : public Variable {
|
||||
: Variable("GLOBAL") { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_global_collection->resolveMultiMatches("",
|
||||
t->m_collections.m_global_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -71,7 +71,7 @@ class Global_DictElementRegexp : public VariableRegex {
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_global_collection->resolveRegularExpression(
|
||||
m_dictElement,
|
||||
t->m_collections.m_global_collection_key,
|
||||
@@ -92,7 +92,7 @@ class Global_DynamicElement : public VariableWithRunTimeString {
|
||||
{ };
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_global_collection->resolveMultiMatches(
|
||||
string,
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void HighestSeverity::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
transaction->m_variableHighestSeverityAction.assign(
|
||||
std::to_string(transaction->m_highestSeverityAction));
|
||||
l->push_back(std::make_shared<VariableValue>(getVariableKeyWithCollection().get(), &transaction->m_variableHighestSeverityAction));
|
||||
|
||||
@@ -35,7 +35,7 @@ class HighestSeverity : public Variable {
|
||||
{ }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Ip_DictElement : public Variable {
|
||||
m_dictElement("IP:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_ip_collection->resolveMultiMatches(
|
||||
*getVariableKey(), t->m_collections.m_ip_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -56,7 +56,7 @@ class Ip_NoDictElement : public Variable {
|
||||
: Variable("IP") { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_ip_collection->resolveMultiMatches("",
|
||||
t->m_collections.m_ip_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -71,7 +71,7 @@ class Ip_DictElementRegexp : public VariableRegex {
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_ip_collection->resolveRegularExpression(
|
||||
m_dictElement, t->m_collections.m_ip_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -91,7 +91,7 @@ class Ip_DynamicElement : public VariableWithRunTimeString {
|
||||
{ }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_ip_collection->resolveMultiMatches(
|
||||
string,
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void ModsecBuild::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
|
||||
l->push_back(std::make_shared<VariableValue>(&m_retName, &m_build));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class ModsecBuild : public Variable {
|
||||
}
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
|
||||
std::string m_build;
|
||||
std::string m_retName;
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace variables {
|
||||
|
||||
|
||||
void RemoteUser::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
size_t pos;
|
||||
std::string base64;
|
||||
std::string header;
|
||||
|
||||
std::vector<std::shared_ptr<const VariableValue>> l2;
|
||||
VariableValues l2;
|
||||
transaction->m_variableRequestHeaders.resolve("authorization", &l2);
|
||||
|
||||
if (l2.size() < 1) {
|
||||
|
||||
@@ -37,7 +37,7 @@ class RemoteUser : public Variable {
|
||||
m_retName("REMOTE_USER") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Resource_DictElement : public Variable {
|
||||
m_dictElement("RESOURCE:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_resource_collection->resolveMultiMatches(
|
||||
*getVariableKey(), t->m_collections.m_resource_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -56,7 +56,7 @@ class Resource_NoDictElement : public Variable {
|
||||
: Variable("RESOURCE") { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_resource_collection->resolveMultiMatches(*getVariableKey(),
|
||||
t->m_collections.m_resource_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -71,7 +71,7 @@ class Resource_DictElementRegexp : public VariableRegex {
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_resource_collection->resolveRegularExpression(
|
||||
m_dictElement, t->m_collections.m_resource_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -91,7 +91,7 @@ class Resource_DynamicElement : public VariableWithRunTimeString {
|
||||
{ }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_resource_collection->resolveMultiMatches(
|
||||
string,
|
||||
|
||||
@@ -56,7 +56,7 @@ class Rule_DictElement : public RuleVariable, public VariableDictElement {
|
||||
|
||||
static void id(Transaction *t,
|
||||
const RuleWithActions *rule,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
std::string a = std::to_string(rule->getId());
|
||||
auto var = std::make_shared<VariableValue>(&m_rule, &m_rule_id, &a);
|
||||
VariableOrigin origin;
|
||||
@@ -70,7 +70,7 @@ class Rule_DictElement : public RuleVariable, public VariableDictElement {
|
||||
|
||||
static void rev(Transaction *t,
|
||||
const RuleWithActions *rule,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
|
||||
if (rule->hasRevisionAction()) {
|
||||
std::string a(rule->getRevision());
|
||||
@@ -87,7 +87,7 @@ class Rule_DictElement : public RuleVariable, public VariableDictElement {
|
||||
|
||||
static void severity(Transaction *t,
|
||||
const RuleWithActions *rule,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
|
||||
if (rule->hasSeverityAction()) {
|
||||
std::string a(std::to_string(rule->getSeverity()));
|
||||
@@ -103,7 +103,7 @@ class Rule_DictElement : public RuleVariable, public VariableDictElement {
|
||||
|
||||
static void logData(Transaction *t,
|
||||
const RuleWithActions *rule,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
|
||||
if (rule->hasLogDataAction()) {
|
||||
std::string a(rule->getLogData(t));
|
||||
@@ -118,7 +118,7 @@ class Rule_DictElement : public RuleVariable, public VariableDictElement {
|
||||
|
||||
static void msg(Transaction *t,
|
||||
const RuleWithActions *rule,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
|
||||
if (rule->hasMessageAction()) {
|
||||
std::string a(rule->getMessage(t));
|
||||
@@ -132,7 +132,7 @@ class Rule_DictElement : public RuleVariable, public VariableDictElement {
|
||||
}
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
|
||||
if (m_dictElement == "id") {
|
||||
id(t, getRule(), l);
|
||||
@@ -180,7 +180,7 @@ class Rule_DictElementRegexp : public RuleVariable, public VariableRegex {
|
||||
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
|
||||
if (Utils::regex_search("id", m_r) > 0) {
|
||||
Rule_DictElement::id(t, getRule(), l);
|
||||
@@ -225,7 +225,7 @@ class Rule_NoDictElement : public RuleVariable, public Variable {
|
||||
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
Rule_DictElement::id(t, getRule(), l);
|
||||
Rule_DictElement::rev(t, getRule(), l);
|
||||
Rule_DictElement::severity(t, getRule(), l);
|
||||
|
||||
@@ -39,7 +39,7 @@ class Session_DictElement : public Variable {
|
||||
m_dictElement("SESSION:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_session_collection->resolveMultiMatches(
|
||||
*getVariableKey(), t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -55,7 +55,7 @@ class Session_NoDictElement : public Variable {
|
||||
: Variable("SESSION") { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_session_collection->resolveMultiMatches("",
|
||||
t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -70,7 +70,7 @@ class Session_DictElementRegexp : public VariableRegex {
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_session_collection->resolveRegularExpression(
|
||||
m_dictElement, t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -90,7 +90,7 @@ class Session_DynamicElement : public VariableWithRunTimeString {
|
||||
{ }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_session_collection->resolveMultiMatches(
|
||||
string,
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void Time::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
|
||||
@@ -36,7 +36,7 @@ class Time : public Variable {
|
||||
m_retName("TIME") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeDay::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeDay : public Variable {
|
||||
m_retName("TIME_DAY") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeEpoch::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
transaction->m_variableTimeEpoch.assign(
|
||||
std::to_string(std::time(nullptr)));
|
||||
l->push_back(std::make_shared<VariableValue>(&m_retName, &transaction->m_variableTimeEpoch));
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeEpoch : public Variable {
|
||||
m_retName("TIME_EPOCH") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeHour::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeHour : public Variable {
|
||||
m_retName("TIME_HOUR") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeMin::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeMin : public Variable {
|
||||
m_retName("TIME_MIN") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeMon::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeMon : public Variable {
|
||||
m_retName("TIME_MON") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeSec::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeSec : public Variable {
|
||||
m_retName("TIME_SEC") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeWDay::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeWDay : public Variable {
|
||||
m_retName("TIME_WDAY") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace modsecurity {
|
||||
namespace variables {
|
||||
|
||||
void TimeYear::evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
char tstr[200];
|
||||
struct tm timeinfo;
|
||||
time_t timer;
|
||||
|
||||
@@ -35,7 +35,7 @@ class TimeYear : public Variable {
|
||||
m_retName("TIME_YEAR") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
std::string m_retName;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Tx_DictElement : public Variable {
|
||||
m_dictElement("TX:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_tx_collection->resolveMultiMatches(
|
||||
*getVariableKey(), l, m_keyExclusion);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class Tx_NoDictElement : public Variable {
|
||||
: Variable("TX") { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_tx_collection->resolveMultiMatches("", l,
|
||||
m_keyExclusion);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Tx_DictElementRegexp : public VariableRegex {
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_tx_collection->resolveRegularExpression(
|
||||
m_dictElement, l, m_keyExclusion);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class Tx_DynamicElement : public VariableWithRunTimeString {
|
||||
{ }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_tx_collection->resolveMultiMatches(string, l,
|
||||
m_keyExclusion);
|
||||
|
||||
@@ -40,7 +40,7 @@ class User_DictElement : public Variable {
|
||||
m_dictElement("USER:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_user_collection->resolveMultiMatches(
|
||||
*getVariableKey(), t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -56,7 +56,7 @@ class User_NoDictElement : public Variable {
|
||||
: Variable("USER") { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_user_collection->resolveMultiMatches(*getVariableKey(),
|
||||
t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -71,7 +71,7 @@ class User_DictElementRegexp : public VariableRegex {
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
t->m_collections.m_user_collection->resolveRegularExpression(
|
||||
m_dictElement, t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l, m_keyExclusion);
|
||||
@@ -91,7 +91,7 @@ class User_DynamicElement : public VariableWithRunTimeString {
|
||||
{ }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_user_collection->resolveMultiMatches(
|
||||
string,
|
||||
|
||||
@@ -48,7 +48,7 @@ class n ## _DictElementRegexp : public VariableRegex { \
|
||||
: VariableRegex(#N, regex) { } \
|
||||
\
|
||||
void evaluate(Transaction *transaction, \
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override { \
|
||||
VariableValues *l) override { \
|
||||
transaction-> e .resolveRegularExpression(&m_r, l, \
|
||||
m_keyExclusion); \
|
||||
} \
|
||||
@@ -62,7 +62,7 @@ class n ## _DictElement : public VariableDictElement { \
|
||||
: VariableDictElement(#N, dictElement) { } \
|
||||
\
|
||||
void evaluate(Transaction *transaction, \
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override { \
|
||||
VariableValues *l) override { \
|
||||
transaction-> e .resolve(m_dictElement, l); \
|
||||
} \
|
||||
};
|
||||
@@ -75,7 +75,7 @@ class n ## _NoDictElement : public Variable { \
|
||||
: Variable(#N) { } \
|
||||
\
|
||||
void evaluate(Transaction *transaction, \
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override { \
|
||||
VariableValues *l) override { \
|
||||
transaction-> e .resolve(l, m_keyExclusion); \
|
||||
} \
|
||||
};
|
||||
@@ -88,7 +88,7 @@ class n : public Variable { \
|
||||
: Variable(#N) { } \
|
||||
\
|
||||
void evaluate(Transaction *transaction, \
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override { \
|
||||
VariableValues *l) override { \
|
||||
transaction-> e .evaluate(l); \
|
||||
} \
|
||||
};
|
||||
@@ -186,7 +186,7 @@ class VariableMonkeyResolution {
|
||||
|
||||
static void stringMatchResolveMulti(Transaction *t,
|
||||
const std::string &variable,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
size_t collection = variable.find(".");
|
||||
if (collection == std::string::npos) {
|
||||
collection = variable.find(":");
|
||||
@@ -576,7 +576,7 @@ class Variable : public VariableMonkeyResolution {
|
||||
|
||||
|
||||
virtual void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) = 0;
|
||||
VariableValues *l) = 0;
|
||||
|
||||
|
||||
bool inline belongsToCollection(Variable *var) const noexcept {
|
||||
@@ -727,7 +727,7 @@ class VariableModificatorExclusion : public Variable {
|
||||
m_base(std::move(var)) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
m_base->evaluate(t, l);
|
||||
}
|
||||
|
||||
@@ -744,9 +744,9 @@ class VariableModificatorCount : public Variable {
|
||||
}
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
|
||||
std::vector<std::shared_ptr<const VariableValue>> reslIn;
|
||||
VariableValues reslIn;
|
||||
m_base->evaluate(t, &reslIn);
|
||||
auto count = reslIn.size();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class WebAppId : public Variable {
|
||||
: Variable("WEBAPPID") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
const std::string rname = transaction->m_rules->m_secWebAppId.m_value;
|
||||
l->push_back(std::make_shared<VariableValue>(getVariableKeyWithCollection().get(), &rname));
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace variables {
|
||||
|
||||
#ifndef WITH_LIBXML2
|
||||
void XML_WithNSPath::evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) { }
|
||||
VariableValues *l) { }
|
||||
#else
|
||||
|
||||
void XML_WithNSPath::evaluate(Transaction *t,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) {
|
||||
VariableValues *l) {
|
||||
xmlXPathContextPtr xpathCtx;
|
||||
xmlXPathObjectPtr xpathObj;
|
||||
xmlNodeSetPtr nodes;
|
||||
|
||||
@@ -51,7 +51,7 @@ class XML_WithoutNSPath : public RuleVariable, public Variable {
|
||||
{ };
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override {
|
||||
VariableValues *l) override {
|
||||
l->push_back(m_var);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class XML_WithNSPath : public RuleVariable, public VariableDictElement {
|
||||
{ };
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
std::vector<std::shared_ptr<const VariableValue>> *l) override;
|
||||
VariableValues *l) override;
|
||||
|
||||
virtual Variable *clone() override {
|
||||
return new XML_WithNSPath(*this);
|
||||
|
||||
Reference in New Issue
Block a user