Makes m_serverIpAddress a shared pointer

This commit is contained in:
Felipe Zimmerle
2019-01-22 15:18:25 -03:00
parent f06df087a7
commit 92f69532c4
4 changed files with 8 additions and 8 deletions

View File

@@ -108,7 +108,7 @@ class RuleMessage {
int m_ruleId;
int m_ruleLine;
bool m_saveMessage;
std::string m_serverIpAddress;
std::shared_ptr<std::string> m_serverIpAddress;
int m_severity;
std::string m_uriNoQueryStringDecoded;
std::string m_ver;

View File

@@ -396,7 +396,7 @@ class Transaction : public TransactionAnchoredVariables {
/**
* Holds the server IP Address
*/
std::string m_serverIpAddress;
std::shared_ptr<std::string> m_serverIpAddress;
/**
* Holds the raw URI that was requested.

View File

@@ -40,7 +40,7 @@ std::string RuleMessage::_details(const RuleMessage *rm) {
for (auto &a : rm->m_tags) {
msg.append(" [tag \"" + a + "\"]");
}
msg.append(" [hostname \"" + std::string(rm->m_serverIpAddress) \
msg.append(" [hostname \"" + *rm->m_serverIpAddress.get() \
+ "\"]");
msg.append(" [uri \"" + rm->m_uriNoQueryStringDecoded + "\"]");
msg.append(" [unique_id \"" + rm->m_id + "\"]");
@@ -53,7 +53,7 @@ std::string RuleMessage::_details(const RuleMessage *rm) {
std::string RuleMessage::_errorLogTail(const RuleMessage *rm) {
std::string msg;
msg.append("[hostname \"" + std::string(rm->m_serverIpAddress) + "\"]");
msg.append("[hostname \"" + *rm->m_serverIpAddress.get() + "\"]");
msg.append(" [uri \"" + rm->m_uriNoQueryStringDecoded + "\"]");
msg.append(" [unique_id \"" + rm->m_id + "\"]");

View File

@@ -251,7 +251,7 @@ void Transaction::debug(int level, std::string message) const {
int Transaction::processConnection(const char *client, int cPort,
const char *server, int sPort) {
m_clientIpAddress = std::unique_ptr<std::string>(new std::string(client));
this->m_serverIpAddress = server;
m_serverIpAddress = std::unique_ptr<std::string>(new std::string(server));
this->m_clientPort = cPort;
this->m_serverPort = sPort;
ms_dbg(4, "Transaction context created.");
@@ -261,7 +261,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_variableRemoteAddr.set(*m_clientIpAddress.get(), m_variableOffset);
m_variableServerAddr.set(m_serverIpAddress, m_variableOffset);
m_variableServerAddr.set(*m_serverIpAddress.get(), m_variableOffset);
m_variableServerPort.set(std::to_string(this->m_serverPort),
m_variableOffset);
m_variableRemotePort.set(std::to_string(this->m_clientPort),
@@ -1414,7 +1414,7 @@ std::string Transaction::toOldAuditLogFormat(int parts,
audit_log << " " << this->m_id.c_str();
audit_log << " " << this->m_clientIpAddress;
audit_log << " " << this->m_clientPort;
audit_log << " " << this->m_serverIpAddress;
audit_log << " " << m_serverIpAddress;
audit_log << " " << this->m_serverPort;
audit_log << std::endl;
@@ -1536,7 +1536,7 @@ std::string Transaction::toJSON(int parts) {
LOGFY_ADD("time_stamp", ts.c_str());
LOGFY_ADD("server_id", uniqueId.c_str());
LOGFY_ADD_NUM("client_port", m_clientPort);
LOGFY_ADD("host_ip", m_serverIpAddress.c_str());
LOGFY_ADD("host_ip", m_serverIpAddress->c_str());
LOGFY_ADD_NUM("host_port", m_serverPort);
LOGFY_ADD("unique_id", this->m_id.c_str());