mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-17 14:46:13 +03:00
Fix 7495675d540b3b3ccce681773205a4fe34daeb64
This commit is contained in:
parent
b7e28c246f
commit
22ec307739
@ -46,7 +46,7 @@ class RulesSet : public RulesProperties {
|
|||||||
public:
|
public:
|
||||||
RulesSet()
|
RulesSet()
|
||||||
: RulesProperties(new DebugLog()),
|
: RulesProperties(new DebugLog()),
|
||||||
unicode_codepage(0),
|
unicode_codepage(0)
|
||||||
#ifndef NO_LOGS
|
#ifndef NO_LOGS
|
||||||
,m_secmarker_skipped(0)
|
,m_secmarker_skipped(0)
|
||||||
#endif
|
#endif
|
||||||
|
45
src/rules.cc
45
src/rules.cc
@ -31,51 +31,6 @@ using modsecurity::Utils::HttpsClient;
|
|||||||
namespace modsecurity {
|
namespace modsecurity {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name incrementReferenceCount
|
|
||||||
* @brief Increment the number of transactions using this class
|
|
||||||
* @ingroup ModSecCore
|
|
||||||
*
|
|
||||||
* At certain point it is expected to have two differnt
|
|
||||||
* groups of rules attached to a specific core, this happens
|
|
||||||
* for instance when a webserver is reloading its
|
|
||||||
* configurations, the old configurations/rules is available
|
|
||||||
* for the old connections and the new rules are available
|
|
||||||
* for the newest connections.
|
|
||||||
*
|
|
||||||
* @return Number of the current transactions using this rules
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void RulesSet::incrementReferenceCount(void) {
|
|
||||||
this->m_referenceCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name decrementReferenceCount
|
|
||||||
* @brief Decrement the number of transactions using this class
|
|
||||||
* @ingroup ModSecCore
|
|
||||||
*
|
|
||||||
* @return Number of the current transactions using this rules
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void RulesSet::decrementReferenceCount(void) {
|
|
||||||
this->m_referenceCount--;
|
|
||||||
if (this->m_referenceCount == 0) {
|
|
||||||
/**
|
|
||||||
* FIXME: If there are new rules loaded (new instance
|
|
||||||
* of this class) and the reference is zero, we
|
|
||||||
* can delete this instance freeing some memory.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* std::cout << "We may want to delete this rules instance" \
|
|
||||||
* << std::endl;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name loadFromUri
|
* @name loadFromUri
|
||||||
* @brief load rules from a give uri
|
* @brief load rules from a give uri
|
||||||
|
@ -164,7 +164,6 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, void *logCbData)
|
|||||||
TransactionAnchoredVariables(this) {
|
TransactionAnchoredVariables(this) {
|
||||||
m_id = std::to_string(this->m_timeStamp) + \
|
m_id = std::to_string(this->m_timeStamp) + \
|
||||||
std::to_string(modsecurity::utils::generate_transaction_unique_id());
|
std::to_string(modsecurity::utils::generate_transaction_unique_id());
|
||||||
m_rules->incrementReferenceCount();
|
|
||||||
|
|
||||||
m_variableUrlEncodedError.set("0", 0);
|
m_variableUrlEncodedError.set("0", 0);
|
||||||
|
|
||||||
@ -236,7 +235,6 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, char *id, void *logCb
|
|||||||
m_variableTimeYear(""),
|
m_variableTimeYear(""),
|
||||||
m_logCbData(logCbData),
|
m_logCbData(logCbData),
|
||||||
TransactionAnchoredVariables(this) {
|
TransactionAnchoredVariables(this) {
|
||||||
m_rules->incrementReferenceCount();
|
|
||||||
|
|
||||||
m_variableUrlEncodedError.set("0", 0);
|
m_variableUrlEncodedError.set("0", 0);
|
||||||
|
|
||||||
@ -255,8 +253,6 @@ Transaction::~Transaction() {
|
|||||||
|
|
||||||
m_rulesMessages.clear();
|
m_rulesMessages.clear();
|
||||||
|
|
||||||
m_rules->decrementReferenceCount();
|
|
||||||
|
|
||||||
intervention::free(&m_it);
|
intervention::free(&m_it);
|
||||||
intervention::clean(&m_it);
|
intervention::clean(&m_it);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user