mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 18:30: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 User_DictElement : public Variable {
|
||||
public:
|
||||
explicit User_DictElement(std::string dictElement)
|
||||
: Variable("USER"),
|
||||
m_dictElement(dictElement) { }
|
||||
: Variable("USER:" + dictElement),
|
||||
m_dictElement("USER:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *t,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
t->m_collections.m_user_collection->resolveMultiMatches(
|
||||
m_dictElement, t->m_collections.m_user_collection_key,
|
||||
m_name, t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
@@ -95,18 +95,22 @@ class User_DynamicElement : public Variable {
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
std::string string = m_string->evaluate(t);
|
||||
t->m_collections.m_user_collection->resolveMultiMatches(
|
||||
string, t->m_collections.m_user_collection_key, l);
|
||||
string,
|
||||
t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
void del(Transaction *t, std::string k) {
|
||||
t->m_collections.m_user_collection->del(k,
|
||||
t->m_collections.m_user_collection_key);
|
||||
t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value);
|
||||
}
|
||||
|
||||
void storeOrUpdateFirst(Transaction *t, std::string var,
|
||||
std::string value) {
|
||||
t->m_collections.m_user_collection->storeOrUpdateFirst(
|
||||
var, t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value,
|
||||
value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user