mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-17 01:51:52 +03:00
Refactoring in the Rule class to make it more elegant
This commit is contained in:
@@ -42,11 +42,11 @@ class Rule_DictElement : public VariableDictElement { \
|
||||
std::vector<const VariableValue *> *l) {
|
||||
RuleWithActions *r = rule;
|
||||
|
||||
if (!r || r->m_ruleId == 0) {
|
||||
if (!r || r->getId() == 0) {
|
||||
return;
|
||||
}
|
||||
std::unique_ptr<VariableOrigin> origin(new VariableOrigin());
|
||||
std::string *a = new std::string(std::to_string(r->m_ruleId));
|
||||
std::string *a = new std::string(std::to_string(r->getId()));
|
||||
VariableValue *var = new VariableValue(&m_rule, &m_rule_id,
|
||||
a
|
||||
);
|
||||
|
||||
@@ -89,9 +89,8 @@ void XML::evaluate(Transaction *t,
|
||||
if (rule == NULL) {
|
||||
ms_dbg_a(t, 2, "XML: Can't look for xmlns, internal error.");
|
||||
} else {
|
||||
std::vector<actions::Action *> acts = rule->getActionsByName("xmlns", t);
|
||||
for (auto &x : acts) {
|
||||
actions::XmlNS *z = (actions::XmlNS *)x;
|
||||
std::vector<actions::XmlNS *> acts = rule->getXmlNSsPtr();
|
||||
for (auto &z : acts) {
|
||||
if (xmlXPathRegisterNs(xpathCtx, (const xmlChar*)z->m_scope.c_str(),
|
||||
(const xmlChar*)z->m_href.c_str()) != 0) {
|
||||
ms_dbg_a(t, 1, "Failed to register XML namespace href \"" + \
|
||||
|
||||
Reference in New Issue
Block a user