mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 10:20:35 +03:00
Refactoring on {global,ip,resources,session,tx,user} collections
Now using the same name schema and interface for these "special" collection. Fix: #1754, #1778
This commit is contained in:
@@ -34,14 +34,14 @@ namespace Variables {
|
||||
class Session_DictElement : public Variable {
|
||||
public:
|
||||
explicit Session_DictElement(std::string dictElement)
|
||||
: Variable("SESSION"),
|
||||
m_dictElement(dictElement) { }
|
||||
: Variable("SESSION:" + dictElement),
|
||||
m_dictElement("SESSION:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
t->m_collections.m_session_collection->resolveMultiMatches(
|
||||
m_dictElement, t->m_collections.m_session_collection_key,
|
||||
m_name, t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Session_NoDictElement : public Variable {
|
||||
void evaluate(Transaction *t,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
t->m_collections.m_session_collection->resolveMultiMatches(m_name,
|
||||
t->m_collections.m_session_collection->resolveMultiMatches("",
|
||||
t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
@@ -96,18 +96,21 @@ class Session_DynamicElement : public Variable {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_session_collection->resolveMultiMatches(
|
||||
string,
|
||||
t->m_collections.m_session_collection_key, l);
|
||||
t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
void del(Transaction *t, std::string k) {
|
||||
t->m_collections.m_session_collection->del(k,
|
||||
t->m_collections.m_session_collection_key);
|
||||
t->m_collections.m_session_collection_key,
|
||||
t->m_collections.m_ip_collection_key);
|
||||
}
|
||||
|
||||
void storeOrUpdateFirst(Transaction *t, std::string var,
|
||||
std::string value) {
|
||||
t->m_collections.m_session_collection->storeOrUpdateFirst(
|
||||
var, t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value,
|
||||
value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user