Makes m_uri_no_query_string_decoded a shared pointer

This commit is contained in:
Felipe Zimmerle
2019-01-22 15:36:33 -03:00
parent 92f69532c4
commit 0d2abed05d
4 changed files with 10 additions and 8 deletions

View File

@@ -110,7 +110,7 @@ class RuleMessage {
bool m_saveMessage;
std::shared_ptr<std::string> m_serverIpAddress;
int m_severity;
std::string m_uriNoQueryStringDecoded;
std::shared_ptr<std::string> m_uriNoQueryStringDecoded;
std::string m_ver;
std::list<std::string> m_tags;

View File

@@ -406,7 +406,7 @@ class Transaction : public TransactionAnchoredVariables {
/**
* Holds the URI that was requests (without the query string).
*/
std::string m_uri_no_query_string_decoded;
std::shared_ptr<std::string> m_uri_no_query_string_decoded;
/**
* Holds the combined size of all arguments, later used to fill the

View File

@@ -42,7 +42,7 @@ std::string RuleMessage::_details(const RuleMessage *rm) {
}
msg.append(" [hostname \"" + *rm->m_serverIpAddress.get() \
+ "\"]");
msg.append(" [uri \"" + rm->m_uriNoQueryStringDecoded + "\"]");
msg.append(" [uri \"" + *rm->m_uriNoQueryStringDecoded.get() + "\"]");
msg.append(" [unique_id \"" + rm->m_id + "\"]");
msg.append(" [ref \"" + rm->m_reference + "\"]");
@@ -54,7 +54,7 @@ std::string RuleMessage::_errorLogTail(const RuleMessage *rm) {
std::string msg;
msg.append("[hostname \"" + *rm->m_serverIpAddress.get() + "\"]");
msg.append(" [uri \"" + rm->m_uriNoQueryStringDecoded + "\"]");
msg.append(" [uri \"" + *rm->m_uriNoQueryStringDecoded.get() + "\"]");
msg.append(" [unique_id \"" + rm->m_id + "\"]");
return msg;

View File

@@ -102,7 +102,7 @@ namespace modsecurity {
Transaction::Transaction(ModSecurity *ms, RulesSet *rules, void *logCbData)
: m_clientPort(0),
m_serverPort(0),
m_uri_no_query_string_decoded(""),
m_uri_no_query_string_decoded(nullptr),
m_rules(rules),
m_timeStamp(std::time(NULL)),
m_httpCodeReturned(200),
@@ -145,7 +145,7 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, void *logCbData)
Transaction::Transaction(ModSecurity *ms, RulesSet *rules, char *id, void *logCbData)
: m_clientPort(0),
m_serverPort(0),
m_uri_no_query_string_decoded(""),
m_uri_no_query_string_decoded(nullptr),
m_rules(rules),
m_timeStamp(std::time(NULL)),
m_httpCodeReturned(200),
@@ -413,9 +413,11 @@ int Transaction::processURI(const char *uri, const char *method,
if (pos != std::string::npos) {
m_uri_no_query_string_decoded = std::string(m_uri_decoded, 0, pos);
m_uri_no_query_string_decoded = std::unique_ptr<std::string>(
new std::string(m_uri_decoded, 0, pos));
} else {
m_uri_no_query_string_decoded = std::string(m_uri_decoded);
m_uri_no_query_string_decoded = std::unique_ptr<std::string>(
new std::string(m_uri_decoded));
}