mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Fix assorted memory and static analysis errors
This commit is contained in:
parent
8d0583eda4
commit
e95efa05cc
@ -59,10 +59,10 @@ cppcheck:
|
|||||||
--enable=all \
|
--enable=all \
|
||||||
--inconclusive \
|
--inconclusive \
|
||||||
--template="warning: {file},{line},{severity},{id},{message}" \
|
--template="warning: {file},{line},{severity},{id},{message}" \
|
||||||
-U YYSTYPE \
|
|
||||||
-U YY_USER_INIT \
|
|
||||||
--std=posix . 2> cppcheck.txt
|
--std=posix . 2> cppcheck.txt
|
||||||
cat cppcheck.txt
|
cat cppcheck.txt
|
||||||
|
# -U YYSTYPE
|
||||||
|
# -U YY_USER_INIT
|
||||||
|
|
||||||
check-static: cppcheck
|
check-static: cppcheck
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ ModSecurity *modsec = NULL;
|
|||||||
|
|
||||||
|
|
||||||
void process_special_request (int j) {
|
void process_special_request (int j) {
|
||||||
Transaction *transaction = NULL;
|
Transaction *transaction;
|
||||||
transaction = msc_new_transaction(modsec, rules, NULL);
|
transaction = msc_new_transaction(modsec, rules, NULL);
|
||||||
|
|
||||||
msc_process_connection(transaction, "127.0.0.1", 12345, "127.0.0.1", 80);
|
msc_process_connection(transaction, "127.0.0.1", 12345, "127.0.0.1", 80);
|
||||||
@ -61,7 +61,7 @@ void process_request (int j) {
|
|||||||
}
|
}
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
Transaction *transaction = NULL;
|
Transaction *transaction;
|
||||||
transaction = msc_new_transaction(modsec, rules, NULL);
|
transaction = msc_new_transaction(modsec, rules, NULL);
|
||||||
|
|
||||||
msc_process_connection(transaction, "127.0.0.1", 12345, "127.0.0.1", 80);
|
msc_process_connection(transaction, "127.0.0.1", 12345, "127.0.0.1", 80);
|
||||||
|
@ -27,9 +27,9 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
const char *error = NULL;
|
const char *error = NULL;
|
||||||
ModSecurity *modsec = NULL;
|
ModSecurity *modsec;
|
||||||
Transaction *transaction = NULL;
|
Transaction *transaction = NULL;
|
||||||
Rules *rules = NULL;
|
Rules *rules;
|
||||||
|
|
||||||
modsec = msc_init();
|
modsec = msc_init();
|
||||||
|
|
||||||
|
@ -25,9 +25,8 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <vector>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "modsecurity/collection/variable.h"
|
#include "modsecurity/collection/variable.h"
|
||||||
@ -40,7 +39,7 @@
|
|||||||
namespace modsecurity {
|
namespace modsecurity {
|
||||||
class Transaction;
|
class Transaction;
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class Regex;
|
class Regex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,8 +65,8 @@ struct MyHash{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AnchoredSetVariable : public std::unordered_multimap<std::string, collection::Variable *,
|
class AnchoredSetVariable : public std::unordered_multimap<std::string,
|
||||||
MyHash, MyEqual> {
|
collection::Variable *, MyHash, MyEqual> {
|
||||||
public:
|
public:
|
||||||
AnchoredSetVariable(Transaction *t, std::string name);
|
AnchoredSetVariable(Transaction *t, std::string name);
|
||||||
~AnchoredSetVariable();
|
~AnchoredSetVariable();
|
||||||
@ -76,6 +75,7 @@ class AnchoredSetVariable : public std::unordered_multimap<std::string, collecti
|
|||||||
|
|
||||||
void set(const std::string &key, const std::string &value,
|
void set(const std::string &key, const std::string &value,
|
||||||
size_t offset);
|
size_t offset);
|
||||||
|
void setCopy(std::string key, std::string value, size_t offset);
|
||||||
|
|
||||||
void resolve(std::vector<const collection::Variable *> *l);
|
void resolve(std::vector<const collection::Variable *> *l);
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "modsecurity/collection/variable.h"
|
#include "modsecurity/collection/variable.h"
|
||||||
@ -64,5 +65,5 @@ class AnchoredVariable {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // HEADERS_MODSECURITY_ANCHORED_SET_VARIABLE_H_
|
#endif // HEADERS_MODSECURITY_ANCHORED_VARIABLE_H_
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +51,8 @@ class Collection {
|
|||||||
|
|
||||||
virtual void del(const std::string& key) = 0;
|
virtual void del(const std::string& key) = 0;
|
||||||
|
|
||||||
virtual std::unique_ptr<std::string> resolveFirst(const std::string& var) = 0;
|
virtual std::unique_ptr<std::string> resolveFirst(
|
||||||
|
const std::string& var) = 0;
|
||||||
|
|
||||||
virtual void resolveSingleMatch(const std::string& var,
|
virtual void resolveSingleMatch(const std::string& var,
|
||||||
std::vector<const Variable *> *l) = 0;
|
std::vector<const Variable *> *l) = 0;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "modsecurity/collection/collection.h"
|
#include "modsecurity/collection/collection.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HEADERS_MODSECURITY_RULE_H_
|
#ifndef HEADERS_MODSECURITY_RULE_H_
|
||||||
@ -48,21 +49,20 @@ class Rule {
|
|||||||
std::vector<actions::Action *> *_actions,
|
std::vector<actions::Action *> *_actions,
|
||||||
std::string fileName,
|
std::string fileName,
|
||||||
int lineNumber);
|
int lineNumber);
|
||||||
Rule(std::__cxx11::string marker);
|
explicit Rule(std::__cxx11::string marker);
|
||||||
~Rule();
|
~Rule();
|
||||||
|
|
||||||
bool evaluate(Transaction *transaction);
|
bool evaluate(Transaction *transaction);
|
||||||
bool evaluateActions(Transaction *transaction);
|
bool evaluateActions(Transaction *transaction);
|
||||||
std::vector<std::unique_ptr<collection::Variable>> getFinalVars(Transaction *trasn);
|
std::vector<std::unique_ptr<collection::Variable>>
|
||||||
|
getFinalVars(Transaction *trasn);
|
||||||
void executeActionsAfterFullMatch(Transaction *trasn,
|
void executeActionsAfterFullMatch(Transaction *trasn,
|
||||||
bool containsDisruptive, RuleMessage *ruleMessage);
|
bool containsDisruptive, RuleMessage *ruleMessage);
|
||||||
std::list<
|
|
||||||
std::pair<
|
std::list<std::pair<std::shared_ptr<std::string>,
|
||||||
std::unique_ptr<std::string>,
|
std::shared_ptr<std::string>>> executeDefaultTransformations(
|
||||||
std::unique_ptr<std::string>
|
|
||||||
>
|
|
||||||
> executeSecDefaultActionTransofrmations(
|
|
||||||
Transaction *trasn, const std::string &value, bool multiMatch);
|
Transaction *trasn, const std::string &value, bool multiMatch);
|
||||||
|
|
||||||
bool executeOperatorAt(Transaction *trasn, std::string key,
|
bool executeOperatorAt(Transaction *trasn, std::string key,
|
||||||
std::string value, RuleMessage *rm);
|
std::string value, RuleMessage *rm);
|
||||||
void executeActionsIndependentOfChainedRuleResult(Transaction *trasn,
|
void executeActionsIndependentOfChainedRuleResult(Transaction *trasn,
|
||||||
@ -111,6 +111,7 @@ class Rule {
|
|||||||
bool m_secMarker;
|
bool m_secMarker;
|
||||||
std::vector<Variables::Variable *> *m_variables;
|
std::vector<Variables::Variable *> *m_variables;
|
||||||
std::string m_ver;
|
std::string m_ver;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_unconditional;
|
bool m_unconditional;
|
||||||
int m_referenceCount;
|
int m_referenceCount;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "modsecurity/rule.h"
|
#include "modsecurity/rule.h"
|
||||||
|
@ -35,7 +35,7 @@ namespace transformations {
|
|||||||
std::string HexDecode::evaluate(std::string value,
|
std::string HexDecode::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
|
@ -36,7 +36,7 @@ namespace transformations {
|
|||||||
std::string HtmlEntityDecode::evaluate(std::string value,
|
std::string HtmlEntityDecode::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
@ -98,7 +98,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
|||||||
}
|
}
|
||||||
if (j > k) { /* Do we have at least one digit? */
|
if (j > k) { /* Do we have at least one digit? */
|
||||||
/* Decode the entity. */
|
/* Decode the entity. */
|
||||||
char *x = NULL;
|
char *x;
|
||||||
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
||||||
((j - k) + 1)));
|
((j - k) + 1)));
|
||||||
memcpy(x, (const char *)&input[k], j - k);
|
memcpy(x, (const char *)&input[k], j - k);
|
||||||
@ -124,7 +124,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
|||||||
}
|
}
|
||||||
if (j > k) { /* Do we have at least one digit? */
|
if (j > k) { /* Do we have at least one digit? */
|
||||||
/* Decode the entity. */
|
/* Decode the entity. */
|
||||||
char *x = NULL;
|
char *x;
|
||||||
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
||||||
((j - k) + 1)));
|
((j - k) + 1)));
|
||||||
memcpy(x, (const char *)&input[k], j - k);
|
memcpy(x, (const char *)&input[k], j - k);
|
||||||
@ -150,7 +150,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) {
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if (j > k) { /* Do we have at least one digit? */
|
if (j > k) { /* Do we have at least one digit? */
|
||||||
char *x = NULL;
|
char *x;
|
||||||
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
x = reinterpret_cast<char *>(calloc(sizeof(char),
|
||||||
((j - k) + 1)));
|
((j - k) + 1)));
|
||||||
memcpy(x, (const char *)&input[k], j - k);
|
memcpy(x, (const char *)&input[k], j - k);
|
||||||
|
@ -37,7 +37,7 @@ namespace transformations {
|
|||||||
std::string JsDecode::evaluate(std::string value,
|
std::string JsDecode::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
|
@ -35,7 +35,7 @@ namespace transformations {
|
|||||||
std::string ParityEven7bit::evaluate(std::string value,
|
std::string ParityEven7bit::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
|
@ -35,7 +35,7 @@ namespace transformations {
|
|||||||
std::string ParityOdd7bit::evaluate(std::string value,
|
std::string ParityOdd7bit::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
|
@ -35,7 +35,7 @@ namespace transformations {
|
|||||||
std::string ParityZero7bit::evaluate(std::string value,
|
std::string ParityZero7bit::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
|
@ -35,7 +35,7 @@ namespace transformations {
|
|||||||
std::string RemoveComments::evaluate(std::string value,
|
std::string RemoveComments::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
|
@ -44,7 +44,7 @@ namespace transformations {
|
|||||||
std::string SqlHexDecode::evaluate(std::string value,
|
std::string SqlHexDecode::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
|
@ -38,7 +38,7 @@ namespace transformations {
|
|||||||
std::string UrlDecodeUni::evaluate(std::string value,
|
std::string UrlDecodeUni::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
|
|
||||||
input = reinterpret_cast<unsigned char *>
|
input = reinterpret_cast<unsigned char *>
|
||||||
(malloc(sizeof(char) * value.length()+1));
|
(malloc(sizeof(char) * value.length()+1));
|
||||||
|
@ -36,7 +36,7 @@ namespace transformations {
|
|||||||
std::string Utf8ToUnicode::evaluate(std::string value,
|
std::string Utf8ToUnicode::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
unsigned char *input = NULL;
|
unsigned char *input;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "modsecurity/collection/variable.h"
|
#include "modsecurity/collection/variable.h"
|
||||||
@ -155,7 +156,8 @@ void InMemoryPerProcess::resolveRegularExpression(const std::string& var,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<std::string> InMemoryPerProcess::resolveFirst(const std::string& var) {
|
std::unique_ptr<std::string> InMemoryPerProcess::resolveFirst(
|
||||||
|
const std::string& var) {
|
||||||
auto range = equal_range(var);
|
auto range = equal_range(var);
|
||||||
|
|
||||||
for (auto it = range.first; it != range.second; ++it) {
|
for (auto it = range.first; it != range.second; ++it) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "modsecurity/collection/variable.h"
|
#include "modsecurity/collection/variable.h"
|
||||||
#include "src/utils/regex.h"
|
#include "src/utils/regex.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_LMDB
|
#ifdef WITH_LMDB
|
||||||
|
@ -145,8 +145,8 @@ std::unique_ptr<std::string> Collections::resolveFirst(const std::string& var) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<std::string> Collections::resolveFirst(const std::string& collectionName,
|
std::unique_ptr<std::string> Collections::resolveFirst(
|
||||||
const std::string& var) {
|
const std::string& collectionName, const std::string& var) {
|
||||||
if (utils::string::tolower(collectionName) == "ip"
|
if (utils::string::tolower(collectionName) == "ip"
|
||||||
&& !m_ip_collection_key.empty()) {
|
&& !m_ip_collection_key.empty()) {
|
||||||
return m_ip_collection->resolveFirst(
|
return m_ip_collection->resolveFirst(
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "src/macro_expansion.h"
|
#include "src/macro_expansion.h"
|
||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "modsecurity/collection/variable.h"
|
#include "modsecurity/collection/variable.h"
|
||||||
|
@ -843,7 +843,7 @@ namespace yy {
|
|||||||
|
|
||||||
|
|
||||||
// User initialization code.
|
// User initialization code.
|
||||||
#line 338 "/home/zimmerle/core/ModSecurity/src/parser/seclang-parser.yy" // lalr1.cc:741
|
#line 338 "/home/zimmerle/core-trustwave/ModSecurity/src/parser/seclang-parser.yy" // lalr1.cc:741
|
||||||
{
|
{
|
||||||
// Initialize the initial location.
|
// Initialize the initial location.
|
||||||
yyla.location.begin.filename = yyla.location.end.filename = &driver.file;
|
yyla.location.begin.filename = yyla.location.end.filename = &driver.file;
|
||||||
|
@ -343,8 +343,6 @@ int Multipart::parse_content_disposition(const char *c_d_value) {
|
|||||||
validate_quotes(value.c_str());
|
validate_quotes(value.c_str());
|
||||||
|
|
||||||
m_transaction->m_variableMultiPartName.set(value, value, 0);
|
m_transaction->m_variableMultiPartName.set(value, value, 0);
|
||||||
//m_transaction->m_collections.storeOrUpdateFirst("MULTIPART_NAME",
|
|
||||||
// value);
|
|
||||||
|
|
||||||
if (!m_mpp->m_name.empty()) {
|
if (!m_mpp->m_name.empty()) {
|
||||||
debug(4, "Multipart: Warning: Duplicate Content-Disposition " \
|
debug(4, "Multipart: Warning: Duplicate Content-Disposition " \
|
||||||
|
73
src/rule.cc
73
src/rule.cc
@ -206,20 +206,24 @@ void Rule::cleanMatchedVars(Transaction *trasn) {
|
|||||||
|
|
||||||
void Rule::updateRulesVariable(Transaction *trasn) {
|
void Rule::updateRulesVariable(Transaction *trasn) {
|
||||||
if (m_ruleId != 0) {
|
if (m_ruleId != 0) {
|
||||||
trasn->m_variableRule.set("id", std::to_string(m_ruleId), 0);
|
trasn->m_variableRule.set("id",
|
||||||
|
std::to_string(m_ruleId), 0);
|
||||||
}
|
}
|
||||||
if (m_rev.empty() == false) {
|
if (m_rev.empty() == false) {
|
||||||
trasn->m_variableRule.set("rev", m_rev, 0);
|
trasn->m_variableRule.set("rev",
|
||||||
|
m_rev, 0);
|
||||||
}
|
}
|
||||||
if (getActionsByName("msg").size() > 0) {
|
if (getActionsByName("msg").size() > 0) {
|
||||||
actions::Msg *msg = dynamic_cast<actions::Msg*>(
|
actions::Msg *msg = dynamic_cast<actions::Msg*>(
|
||||||
getActionsByName("msg")[0]);
|
getActionsByName("msg")[0]);
|
||||||
trasn->m_variableRule.set("msg", msg->data(trasn), 0);
|
trasn->m_variableRule.set("msg",
|
||||||
|
msg->data(trasn), 0);
|
||||||
}
|
}
|
||||||
if (getActionsByName("logdata").size() > 0) {
|
if (getActionsByName("logdata").size() > 0) {
|
||||||
actions::LogData *data = dynamic_cast<actions::LogData*>(
|
actions::LogData *data = dynamic_cast<actions::LogData*>(
|
||||||
getActionsByName("logdata")[0]);
|
getActionsByName("logdata")[0]);
|
||||||
trasn->m_variableRule.set("logdata", data->data(trasn), 0);
|
trasn->m_variableRule.set("logdata",
|
||||||
|
data->data(trasn), 0);
|
||||||
}
|
}
|
||||||
if (getActionsByName("severity").size() > 0) {
|
if (getActionsByName("severity").size() > 0) {
|
||||||
actions::Severity *data = dynamic_cast<actions::Severity*>(
|
actions::Severity *data = dynamic_cast<actions::Severity*>(
|
||||||
@ -295,34 +299,33 @@ bool Rule::executeOperatorAt(Transaction *trasn, std::string key,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this should be a list instead of a vector, keeping the but
|
|
||||||
// of v2 alive.
|
std::list<std::pair<std::shared_ptr<std::string>,
|
||||||
std::list<std::pair<std::unique_ptr<std::string>,
|
std::shared_ptr<std::string>>>
|
||||||
std::unique_ptr<std::string>>>
|
Rule::executeDefaultTransformations(
|
||||||
Rule::executeSecDefaultActionTransofrmations(
|
|
||||||
|
|
||||||
Transaction *trasn, const std::string &in, bool multiMatch) {
|
Transaction *trasn, const std::string &in, bool multiMatch) {
|
||||||
int none = 0;
|
int none = 0;
|
||||||
int transformations = 0;
|
int transformations = 0;
|
||||||
|
|
||||||
std::list<std::pair<std::unique_ptr<std::string>,
|
std::list<std::pair<std::shared_ptr<std::string>,
|
||||||
std::unique_ptr<std::string>>> ret;
|
std::shared_ptr<std::string>>> ret;
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<std::string> value =
|
std::shared_ptr<std::string> value =
|
||||||
std::unique_ptr<std::string>(new std::string(in));
|
std::shared_ptr<std::string>(new std::string(in));
|
||||||
std::unique_ptr<std::string> newValue;
|
std::shared_ptr<std::string> newValue;
|
||||||
|
|
||||||
std::unique_ptr<std::string> trans =
|
std::shared_ptr<std::string> trans =
|
||||||
std::unique_ptr<std::string>(new std::string());
|
std::shared_ptr<std::string>(new std::string());
|
||||||
|
|
||||||
if (multiMatch == true) {
|
if (multiMatch == true) {
|
||||||
ret.push_back(std::make_pair(
|
ret.push_back(std::make_pair(
|
||||||
std::move(value),
|
std::shared_ptr<std::string>(value),
|
||||||
std::move(trans)));
|
std::shared_ptr<std::string>(trans)));
|
||||||
ret.push_back(std::make_pair(
|
ret.push_back(std::make_pair(
|
||||||
std::move(value),
|
std::shared_ptr<std::string>(value),
|
||||||
std::move(trans)));
|
std::shared_ptr<std::string>(trans)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Action *a : this->m_actionsRuntimePre) {
|
for (Action *a : this->m_actionsRuntimePre) {
|
||||||
@ -344,11 +347,11 @@ std::list<std::pair<std::unique_ptr<std::string>,
|
|||||||
if (multiMatch == true) {
|
if (multiMatch == true) {
|
||||||
if (*newValue != *value) {
|
if (*newValue != *value) {
|
||||||
ret.push_back(std::make_pair(
|
ret.push_back(std::make_pair(
|
||||||
std::move(newValue),
|
newValue,
|
||||||
std::move(trans)));
|
trans));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = std::move(newValue);
|
value = std::shared_ptr<std::string>(newValue);
|
||||||
if (trans->empty()) {
|
if (trans->empty()) {
|
||||||
trans->append(a->m_name);
|
trans->append(a->m_name);
|
||||||
} else {
|
} else {
|
||||||
@ -364,22 +367,21 @@ std::list<std::pair<std::unique_ptr<std::string>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Action *a : this->m_actionsRuntimePre) {
|
for (Action *a : this->m_actionsRuntimePre) {
|
||||||
if (none == 0) {
|
if (none == 0) {
|
||||||
newValue = std::unique_ptr<std::string>(
|
newValue = std::shared_ptr<std::string>(
|
||||||
new std::string(a->evaluate(*value, trasn)));
|
new std::string(a->evaluate(*value, trasn)));
|
||||||
|
|
||||||
if (multiMatch == true) {
|
if (multiMatch == true) {
|
||||||
if (*value != *newValue) {
|
if (*value != *newValue) {
|
||||||
ret.push_back(std::make_pair(
|
ret.push_back(std::make_pair(
|
||||||
std::move(newValue),
|
newValue,
|
||||||
std::move(trans)));
|
trans));
|
||||||
value = std::move(newValue);
|
value = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = std::move(newValue);
|
value = newValue;
|
||||||
trasn->debug(9, " T (" + \
|
trasn->debug(9, " T (" + \
|
||||||
std::to_string(transformations) + ") " + \
|
std::to_string(transformations) + ") " + \
|
||||||
a->m_name + ": \"" + \
|
a->m_name + ": \"" + \
|
||||||
@ -397,15 +399,15 @@ std::list<std::pair<std::unique_ptr<std::string>,
|
|||||||
}
|
}
|
||||||
if (multiMatch == true) {
|
if (multiMatch == true) {
|
||||||
// v2 checks the last entry twice. Don't know why.
|
// v2 checks the last entry twice. Don't know why.
|
||||||
ret.push_back(std::move(ret.back()));
|
ret.push_back(ret.back());
|
||||||
|
|
||||||
trasn->debug(9, "multiMatch is enabled. " \
|
trasn->debug(9, "multiMatch is enabled. " \
|
||||||
+ std::to_string(ret.size()) + \
|
+ std::to_string(ret.size()) + \
|
||||||
" values to be tested.");
|
" values to be tested.");
|
||||||
} else {
|
} else {
|
||||||
ret.push_back(std::make_pair(
|
ret.push_back(std::make_pair(
|
||||||
std::move(value),
|
std::shared_ptr<std::string>(value),
|
||||||
std::move(trans)));
|
std::shared_ptr<std::string>(trans)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -425,7 +427,6 @@ std::vector<std::unique_ptr<collection::Variable>> Rule::getFinalVars(
|
|||||||
variable->evaluateInternal(trasn, this, &z);
|
variable->evaluateInternal(trasn, this, &z);
|
||||||
for (auto &y : z) {
|
for (auto &y : z) {
|
||||||
exclusions.push_back(y->m_key);
|
exclusions.push_back(y->m_key);
|
||||||
//delete y;
|
|
||||||
}
|
}
|
||||||
exclusions.push_back(&variable->m_name);
|
exclusions.push_back(&variable->m_name);
|
||||||
}
|
}
|
||||||
@ -628,12 +629,12 @@ bool Rule::evaluate(Transaction *trasn) {
|
|||||||
const std::string value = *(v->m_value);
|
const std::string value = *(v->m_value);
|
||||||
const std::string key = *(v->m_key);
|
const std::string key = *(v->m_key);
|
||||||
|
|
||||||
std::list<std::pair<std::unique_ptr<std::string>,
|
std::list<std::pair<std::shared_ptr<std::string>,
|
||||||
std::unique_ptr<std::string>>> values;
|
std::shared_ptr<std::string>>> values;
|
||||||
|
|
||||||
bool multiMatch = getActionsByName("multimatch").size() > 0;
|
bool multiMatch = getActionsByName("multimatch").size() > 0;
|
||||||
|
|
||||||
values = executeSecDefaultActionTransofrmations(trasn, value,
|
values = executeDefaultTransformations(trasn, value,
|
||||||
multiMatch);
|
multiMatch);
|
||||||
for (const auto &valueTemp : values) {
|
for (const auto &valueTemp : values) {
|
||||||
bool ret;
|
bool ret;
|
||||||
|
@ -97,8 +97,10 @@ std::string const UniqueId::machineName() {
|
|||||||
|
|
||||||
return std::string(machine_name);
|
return std::string(machine_name);
|
||||||
|
|
||||||
|
#if defined(HAVE_SYS_UTSNAME_H) || defined(WIN32)
|
||||||
failed:
|
failed:
|
||||||
return std::string("");
|
return std::string("");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const UniqueId::ethernetMacAddress() {
|
std::string const UniqueId::ethernetMacAddress() {
|
||||||
@ -221,8 +223,10 @@ std::string const UniqueId::ethernetMacAddress() {
|
|||||||
|
|
||||||
end:
|
end:
|
||||||
return std::string(reinterpret_cast<const char *>(mac));
|
return std::string(reinterpret_cast<const char *>(mac));
|
||||||
|
#if defined(__linux__) || defined(__gnu_linux__) || defined(DARWIN) || defined(WIN32)
|
||||||
failed:
|
failed:
|
||||||
return std::string("");
|
return std::string("");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ extern "C" {
|
|||||||
|
|
||||||
char *parse_pm_content(const char *op_parm, unsigned short int op_len, const char **error_msg) {
|
char *parse_pm_content(const char *op_parm, unsigned short int op_len, const char **error_msg) {
|
||||||
char *parm = NULL;
|
char *parm = NULL;
|
||||||
char *content = NULL;
|
char *content;
|
||||||
unsigned short int offset = 0;
|
unsigned short int offset = 0;
|
||||||
// char converted = 0;
|
// char converted = 0;
|
||||||
int i, x;
|
int i, x;
|
||||||
|
@ -29,7 +29,7 @@ namespace Utils {
|
|||||||
|
|
||||||
std::string Base64::encode(const std::string& data) {
|
std::string Base64::encode(const std::string& data) {
|
||||||
size_t encoded_len = 0;
|
size_t encoded_len = 0;
|
||||||
unsigned char *d = NULL;
|
unsigned char *d;
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
|
||||||
mbedtls_base64_encode(NULL, 0, &encoded_len,
|
mbedtls_base64_encode(NULL, 0, &encoded_len,
|
||||||
@ -64,7 +64,7 @@ std::string Base64::decode(const std::string& data, bool forgiven) {
|
|||||||
|
|
||||||
std::string Base64::decode(const std::string& data) {
|
std::string Base64::decode(const std::string& data) {
|
||||||
size_t decoded_len = 0;
|
size_t decoded_len = 0;
|
||||||
unsigned char *d = NULL;
|
unsigned char *d;
|
||||||
std::string ret;
|
std::string ret;
|
||||||
size_t len = strlen(data.c_str());
|
size_t len = strlen(data.c_str());
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ std::string Base64::decode(const std::string& data) {
|
|||||||
|
|
||||||
std::string Base64::decode_forgiven(const std::string& data) {
|
std::string Base64::decode_forgiven(const std::string& data) {
|
||||||
size_t decoded_len = 0;
|
size_t decoded_len = 0;
|
||||||
unsigned char *d = NULL;
|
unsigned char *d;
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
|
||||||
decode_forgiven_engine(NULL, 0, &decoded_len,
|
decode_forgiven_engine(NULL, 0, &decoded_len,
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
CPTTree *CPTCreateRadixTree() {
|
CPTTree *CPTCreateRadixTree() {
|
||||||
CPTTree *tree = NULL;
|
CPTTree *tree;
|
||||||
|
|
||||||
tree = reinterpret_cast<CPTTree *>(malloc(sizeof(CPTTree)));
|
tree = reinterpret_cast<CPTTree *>(malloc(sizeof(CPTTree)));
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ void ConvertIPNetmask(unsigned char *buffer, unsigned char netmask, unsigned int
|
|||||||
}
|
}
|
||||||
|
|
||||||
TreeNode *CPTCreateNode() {
|
TreeNode *CPTCreateNode() {
|
||||||
TreeNode *node = NULL;
|
TreeNode *node;
|
||||||
|
|
||||||
node = reinterpret_cast<TreeNode *>(malloc(sizeof(TreeNode)));
|
node = reinterpret_cast<TreeNode *>(malloc(sizeof(TreeNode)));
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ TreeNode *SetParentNode(TreeNode *node, TreeNode *new_node, CPTTree *tree) {
|
|||||||
int InsertNetmask(TreeNode *node, TreeNode *parent, TreeNode *new_node,
|
int InsertNetmask(TreeNode *node, TreeNode *parent, TreeNode *new_node,
|
||||||
CPTTree *tree, unsigned char netmask, unsigned char bitlen) {
|
CPTTree *tree, unsigned char netmask, unsigned char bitlen) {
|
||||||
if (netmask != NETMASK_256-1 && netmask != NETMASK_128) {
|
if (netmask != NETMASK_256-1 && netmask != NETMASK_128) {
|
||||||
if ((netmask != NETMASK_32 || (netmask == NETMASK_32 && bitlen != NETMASK_32))) {
|
if (netmask != NETMASK_32 || bitlen != NETMASK_32) {
|
||||||
int i;
|
int i;
|
||||||
node = new_node;
|
node = new_node;
|
||||||
parent = new_node->parent;
|
parent = new_node->parent;
|
||||||
@ -383,7 +383,7 @@ TreeNode *CPTAddElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree
|
|||||||
if (test_bit == bitlen && node->bit == bitlen) {
|
if (test_bit == bitlen && node->bit == bitlen) {
|
||||||
if (node->prefix != NULL) {
|
if (node->prefix != NULL) {
|
||||||
int found = 0;
|
int found = 0;
|
||||||
CPTData *prefix_data = NULL;
|
CPTData *prefix_data;
|
||||||
|
|
||||||
prefix_data = node->prefix->prefix_data;
|
prefix_data = node->prefix->prefix_data;
|
||||||
|
|
||||||
@ -966,7 +966,7 @@ int add_ip_from_param(
|
|||||||
{
|
{
|
||||||
char *param_copy = strdup(param);
|
char *param_copy = strdup(param);
|
||||||
char *saved = NULL;
|
char *saved = NULL;
|
||||||
char *str = NULL;
|
char *str;
|
||||||
TreeNode *tnode = NULL;
|
TreeNode *tnode = NULL;
|
||||||
|
|
||||||
str = strtok_r(param_copy, ",", &saved);
|
str = strtok_r(param_copy, ",", &saved);
|
||||||
|
@ -59,7 +59,7 @@ double cpu_seconds(void) {
|
|||||||
|
|
||||||
std::string find_resource(const std::string& resource,
|
std::string find_resource(const std::string& resource,
|
||||||
const std::string& config) {
|
const std::string& config) {
|
||||||
std::ifstream *iss = NULL;
|
std::ifstream *iss;
|
||||||
|
|
||||||
// Trying absolute or relative to the current dir.
|
// Trying absolute or relative to the current dir.
|
||||||
iss = new std::ifstream(resource, std::ios::in);
|
iss = new std::ifstream(resource, std::ios::in);
|
||||||
|
@ -31,13 +31,13 @@ namespace Variables {
|
|||||||
|
|
||||||
class Args_DictElement : public Variable {
|
class Args_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
Args_DictElement(std::string dictElement)
|
explicit Args_DictElement(std::string dictElement)
|
||||||
: Variable("ARGS" + std::string(":") + std::string(dictElement)),
|
: Variable("ARGS" + std::string(":") + std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableArgs.resolve(m_dictElement, l);
|
transaction->m_variableArgs.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class Args_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableArgs.resolve(l);
|
transaction->m_variableArgs.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ class Args_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Args_DictElementRegexp : public Variable {
|
class Args_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Args_DictElementRegexp(std::string dictElement)
|
explicit Args_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("ARGS:regex(" + dictElement + ")"),
|
: Variable("ARGS:regex(" + dictElement + ")"),
|
||||||
m_r(dictElement) {
|
m_r(dictElement) {
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,13 @@ namespace Variables {
|
|||||||
|
|
||||||
class ArgsGet_DictElement : public Variable {
|
class ArgsGet_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
ArgsGet_DictElement(std::string dictElement)
|
explicit ArgsGet_DictElement(std::string dictElement)
|
||||||
: Variable("ARGS_GET" + std::string(":") + std::string(dictElement)),
|
: Variable("ARGS_GET" + std::string(":") + std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableArgsGet.resolve(m_dictElement, l);
|
transaction->m_variableArgsGet.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class ArgsGet_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableArgsGet.resolve(l);
|
transaction->m_variableArgsGet.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ class ArgsGet_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class ArgsGet_DictElementRegexp : public Variable {
|
class ArgsGet_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
ArgsGet_DictElementRegexp(std::string dictElement)
|
explicit ArgsGet_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("ARGS_GET"),
|
: Variable("ARGS_GET"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@ namespace Variables {
|
|||||||
|
|
||||||
class ArgsPost_DictElement : public Variable {
|
class ArgsPost_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
ArgsPost_DictElement(std::string dictElement)
|
explicit ArgsPost_DictElement(std::string dictElement)
|
||||||
: Variable("ARGS_POST" + std::string(":") + std::string(dictElement)),
|
: Variable("ARGS_POST" + std::string(":") + std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableArgsPost.resolve(m_dictElement, l);
|
transaction->m_variableArgsPost.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class ArgsPost_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableArgsPost.resolve(l);
|
transaction->m_variableArgsPost.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ class ArgsPost_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class ArgsPost_DictElementRegexp : public Variable {
|
class ArgsPost_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
ArgsPost_DictElementRegexp(std::string dictElement)
|
explicit ArgsPost_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("ARGS_POST"),
|
: Variable("ARGS_POST"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class Files_DictElement : public Variable {
|
class Files_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
Files_DictElement(std::string dictElement)
|
explicit Files_DictElement(std::string dictElement)
|
||||||
: Variable("FILES" + std::string(":") +
|
: Variable("FILES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFiles.resolve(m_dictElement, l);
|
transaction->m_variableFiles.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class Files_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFiles.resolve(l);
|
transaction->m_variableFiles.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class Files_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Files_DictElementRegexp : public Variable {
|
class Files_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Files_DictElementRegexp(std::string dictElement)
|
explicit Files_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("FILES"),
|
: Variable("FILES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class FilesNames_DictElement : public Variable {
|
class FilesNames_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesNames_DictElement(std::string dictElement)
|
explicit FilesNames_DictElement(std::string dictElement)
|
||||||
: Variable("FILES_NAMES" + std::string(":") +
|
: Variable("FILES_NAMES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesNames.resolve(m_dictElement, l);
|
transaction->m_variableFilesNames.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class FilesNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesNames.resolve(l);
|
transaction->m_variableFilesNames.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,8 +61,8 @@ class FilesNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class FilesNames_DictElementRegexp : public Variable {
|
class FilesNames_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesNames_DictElementRegexp(std::string dictElement)
|
explicit FilesNames_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("FILES_NAMES"),
|
: Variable("FILES_NAMES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class FilesSizes_DictElement : public Variable {
|
class FilesSizes_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesSizes_DictElement(std::string dictElement)
|
explicit FilesSizes_DictElement(std::string dictElement)
|
||||||
: Variable("FILES_SIZES" + std::string(":") +
|
: Variable("FILES_SIZES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesSizes.resolve(m_dictElement, l);
|
transaction->m_variableFilesSizes.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class FilesSizes_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesSizes.resolve(l);
|
transaction->m_variableFilesSizes.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class FilesSizes_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class FilesSizes_DictElementRegexp : public Variable {
|
class FilesSizes_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesSizes_DictElementRegexp(std::string dictElement)
|
explicit FilesSizes_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("FILES_SIZES"),
|
: Variable("FILES_SIZES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class FilesTmpContent_DictElement : public Variable {
|
class FilesTmpContent_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesTmpContent_DictElement(std::string dictElement)
|
explicit FilesTmpContent_DictElement(std::string dictElement)
|
||||||
: Variable("FILES_TMP_CONTENT" + std::string(":") +
|
: Variable("FILES_TMP_CONTENT" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesTmpContent.resolve(m_dictElement, l);
|
transaction->m_variableFilesTmpContent.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class FilesTmpContent_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesTmpContent.resolve(l);
|
transaction->m_variableFilesTmpContent.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class FilesTmpContent_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class FilesTmpContent_DictElementRegexp : public Variable {
|
class FilesTmpContent_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesTmpContent_DictElementRegexp(std::string dictElement)
|
explicit FilesTmpContent_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("FILES_TMP_CONTENT"),
|
: Variable("FILES_TMP_CONTENT"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ class Transaction;
|
|||||||
namespace Variables {
|
namespace Variables {
|
||||||
class FilesTmpNames_DictElement : public Variable {
|
class FilesTmpNames_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesTmpNames_DictElement(std::string dictElement)
|
explicit FilesTmpNames_DictElement(std::string dictElement)
|
||||||
: Variable("FILES_TMPNAMES" + std::string(":") +
|
: Variable("FILES_TMPNAMES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesTmpNames.resolve(m_dictElement, l);
|
transaction->m_variableFilesTmpNames.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class FilesTmpNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableFilesTmpNames.resolve(l);
|
transaction->m_variableFilesTmpNames.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ class FilesTmpNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class FilesTmpNames_DictElementRegexp : public Variable {
|
class FilesTmpNames_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
FilesTmpNames_DictElementRegexp(std::string dictElement)
|
explicit FilesTmpNames_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("FILES_TMPNAMES"),
|
: Variable("FILES_TMPNAMES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class Geo_DictElement : public Variable {
|
class Geo_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
Geo_DictElement(std::string dictElement)
|
explicit Geo_DictElement(std::string dictElement)
|
||||||
: Variable("GEO" + std::string(":") +
|
: Variable("GEO" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableGeo.resolve(m_dictElement, l);
|
transaction->m_variableGeo.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class Geo_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableGeo.resolve(l);
|
transaction->m_variableGeo.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class Geo_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Geo_DictElementRegexp : public Variable {
|
class Geo_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Geo_DictElementRegexp(std::string dictElement)
|
explicit Geo_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("GEO"),
|
: Variable("GEO"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@ class Global_DictElement : public Variable {
|
|||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) override {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_collections.resolveMultiMatches(m_dictElement, "GLOBAL", l);
|
transaction->m_collections.resolveMultiMatches(m_dictElement,
|
||||||
|
"GLOBAL", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string m_dictElement;
|
std::string m_dictElement;
|
||||||
@ -48,7 +49,7 @@ class Global_DictElement : public Variable {
|
|||||||
|
|
||||||
class Global_NoDictElement : public Variable {
|
class Global_NoDictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
explicit Global_NoDictElement()
|
Global_NoDictElement()
|
||||||
: Variable("GLOBAL") { }
|
: Variable("GLOBAL") { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
@ -61,7 +62,7 @@ class Global_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Global_DictElementRegexp : public Variable {
|
class Global_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Global_DictElementRegexp(std::string dictElement)
|
explicit Global_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("GLOBAL"),
|
: Variable("GLOBAL"),
|
||||||
m_r(dictElement),
|
m_r(dictElement),
|
||||||
m_dictElement("GLOBAL:" + dictElement) { }
|
m_dictElement("GLOBAL:" + dictElement) { }
|
||||||
|
@ -48,7 +48,7 @@ class Ip_DictElement : public Variable {
|
|||||||
|
|
||||||
class Ip_NoDictElement : public Variable {
|
class Ip_NoDictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
explicit Ip_NoDictElement()
|
Ip_NoDictElement()
|
||||||
: Variable("IP") { }
|
: Variable("IP") { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
@ -61,7 +61,7 @@ class Ip_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Ip_DictElementRegexp : public Variable {
|
class Ip_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Ip_DictElementRegexp(std::string dictElement)
|
explicit Ip_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("IP"),
|
: Variable("IP"),
|
||||||
m_r(dictElement),
|
m_r(dictElement),
|
||||||
m_dictElement("IP:" + dictElement) { }
|
m_dictElement("IP:" + dictElement) { }
|
||||||
|
@ -36,7 +36,7 @@ class MatchedVarName : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMatchedVarName.evaluate(l);
|
transaction->m_variableMatchedVarName.evaluate(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class MatchedVars_DictElement : public Variable {
|
class MatchedVars_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
MatchedVars_DictElement(std::string dictElement)
|
explicit MatchedVars_DictElement(std::string dictElement)
|
||||||
: Variable("MATCHED_VARS" + std::string(":") +
|
: Variable("MATCHED_VARS" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMatchedVars.resolve(m_dictElement, l);
|
transaction->m_variableMatchedVars.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class MatchedVars_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMatchedVars.resolve(l);
|
transaction->m_variableMatchedVars.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class MatchedVars_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class MatchedVars_DictElementRegexp : public Variable {
|
class MatchedVars_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
MatchedVars_DictElementRegexp(std::string dictElement)
|
explicit MatchedVars_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("MATCHED_VARS"),
|
: Variable("MATCHED_VARS"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class MatchedVarsNames_DictElement : public Variable {
|
class MatchedVarsNames_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
MatchedVarsNames_DictElement(std::string dictElement)
|
explicit MatchedVarsNames_DictElement(std::string dictElement)
|
||||||
: Variable("MATCHED_VARS_NAMES" + std::string(":") +
|
: Variable("MATCHED_VARS_NAMES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMatchedVarsNames.resolve(m_dictElement, l);
|
transaction->m_variableMatchedVarsNames.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class MatchedVarsNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMatchedVarsNames.resolve(l);
|
transaction->m_variableMatchedVarsNames.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,13 +61,13 @@ class MatchedVarsNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class MatchedVarsNames_DictElementRegexp : public Variable {
|
class MatchedVarsNames_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
MatchedVarsNames_DictElementRegexp(std::string dictElement)
|
explicit MatchedVarsNames_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("MATCHED_VARS_NAMES"),
|
: Variable("MATCHED_VARS_NAMES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMatchedVarsNames.resolveRegularExpression(
|
transaction->m_variableMatchedVarsNames.resolveRegularExpression(
|
||||||
&m_r, l);
|
&m_r, l);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#ifndef SRC_VARIABLES_MULTIPART_FILENAME_H_
|
#ifndef SRC_VARIABLES_MULTIPART_FILE_NAME_H_
|
||||||
#define SRC_VARIABLES_MULTIPART_FILENAME_H_
|
#define SRC_VARIABLES_MULTIPART_FILE_NAME_H_
|
||||||
|
|
||||||
#include "src/variables/variable.h"
|
#include "src/variables/variable.h"
|
||||||
|
|
||||||
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class MultiPartFileName_DictElement : public Variable {
|
class MultiPartFileName_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
MultiPartFileName_DictElement(std::string dictElement)
|
explicit MultiPartFileName_DictElement(std::string dictElement)
|
||||||
: Variable("MULTIPART_FILENAME" + std::string(":") +
|
: Variable("MULTIPART_FILENAME" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMultiPartFileName.resolve(m_dictElement, l);
|
transaction->m_variableMultiPartFileName.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class MultiPartFileName_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMultiPartFileName.resolve(l);
|
transaction->m_variableMultiPartFileName.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class MultiPartFileName_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class MultiPartFileName_DictElementRegexp : public Variable {
|
class MultiPartFileName_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
MultiPartFileName_DictElementRegexp(std::string dictElement)
|
explicit MultiPartFileName_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("MULTIPART_FILENAME"),
|
: Variable("MULTIPART_FILENAME"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
@ -79,5 +79,5 @@ class MultiPartFileName_DictElementRegexp : public Variable {
|
|||||||
} // namespace Variables
|
} // namespace Variables
|
||||||
} // namespace modsecurity
|
} // namespace modsecurity
|
||||||
|
|
||||||
#endif // SRC_VARIABLES_MULTIPART_FILENAME_H_
|
#endif // SRC_VARIABLES_MULTIPART_FILE_NAME_H_
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class MultiPartName_DictElement : public Variable {
|
class MultiPartName_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
MultiPartName_DictElement(std::string dictElement)
|
explicit MultiPartName_DictElement(std::string dictElement)
|
||||||
: Variable("MULTIPART_NAME" + std::string(":") +
|
: Variable("MULTIPART_NAME" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMultiPartName.resolve(m_dictElement, l);
|
transaction->m_variableMultiPartName.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class MultiPartName_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableMultiPartName.resolve(l);
|
transaction->m_variableMultiPartName.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class MultiPartName_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class MultiPartName_DictElementRegexp : public Variable {
|
class MultiPartName_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
MultiPartName_DictElementRegexp(std::string dictElement)
|
explicit MultiPartName_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("MULTIPART_NAME"),
|
: Variable("MULTIPART_NAME"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
@ -79,5 +79,5 @@ class MultiPartName_DictElementRegexp : public Variable {
|
|||||||
} // namespace Variables
|
} // namespace Variables
|
||||||
} // namespace modsecurity
|
} // namespace modsecurity
|
||||||
|
|
||||||
#endif // SRC_VARIABLES_MULTIPART_FILENAME_H_
|
#endif // SRC_VARIABLES_MULTIPART_NAME_H_
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "src/utils/base64.h"
|
#include "src/utils/base64.h"
|
||||||
@ -41,8 +42,8 @@ void RemoteUser::evaluate(Transaction *transaction,
|
|||||||
size_t pos;
|
size_t pos;
|
||||||
std::string base64;
|
std::string base64;
|
||||||
|
|
||||||
std::unique_ptr<std::string> header = std::move(transaction->m_variableRequestHeaders.resolveFirst(
|
std::unique_ptr<std::string> header = std::move(
|
||||||
"Authorization"));
|
transaction->m_variableRequestHeaders.resolveFirst("Authorization"));
|
||||||
|
|
||||||
if (header == NULL) {
|
if (header == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -62,7 +63,6 @@ void RemoteUser::evaluate(Transaction *transaction,
|
|||||||
|
|
||||||
l->push_back(new collection::Variable(&m_retName,
|
l->push_back(new collection::Variable(&m_retName,
|
||||||
&transaction->m_variableRemoteUser));
|
&transaction->m_variableRemoteUser));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class RequestCookies_DictElement : public Variable {
|
class RequestCookies_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
RequestCookies_DictElement(std::string dictElement)
|
explicit RequestCookies_DictElement(std::string dictElement)
|
||||||
: Variable("REQUEST_COOKIES" + std::string(":") +
|
: Variable("REQUEST_COOKIES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestCookies.resolve(m_dictElement, l);
|
transaction->m_variableRequestCookies.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class RequestCookies_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestCookies.resolve(l);
|
transaction->m_variableRequestCookies.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,13 +61,13 @@ class RequestCookies_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class RequestCookies_DictElementRegexp : public Variable {
|
class RequestCookies_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
RequestCookies_DictElementRegexp(std::string dictElement)
|
explicit RequestCookies_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("REQUEST_COOKIES"),
|
: Variable("REQUEST_COOKIES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestCookies.resolveRegularExpression(
|
transaction->m_variableRequestCookies.resolveRegularExpression(
|
||||||
&m_r, l);
|
&m_r, l);
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class RequestCookiesNames_DictElement : public Variable {
|
class RequestCookiesNames_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
RequestCookiesNames_DictElement(std::string dictElement)
|
explicit RequestCookiesNames_DictElement(std::string dictElement)
|
||||||
: Variable("REQUEST_COOKIES_NAMES" + std::string(":") +
|
: Variable("REQUEST_COOKIES_NAMES" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestCookiesNames.resolve(m_dictElement, l);
|
transaction->m_variableRequestCookiesNames.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class RequestCookiesNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestCookiesNames.resolve(l);
|
transaction->m_variableRequestCookiesNames.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class RequestCookiesNames_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class RequestCookiesNames_DictElementRegexp : public Variable {
|
class RequestCookiesNames_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
RequestCookiesNames_DictElementRegexp(std::string dictElement)
|
explicit RequestCookiesNames_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("REQUEST_COOKIES_NAMES"),
|
: Variable("REQUEST_COOKIES_NAMES"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class RequestHeaders_DictElement : public Variable {
|
class RequestHeaders_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
RequestHeaders_DictElement(std::string dictElement)
|
explicit RequestHeaders_DictElement(std::string dictElement)
|
||||||
: Variable("REQUEST_HEADERS" + std::string(":") +
|
: Variable("REQUEST_HEADERS" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestHeaders.resolve(m_dictElement, l);
|
transaction->m_variableRequestHeaders.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class RequestHeaders_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRequestHeaders.resolve(l);
|
transaction->m_variableRequestHeaders.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class RequestHeaders_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class RequestHeaders_DictElementRegexp : public Variable {
|
class RequestHeaders_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
RequestHeaders_DictElementRegexp(std::string dictElement)
|
explicit RequestHeaders_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("REQUEST_HEADERS"),
|
: Variable("REQUEST_HEADERS"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class ResponseHeaders_DictElement : public Variable {
|
class ResponseHeaders_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
ResponseHeaders_DictElement(std::string dictElement)
|
explicit ResponseHeaders_DictElement(std::string dictElement)
|
||||||
: Variable("RESPONSE_HEADERS" + std::string(":") +
|
: Variable("RESPONSE_HEADERS" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableResponseHeaders.resolve(m_dictElement, l);
|
transaction->m_variableResponseHeaders.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class ResponseHeaders_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableResponseHeaders.resolve(l);
|
transaction->m_variableResponseHeaders.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ class ResponseHeaders_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class ResponseHeaders_DictElementRegexp : public Variable {
|
class ResponseHeaders_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
ResponseHeaders_DictElementRegexp(std::string dictElement)
|
explicit ResponseHeaders_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("RESPONSE_HEADERS"),
|
: Variable("RESPONSE_HEADERS"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -29,14 +29,14 @@ namespace Variables {
|
|||||||
|
|
||||||
class Rule_DictElement : public Variable {
|
class Rule_DictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
Rule_DictElement(std::string dictElement)
|
explicit Rule_DictElement(std::string dictElement)
|
||||||
: Variable("RULE" + std::string(":") +
|
: Variable("RULE" + std::string(":") +
|
||||||
std::string(dictElement)),
|
std::string(dictElement)),
|
||||||
m_dictElement(dictElement) { }
|
m_dictElement(dictElement) { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRule.resolve(m_dictElement, l);
|
transaction->m_variableRule.resolve(m_dictElement, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class Rule_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_variableRule.resolve(l);
|
transaction->m_variableRule.resolve(l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -59,7 +59,7 @@ class Rule_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Rule_DictElementRegexp : public Variable {
|
class Rule_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Rule_DictElementRegexp(std::string dictElement)
|
explicit Rule_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("RULE"),
|
: Variable("RULE"),
|
||||||
m_r(dictElement) { }
|
m_r(dictElement) { }
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@ class Session_DictElement : public Variable {
|
|||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) override {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
transaction->m_collections.resolveMultiMatches(m_dictElement, "SESSION", l);
|
transaction->m_collections.resolveMultiMatches(m_dictElement,
|
||||||
|
"SESSION", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string m_dictElement;
|
std::string m_dictElement;
|
||||||
@ -48,7 +49,7 @@ class Session_DictElement : public Variable {
|
|||||||
|
|
||||||
class Session_NoDictElement : public Variable {
|
class Session_NoDictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
explicit Session_NoDictElement()
|
Session_NoDictElement()
|
||||||
: Variable("SESSION") { }
|
: Variable("SESSION") { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
@ -61,7 +62,7 @@ class Session_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Session_DictElementRegexp : public Variable {
|
class Session_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Session_DictElementRegexp(std::string dictElement)
|
explicit Session_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("SESSION"),
|
: Variable("SESSION"),
|
||||||
m_r(dictElement),
|
m_r(dictElement),
|
||||||
m_dictElement("SESSION:" + dictElement) { }
|
m_dictElement("SESSION:" + dictElement) { }
|
||||||
|
@ -45,8 +45,6 @@ void TimeWDay::evaluate(Transaction *transaction,
|
|||||||
|
|
||||||
localtime_r(&timer, &timeinfo);
|
localtime_r(&timer, &timeinfo);
|
||||||
strftime(tstr, 200, "%u", &timeinfo);
|
strftime(tstr, 200, "%u", &timeinfo);
|
||||||
int a = atoi(tstr);
|
|
||||||
a--;
|
|
||||||
|
|
||||||
transaction->m_variableTimeWDay.assign(tstr);
|
transaction->m_variableTimeWDay.assign(tstr);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class Tx_DictElement : public Variable {
|
|||||||
|
|
||||||
class Tx_NoDictElement : public Variable {
|
class Tx_NoDictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
explicit Tx_NoDictElement()
|
Tx_NoDictElement()
|
||||||
: Variable("TX") { }
|
: Variable("TX") { }
|
||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
@ -61,7 +61,7 @@ class Tx_NoDictElement : public Variable {
|
|||||||
|
|
||||||
class Tx_DictElementRegexp : public Variable {
|
class Tx_DictElementRegexp : public Variable {
|
||||||
public:
|
public:
|
||||||
Tx_DictElementRegexp(std::string dictElement)
|
explicit Tx_DictElementRegexp(std::string dictElement)
|
||||||
: Variable("TX"),
|
: Variable("TX"),
|
||||||
m_r(dictElement),
|
m_r(dictElement),
|
||||||
m_dictElement("TX:" + dictElement) { }
|
m_dictElement("TX:" + dictElement) { }
|
||||||
|
@ -122,7 +122,7 @@ Variable::Variable(std::string name, VariableKind kind)
|
|||||||
|
|
||||||
std::vector<const collection::Variable *> *
|
std::vector<const collection::Variable *> *
|
||||||
Variable::evaluate(Transaction *transaction) {
|
Variable::evaluate(Transaction *transaction) {
|
||||||
std::vector<const collection::Variable *> *l = NULL;
|
std::vector<const collection::Variable *> *l;
|
||||||
l = new std::vector<const collection::Variable *>();
|
l = new std::vector<const collection::Variable *>();
|
||||||
evaluate(transaction, NULL, l);
|
evaluate(transaction, NULL, l);
|
||||||
|
|
||||||
@ -170,7 +170,8 @@ std::string Variable::to_s(
|
|||||||
std::string except("");
|
std::string except("");
|
||||||
for (int i = 0; i < variables->size() ; i++) {
|
for (int i = 0; i < variables->size() ; i++) {
|
||||||
std::string name = variables->at(i)->m_name;
|
std::string name = variables->at(i)->m_name;
|
||||||
VariableModificatorExclusion *e = dynamic_cast<VariableModificatorExclusion *>(variables->at(i));
|
VariableModificatorExclusion *e =
|
||||||
|
dynamic_cast<VariableModificatorExclusion *>(variables->at(i));
|
||||||
if (e != NULL) {
|
if (e != NULL) {
|
||||||
if (except.empty()) {
|
if (except.empty()) {
|
||||||
except = except + name;
|
except = except + name;
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "modsecurity/rule.h"
|
#include "modsecurity/rule.h"
|
||||||
#include "src/utils/string.h"
|
#include "src/utils/string.h"
|
||||||
@ -96,7 +98,7 @@ class Variable {
|
|||||||
|
|
||||||
class VariableModificatorExclusion : public Variable {
|
class VariableModificatorExclusion : public Variable {
|
||||||
public:
|
public:
|
||||||
VariableModificatorExclusion(std::unique_ptr<Variable> var)
|
explicit VariableModificatorExclusion(std::unique_ptr<Variable> var)
|
||||||
: Variable(var->m_name),
|
: Variable(var->m_name),
|
||||||
m_var(std::move(var)) {
|
m_var(std::move(var)) {
|
||||||
m_isExclusion = true;
|
m_isExclusion = true;
|
||||||
@ -114,7 +116,7 @@ class VariableModificatorExclusion : public Variable {
|
|||||||
|
|
||||||
class VariableModificatorCount : public Variable {
|
class VariableModificatorCount : public Variable {
|
||||||
public:
|
public:
|
||||||
VariableModificatorCount(std::unique_ptr<Variable> var)
|
explicit VariableModificatorCount(std::unique_ptr<Variable> var)
|
||||||
: Variable(var->m_name),
|
: Variable(var->m_name),
|
||||||
m_var(std::move(var)) {
|
m_var(std::move(var)) {
|
||||||
m_isCount = true;
|
m_isCount = true;
|
||||||
|
@ -112,7 +112,7 @@ void XML::evaluate(Transaction *t,
|
|||||||
}
|
}
|
||||||
/* Create one variable for each node in the result. */
|
/* Create one variable for each node in the result. */
|
||||||
for (i = 0; i < nodes->nodeNr; i++) {
|
for (i = 0; i < nodes->nodeNr; i++) {
|
||||||
char *content = NULL;
|
char *content;
|
||||||
content = reinterpret_cast<char *>(
|
content = reinterpret_cast<char *>(
|
||||||
xmlNodeGetContent(nodes->nodeTab[i]));
|
xmlNodeGetContent(nodes->nodeTab[i]));
|
||||||
if (content != NULL) {
|
if (content != NULL) {
|
||||||
|
@ -36,7 +36,7 @@ namespace Variables {
|
|||||||
*/
|
*/
|
||||||
class XML_NoDictElement : public Variable {
|
class XML_NoDictElement : public Variable {
|
||||||
public:
|
public:
|
||||||
explicit XML_NoDictElement()
|
XML_NoDictElement()
|
||||||
: Variable("XML"),
|
: Variable("XML"),
|
||||||
m_plain("[XML document tree]"),
|
m_plain("[XML document tree]"),
|
||||||
m_var(&m_name, &m_plain) {
|
m_var(&m_name, &m_plain) {
|
||||||
@ -46,7 +46,7 @@ class XML_NoDictElement : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l) {
|
std::vector<const collection::Variable *> *l) override {
|
||||||
l->push_back(&m_var);
|
l->push_back(&m_var);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class XML : public Variable {
|
|||||||
|
|
||||||
void evaluate(Transaction *transaction,
|
void evaluate(Transaction *transaction,
|
||||||
Rule *rule,
|
Rule *rule,
|
||||||
std::vector<const collection::Variable *> *l);
|
std::vector<const collection::Variable *> *l) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user