mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 12:07:46 +03:00
Makes m_id a shared pointer
This commit is contained in:
@@ -125,7 +125,7 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, void *logCbData)
|
||||
m_rulesMessages(),
|
||||
m_requestBody(),
|
||||
m_responseBody(),
|
||||
m_id(),
|
||||
/* m_id(), */
|
||||
m_marker(""),
|
||||
m_skip_next(0),
|
||||
m_allowType(modsecurity::actions::disruptive::NoneAllowType),
|
||||
@@ -162,8 +162,9 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, void *logCbData)
|
||||
m_variableTimeYear(""),
|
||||
m_logCbData(logCbData),
|
||||
TransactionAnchoredVariables(this) {
|
||||
m_id = std::to_string(this->m_timeStamp) + \
|
||||
std::to_string(modsecurity::utils::generate_transaction_unique_id());
|
||||
m_id = std::unique_ptr<std::string>(
|
||||
new std::string(
|
||||
std::to_string(m_timeStamp)));
|
||||
|
||||
m_variableUrlEncodedError.set("0", 0);
|
||||
|
||||
@@ -198,7 +199,7 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, char *id, void *logCb
|
||||
m_rulesMessages(),
|
||||
m_requestBody(),
|
||||
m_responseBody(),
|
||||
m_id(std::string(id)),
|
||||
m_id(std::unique_ptr<std::string>(new std::string(id))),
|
||||
m_marker(""),
|
||||
m_skip_next(0),
|
||||
m_allowType(modsecurity::actions::disruptive::NoneAllowType),
|
||||
@@ -282,7 +283,7 @@ void Transaction::debug(int level, std::string message) const {
|
||||
return;
|
||||
}
|
||||
|
||||
m_rules->debug(level, m_id, m_uri, message);
|
||||
m_rules->debug(level, *m_id.get(), m_uri, message);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -318,7 +319,7 @@ int Transaction::processConnection(const char *client, int cPort,
|
||||
|
||||
|
||||
m_variableRemoteHost.set(*m_clientIpAddress.get(), m_variableOffset);
|
||||
m_variableUniqueID.set(m_id, m_variableOffset);
|
||||
m_variableUniqueID.set(*m_id.get(), m_variableOffset);
|
||||
m_variableRemoteAddr.set(*m_clientIpAddress.get(), m_variableOffset);
|
||||
m_variableServerAddr.set(*m_serverIpAddress.get(), m_variableOffset);
|
||||
m_variableServerPort.set(std::to_string(this->m_serverPort),
|
||||
@@ -1496,7 +1497,7 @@ std::string Transaction::toOldAuditLogFormatIndex(const std::string &filename,
|
||||
ss << utils::string::dash_if_empty(
|
||||
m_variableRequestHeaders.resolveFirst("User-Agent").get());
|
||||
ss << "\" ";
|
||||
ss << this->m_id << " ";
|
||||
ss << *m_id.get() << " ";
|
||||
/** TODO: Check variable */
|
||||
ss << utils::string::dash_if_empty(
|
||||
m_variableRequestHeaders.resolveFirst("REFERER").get()) << " ";
|
||||
@@ -1522,7 +1523,7 @@ std::string Transaction::toOldAuditLogFormat(int parts,
|
||||
audit_log << "--" << trailer << "-" << "A--" << std::endl;
|
||||
strftime(tstr, 299, "[%d/%b/%Y:%H:%M:%S %z]", &timeinfo);
|
||||
audit_log << tstr;
|
||||
audit_log << " " << this->m_id.c_str();
|
||||
audit_log << " " << m_id->c_str();
|
||||
audit_log << " " << this->m_clientIpAddress;
|
||||
audit_log << " " << this->m_clientPort;
|
||||
audit_log << " " << m_serverIpAddress;
|
||||
@@ -1648,7 +1649,7 @@ std::string Transaction::toJSON(int parts) {
|
||||
LOGFY_ADD_NUM("client_port", m_clientPort);
|
||||
LOGFY_ADD("host_ip", m_serverIpAddress->c_str());
|
||||
LOGFY_ADD_NUM("host_port", m_serverPort);
|
||||
LOGFY_ADD("unique_id", this->m_id.c_str());
|
||||
LOGFY_ADD("unique_id", m_id->c_str());
|
||||
|
||||
/* request */
|
||||
yajl_gen_string(g, reinterpret_cast<const unsigned char*>("request"),
|
||||
|
Reference in New Issue
Block a user