mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 01:22:18 +03:00
Cosmetics: Defining a type for RuleId
This commit is contained in:
@@ -95,6 +95,8 @@ namespace modsecurity {
|
|||||||
*/
|
*/
|
||||||
using ModSecString = std::string;
|
using ModSecString = std::string;
|
||||||
|
|
||||||
|
using RuleId = int64_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The Phases enumerator consists in mapping the different stages of a
|
* The Phases enumerator consists in mapping the different stages of a
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ class Rules {
|
|||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
int append(Rules *from,
|
int append(Rules *from,
|
||||||
const std::vector<int64_t> &ids,
|
const std::vector<RuleId> &ids,
|
||||||
std::ostringstream *err);
|
std::ostringstream *err);
|
||||||
|
|
||||||
bool insert(const std::shared_ptr<Rule> &rule);
|
bool insert(const std::shared_ptr<Rule> &rule);
|
||||||
|
|
||||||
bool insert(std::shared_ptr<Rule> rule,
|
bool insert(std::shared_ptr<Rule> rule,
|
||||||
const std::vector<int64_t> *ids,
|
const std::vector<RuleId> *ids,
|
||||||
std::ostringstream *err);
|
std::ostringstream *err);
|
||||||
|
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ class Driver;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "modsecurity/rule_unconditional.h"
|
#include "src/rule_unconditional.h"
|
||||||
#include "modsecurity/rule_with_operator.h"
|
#include "src/rule_with_operator.h"
|
||||||
#include "modsecurity/rule_with_actions.h"
|
#include "src/rule_with_actions.h"
|
||||||
#include "src/rule_script.h"
|
#include "src/rule_script.h"
|
||||||
|
|
||||||
#include "src/actions/accuracy.h"
|
#include "src/actions/accuracy.h"
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ class RuleWithActions : public Rule {
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int64_t getId() const { return m_ruleId; }
|
inline RuleId getId() const { return m_ruleId; }
|
||||||
void setId(int id) {
|
void setId(int id) {
|
||||||
m_ruleId = id;
|
m_ruleId = id;
|
||||||
}
|
}
|
||||||
@@ -455,7 +455,7 @@ class RuleWithActions : public Rule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int64_t m_ruleId;
|
RuleId m_ruleId;
|
||||||
|
|
||||||
std::shared_ptr<RuleWithActions> m_chainedRuleChild;
|
std::shared_ptr<RuleWithActions> m_chainedRuleChild;
|
||||||
RuleWithActions *m_chainedRuleParent;
|
RuleWithActions *m_chainedRuleParent;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
namespace modsecurity {
|
namespace modsecurity {
|
||||||
|
|
||||||
|
|
||||||
int Rules::append(Rules *from, const std::vector<int64_t> &ids, std::ostringstream *err) {
|
int Rules::append(Rules *from, const std::vector<RuleId> &ids, std::ostringstream *err) {
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
for (; j < from->size(); j++) {
|
for (; j < from->size(); j++) {
|
||||||
RuleWithActions *rule = dynamic_cast<RuleWithActions*>(from->at(j).get());
|
RuleWithActions *rule = dynamic_cast<RuleWithActions*>(from->at(j).get());
|
||||||
@@ -42,7 +42,7 @@ bool Rules::insert(const std::shared_ptr<Rule> &rule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Rules::insert(std::shared_ptr<Rule> rule, const std::vector<int64_t> *ids, std::ostringstream *err) {
|
bool Rules::insert(std::shared_ptr<Rule> rule, const std::vector<RuleId> *ids, std::ostringstream *err) {
|
||||||
RuleWithActions*r = dynamic_cast<RuleWithActions*>(rule.get());
|
RuleWithActions*r = dynamic_cast<RuleWithActions*>(rule.get());
|
||||||
if (r && ids != nullptr
|
if (r && ids != nullptr
|
||||||
&& std::binary_search(ids->begin(), ids->end(), r->getId())) {
|
&& std::binary_search(ids->begin(), ids->end(), r->getId())) {
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ noConstructor:src/variables/variable.h:152
|
|||||||
duplicateBranch:src/request_body_processor/multipart.cc:93
|
duplicateBranch:src/request_body_processor/multipart.cc:93
|
||||||
knownConditionTrueFalse:src/operators/validate_url_encoding.cc:77
|
knownConditionTrueFalse:src/operators/validate_url_encoding.cc:77
|
||||||
knownConditionTrueFalse:src/operators/verify_svnr.cc:88
|
knownConditionTrueFalse:src/operators/verify_svnr.cc:88
|
||||||
|
noConstructor:src/actions/rule_id.h:33
|
||||||
|
functionStatic:src/actions/rule_id.h:35
|
||||||
|
|
||||||
noExplicitConstructor:seclang-parser.hh
|
noExplicitConstructor:seclang-parser.hh
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user