Handling key exceptions on the variable itself

This is the first step towords to solve #1697
This commit is contained in:
Felipe Zimmerle
2018-09-20 09:08:08 -03:00
parent 0d53111cb0
commit ee50fea266
54 changed files with 2337 additions and 2080 deletions

View File

@@ -24,8 +24,8 @@
#include "modsecurity/variable_origin.h"
#ifndef HEADERS_MODSECURITY_VARIABLE_H_
#define HEADERS_MODSECURITY_VARIABLE_H_
#ifndef HEADERS_MODSECURITY_VARIABLE_VALUE_H_
#define HEADERS_MODSECURITY_VARIABLE_VALUE_H_
#ifndef __cplusplus
typedef struct Variable_t VariableValue;
@@ -37,42 +37,44 @@ namespace modsecurity {
class Collection;
class VariableValue {
public:
explicit VariableValue(const std::string *key) :
m_key(""),
explicit VariableValue(const std::string *key)
: m_key(""),
m_value("") {
m_key.assign(*key);
m_keyWithCollection = std::make_shared<std::string>(*key);
}
VariableValue(const std::string *key, const std::string *value) :
m_key(""),
VariableValue(const std::string *key, const std::string *value)
: m_key(""),
m_value("") {
m_key.assign(*key);
m_value.assign(*value);
m_keyWithCollection = std::make_shared<std::string>(*key);
}
VariableValue() :
m_key(""),
VariableValue()
: m_key(""),
m_value("") {
m_keyWithCollection = std::make_shared<std::string>(m_key);
}
VariableValue(const std::string *a, const std::string *b, const std::string *c) :
m_key(*a + ":" + *b),
VariableValue(const std::string *a, const std::string *b,
const std::string *c)
: m_key(*a + ":" + *b),
m_value(*c) {
m_keyWithCollection = std::make_shared<std::string>(*a + ":" + *b);
}
VariableValue(std::shared_ptr<std::string> fullName) :
m_key(""),
explicit VariableValue(std::shared_ptr<std::string> fullName)
: m_key(""),
m_value("") {
m_keyWithCollection = fullName;
m_key.assign(*fullName.get());
}
VariableValue(std::shared_ptr<std::string> fullName, const std::string *value) :
m_key(""),
VariableValue(std::shared_ptr<std::string> fullName,
const std::string *value)
: m_key(""),
m_value("") {
m_value.assign(*value);
m_keyWithCollection = fullName;
@@ -106,4 +108,4 @@ class VariableValue {
} // namespace modsecurity
#endif
#endif // HEADERS_MODSECURITY_VARIABLE_H_
#endif // HEADERS_MODSECURITY_VARIABLE_VALUE_H_