Renames class Assay to Transaction

This commit is contained in:
Felipe Zimmerle 2016-01-13 14:38:37 -03:00
parent f3fd5d6621
commit a51e707517
249 changed files with 2961 additions and 1235 deletions

View File

@ -115,7 +115,7 @@ Below some are illustrated:
```c++ ```c++
using ModSecurity::ModSecurity; using ModSecurity::ModSecurity;
using ModSecurity::Rules; using ModSecurity::Rules;
using ModSecurity::Assay; using ModSecurity::Transaction;
ModSecurity *modsec; ModSecurity *modsec;
ModSecurity::Rules *rules; ModSecurity::Rules *rules;
@ -126,10 +126,10 @@ rules = new Rules();
rules->loadFromUri(rules_file); rules->loadFromUri(rules_file);
Assay *modsecAssay = new Assay(modsec, rules); Transaction *modsecTransaction = new Transaction(modsec, rules);
modsecAssay->processConnection("127.0.0.1"); modsecTransaction->processConnection("127.0.0.1");
if (modsecAssay->intervention()) { if (modsecTransaction->intervention()) {
std::cout << "There is an intervention" << std::endl; std::cout << "There is an intervention" << std::endl;
} }
``` ```
@ -138,7 +138,7 @@ if (modsecAssay->intervention()) {
```c ```c
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
char main_rule_uri[] = "basic_rules.conf"; char main_rule_uri[] = "basic_rules.conf";
@ -146,7 +146,7 @@ char main_rule_uri[] = "basic_rules.conf";
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
ModSecurity *modsec = NULL; ModSecurity *modsec = NULL;
Assay *assay = NULL; Transaction *transaction = NULL;
Rules *rules = NULL; Rules *rules = NULL;
modsec = msc_init(); modsec = msc_init();
@ -154,14 +154,14 @@ int main (int argc, char **argv)
rules = msc_create_rules_set(); rules = msc_create_rules_set();
msc_rules_add_file(rules, main_rule_uri); msc_rules_add_file(rules, main_rule_uri);
assay = msc_new_assay(modsec, rules); transaction = msc_new_transaction(modsec, rules);
msc_process_connection(assay, "127.0.0.1"); msc_process_connection(transaction, "127.0.0.1");
msc_process_uri(assay, "http://www.modsecurity.org/test?key1=value1&key2=value2&key3=value3&test=args&test=test"); msc_process_uri(transaction, "http://www.modsecurity.org/test?key1=value1&key2=value2&key3=value3&test=args&test=test");
msc_process_request_headers(assay); msc_process_request_headers(transaction);
msc_process_request_body(assay); msc_process_request_body(transaction);
msc_process_response_headers(assay); msc_process_response_headers(transaction);
msc_process_response_body(assay); msc_process_response_body(transaction);
return 0; return 0;
} }

View File

@ -13,11 +13,11 @@
* *
*/ */
#include <modsecurity/transaction.h>
#include "stdio.h" #include "stdio.h"
#include "stdlib.h" #include "stdlib.h"
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
#include "modsecurity/assay.h"
char main_rule_uri[] = "basic_rules.conf"; char main_rule_uri[] = "basic_rules.conf";
@ -27,7 +27,7 @@ int main (int argc, char **argv)
int ret = 1; int ret = 1;
const char *error = NULL; const char *error = NULL;
ModSecurity *modsec = NULL; ModSecurity *modsec = NULL;
Assay *assay = NULL; Transaction *transaction = NULL;
Rules *rules = NULL; Rules *rules = NULL;
modsec = msc_init(); modsec = msc_init();
@ -55,17 +55,17 @@ int main (int argc, char **argv)
} }
msc_rules_dump(rules); msc_rules_dump(rules);
assay = msc_new_assay(modsec, rules, NULL); transaction = msc_new_transaction(modsec, rules, NULL);
msc_process_connection(assay, "127.0.0.1", 12345, "127.0.0.1", 80); msc_process_connection(transaction, "127.0.0.1", 12345, "127.0.0.1", 80);
msc_process_uri(assay, msc_process_uri(transaction,
"http://www.modsecurity.org/test?key1=value1&key2=value2&key3=value3", "http://www.modsecurity.org/test?key1=value1&key2=value2&key3=value3",
"GET", "1.1"); "GET", "1.1");
msc_process_request_headers(assay); msc_process_request_headers(transaction);
msc_process_request_body(assay); msc_process_request_body(transaction);
msc_process_response_headers(assay); msc_process_response_headers(transaction);
msc_process_response_body(assay); msc_process_response_body(transaction);
msc_process_logging(assay, 200); msc_process_logging(transaction, 200);
end: end:
msc_rules_cleanup(rules); msc_rules_cleanup(rules);
msc_cleanup(modsec); msc_cleanup(modsec);

View File

@ -1,282 +0,0 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
*
* You may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* If any of the files related to licensing are missing or if you have any
* other questions related to licensing please contact Trustwave Holdings, Inc.
* directly using the email address security@modsecurity.org.
*
*/
#ifdef __cplusplus
#include <ctime>
#include <iostream>
#include <list>
#include <iomanip>
#include <string>
#include <sstream>
#include <unordered_map>
#include <map>
#include <fstream>
#include <vector>
#include <utility>
#endif
#include <stdlib.h>
#include <stddef.h>
#ifndef HEADERS_MODSECURITY_ASSAY_H_
#define HEADERS_MODSECURITY_ASSAY_H_
#ifndef __cplusplus
typedef struct ModSecurity_t ModSecurity;
typedef struct Assay_t Assay;
typedef struct Rules_t Rules;
#endif
#include "modsecurity/intervention.h"
#include "modsecurity/transaction/variable.h"
#include "modsecurity/transaction/variables.h"
#include "modsecurity/transaction/collections.h"
#define LOGFY_ADD(a, b) \
yajl_gen_string(g, reinterpret_cast<const unsigned char*>(a), strlen(a)); \
if (b == NULL) { \
yajl_gen_string(g, reinterpret_cast<const unsigned char*>(""), \
strlen("")); \
} else { \
yajl_gen_string(g, reinterpret_cast<const unsigned char*>(b), \
strlen(b)); \
}
#define LOGFY_ADD_INT(a, b) \
yajl_gen_string(g, reinterpret_cast<const unsigned char*>(a), strlen(a)); \
yajl_gen_number(g, reinterpret_cast<const char*>(b), strlen(b));
#define LOGFY_ADD_NUM(a, b) \
yajl_gen_string(g, reinterpret_cast<const unsigned char*>(a), strlen(a)); \
yajl_gen_integer(g, b);
#ifdef __cplusplus
namespace modsecurity {
class ModSecurity;
class Assay;
class Rules;
class Collections;
namespace actions {
class Action;
}
namespace operators {
class Operator;
}
/** @ingroup ModSecurity_CPP_API */
class Assay {
public:
Assay(ModSecurity *assay, Rules *rules, void *logCbData);
~Assay();
/** TODO: Should be an structure that fits an IP address */
int processConnection(const char *client, int cPort,
const char *server, int sPort);
int processURI(const char *uri, const char *protocol,
const char *http_version);
/**
* Types of request body that ModSecurity may give a special treatment
* for the data.
*/
enum RequestBodyType {
/**
*
*/
UnknownFormat,
/**
*
*/
MultiPartRequestBody,
/**
*
*/
WWWFormUrlEncoded,
/**
*
*/
JSONRequestBody,
/**
*
*/
XMLRequestBody
};
int processRequestHeaders();
int addRequestHeader(const std::string& key, const std::string& value);
int addRequestHeader(const unsigned char *key, const unsigned char *value);
int addRequestHeader(const unsigned char *key, size_t len_key,
const unsigned char *value, size_t len_value);
int processRequestBody();
int appendRequestBody(const unsigned char *body, size_t size);
int requestBodyFromFile(const char *path);
int processResponseHeaders();
int addResponseHeader(const std::string& key, const std::string& value);
int addResponseHeader(const unsigned char *key, const unsigned char *value);
int addResponseHeader(const unsigned char *key, size_t len_key,
const unsigned char *value, size_t len_value);
int processResponseBody();
int appendResponseBody(const unsigned char *body, size_t size);
int processLogging(int status_code);
bool intervention(ModSecurityIntervention *it);
void cleanup();
const char *getResponseBody();
int getResponseBodyLenth();
transaction::Collections m_collections;
#ifndef NO_LOGS
void debug(int, std::string);
#endif
void serverLog(const std::string& msg);
std::vector<actions::Action *> actions;
bool save_in_auditlog;
bool do_not_save_in_auditlog;
int httpCodeReturned;
std::string to_json(int parts);
std::string toOldAuditLogFormat(int parts, const std::string &trailer);
std::string toOldAuditLogFormatIndex(const std::string &filename,
double size, const std::string &md5);
std::string id;
time_t timeStamp;
clock_t start;
int highest_severity;
Rules *m_rules;
std::list<std::string> rulesMessages;
std::list<std::string> ruleTags;
std::list< std::pair<int, std::string> > auditLogModifier;
std::string m_marker;
private:
std::ofstream myfile;
ModSecurity *m_ms;
const char *m_clientIpAddress;
const char *m_serverIpAddress;
int m_clientPort;
int m_serverPort;
const char *m_uri;
std::string m_uri_decoded;
const char *m_protocol;
const char *m_httpVersion;
std::string *m_namesArgs;
std::string *m_namesArgsPost;
std::string *m_namesArgsGet;
std::string *m_requestHeadersNames;
std::string *m_responseHeadersNames;
std::string *m_responseContentType;
double m_ARGScombinedSize;
/** TODO: Support to save double in the storage. */
std::string *m_ARGScombinedSizeStr;
RequestBodyType m_requestBodyType;
std::ostringstream m_requestBody;
std::ostringstream m_responseBody;
void *m_logCbData;
};
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** @ingroup ModSecurity_C_API */
Assay *msc_new_assay(ModSecurity *ms, Rules *rules, void *logCbData);
/** @ingroup ModSecurity_C_API */
int msc_process_connection(Assay *assay, const char *client, int cPort,
const char *server, int sPort);
/** @ingroup ModSecurity_C_API */
int msc_process_request_headers(Assay *assay);
/** @ingroup ModSecurity_C_API */
int msc_add_request_header(Assay *assay, const unsigned char *key,
const unsigned char *value);
/** @ingroup ModSecurity_C_API */
int msc_add_n_request_header(Assay *assay, const unsigned char *key,
size_t len_key, const unsigned char *value, size_t len_value);
/** @ingroup ModSecurity_C_API */
int msc_process_request_body(Assay *assay);
/** @ingroup ModSecurity_C_API */
int msc_append_request_body(Assay *assay,
const unsigned char *body, size_t size);
/** @ingroup ModSecurity_C_API */
int msc_request_body_from_file(Assay *assay, const char *path);
/** @ingroup ModSecurity_C_API */
int msc_process_response_headers(Assay *assay);
/** @ingroup ModSecurity_C_API */
int msc_add_response_header(Assay *assay, const unsigned char *key,
const unsigned char *value);
/** @ingroup ModSecurity_C_API */
int msc_add_n_response_header(Assay *assay, const unsigned char *key,
size_t len_key, const unsigned char *value, size_t len_value);
/** @ingroup ModSecurity_C_API */
int msc_process_response_body(Assay *assay);
/** @ingroup ModSecurity_C_API */
int msc_append_response_body(Assay *assay,
const unsigned char *body, size_t size);
/** @ingroup ModSecurity_C_API */
int msc_process_uri(Assay *assay, const char *uri, const char *protocol,
const char *http_version);
/** @ingroup ModSecurity_C_API */
const char *msc_get_response_body(Assay *assay);
/** @ingroup ModSecurity_C_API */
int msc_get_response_body_length(Assay *assay);
/** @ingroup ModSecurity_C_API */
void msc_assay_cleanup(Assay *assay);
/** @ingroup ModSecurity_C_API */
int msc_intervention(Assay *assay, ModSecurityIntervention *it);
/** @ingroup ModSecurity_C_API */
int msc_process_logging(Assay *assay, int code);
#ifdef __cplusplus
}
} // namespace modsecurity
#endif
#endif // HEADERS_MODSECURITY_ASSAY_H_

View File

@ -22,7 +22,7 @@
* *
* using ModSecurity::ModSecurity; * using ModSecurity::ModSecurity;
* using ModSecurity::Rules; * using ModSecurity::Rules;
* using ModSecurity::Assay; * using ModSecurity::Transaction;
* *
* ModSecurity *modsec; * ModSecurity *modsec;
* ModSecurity::Rules *rules; * ModSecurity::Rules *rules;
@ -31,10 +31,10 @@
* rules = new Rules(); * rules = new Rules();
* rules->loadFromUri(rules_file); * rules->loadFromUri(rules_file);
* *
* Assay *modsecAssay = new Assay(modsec, rules); * Transaction *modsecTransaction = new Transaction(modsec, rules);
* modsecAssay->processConnection("127.0.0.1"); * modsecTransaction->processConnection("127.0.0.1");
* *
* if (modsecAssay->intervention()) { * if (modsecTransaction->intervention()) {
* std::cout << "There is an intervention" << std::endl; * std::cout << "There is an intervention" << std::endl;
* } * }
* *
@ -90,7 +90,7 @@ typedef struct ModSecurity_t modsecurity;
#include "modsecurity/intervention.h" #include "modsecurity/intervention.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/debug_log.h" #include "modsecurity/debug_log.h"
#include "modsecurity/rules.h" #include "modsecurity/rules.h"

View File

@ -19,8 +19,8 @@
#include <string> #include <string>
#endif #endif
#ifndef SRC_RULE_H_ #ifndef HEADERS_MODSECURITY_RULE_H_
#define SRC_RULE_H_ #define HEADERS_MODSECURITY_RULE_H_
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
@ -29,7 +29,7 @@
namespace modsecurity { namespace modsecurity {
namespace Variables { namespace Variables {
class Variable; class Variable;
} }
class Rule { class Rule {
@ -42,8 +42,8 @@ class Rule {
explicit Rule(std::string marker); explicit Rule(std::string marker);
~Rule(); ~Rule();
bool evaluate(Assay *assay); bool evaluate(Transaction *transaction);
bool evaluateActions(Assay *assay); bool evaluateActions(Transaction *transaction);
operators::Operator *op; operators::Operator *op;
std::vector<actions::Action *> actions_conf; std::vector<actions::Action *> actions_conf;
@ -86,6 +86,6 @@ class Rule {
#endif #endif
#endif // SRC_RULE_H_ #endif // HEADERS_MODSECURITY_RULE_H_

View File

@ -29,7 +29,7 @@
#define HEADERS_MODSECURITY_RULES_H_ #define HEADERS_MODSECURITY_RULES_H_
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rules_properties.h" #include "modsecurity/rules_properties.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -79,7 +79,7 @@ class Rules : public RulesProperties {
int merge(Parser::Driver *driver); int merge(Parser::Driver *driver);
int merge(Rules *rules); int merge(Rules *rules);
int evaluate(int phase, Assay *assay); int evaluate(int phase, Transaction *transaction);
std::string getParserError(); std::string getParserError();
void debug(int level, std::string message); void debug(int level, std::string message);

View File

@ -19,6 +19,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <list> #include <list>
#include <set>
#endif #endif
@ -26,7 +27,7 @@
#define HEADERS_MODSECURITY_RULES_PROPERTIES_H_ #define HEADERS_MODSECURITY_RULES_PROPERTIES_H_
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -93,12 +94,11 @@ class RulesProperties {
std::vector<Rule *> rules[7]; std::vector<Rule *> rules[7];
std::vector<Rule *> * getRulesForPhase(int phase) { std::vector<Rule *> * getRulesForPhase(int phase) {
if (phase > 7) if (phase > 7) {
{
return NULL; return NULL;
} }
return &rules[phase]; return &rules[phase];
}; }
// ModSecurity::Phases::NUMBER_OF_PHASES // ModSecurity::Phases::NUMBER_OF_PHASES
std::vector<actions::Action *> defaultActions[7]; std::vector<actions::Action *> defaultActions[7];

View File

@ -23,7 +23,7 @@ MAINTAINERCLEANFILES = \
pkginclude_HEADERS = \ pkginclude_HEADERS = \
../headers/modsecurity/assay.h \ ../headers/modsecurity/transaction.h \
../headers/modsecurity/debug_log.h \ ../headers/modsecurity/debug_log.h \
../headers/modsecurity/intervention.h \ ../headers/modsecurity/intervention.h \
../headers/modsecurity/modsecurity.h \ ../headers/modsecurity/modsecurity.h \
@ -176,7 +176,7 @@ libmodsecurity_la_SOURCES = \
parser/seclang-parser.yy \ parser/seclang-parser.yy \
parser/seclang-scanner.ll \ parser/seclang-scanner.ll \
parser/driver.cc \ parser/driver.cc \
assay.cc \ transaction.cc \
audit_log.cc \ audit_log.cc \
audit_log_writer.cc \ audit_log_writer.cc \
audit_log_writer_serial.cc \ audit_log_writer_serial.cc \

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "actions/block.h" #include "actions/block.h"
@ -42,12 +42,12 @@ namespace actions {
std::string Action::evaluate(std::string value, std::string Action::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
return value; return value;
} }
bool Action::evaluate(Rule *rule, Assay *assay) { bool Action::evaluate(Rule *rule, Transaction *transaction) {
return true; return true;
} }

View File

@ -24,7 +24,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
class Rule; class Rule;
namespace actions { namespace actions {
@ -87,8 +87,8 @@ class Action {
std::string name; std::string name;
virtual std::string evaluate(std::string exp, virtual std::string evaluate(std::string exp,
Assay *assay); Transaction *transaction);
virtual bool evaluate(Rule *rule, Assay *assay); virtual bool evaluate(Rule *rule, Transaction *transaction);
virtual bool init(std::string *error) { return true; } virtual bool init(std::string *error) { return true; }
virtual bool isDisruptive() { return false; } virtual bool isDisruptive() { return false; }

View File

@ -18,13 +18,13 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
bool AuditLog::evaluate(Rule *rule, Assay *assay) { bool AuditLog::evaluate(Rule *rule, Transaction *transaction) {
assay->save_in_auditlog = true; transaction->save_in_auditlog = true;
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_AUDIT_LOG_H_ #define SRC_ACTIONS_AUDIT_LOG_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -34,7 +34,7 @@ class AuditLog : public Action {
explicit AuditLog(std::string action) explicit AuditLog(std::string action)
: Action(action, RunTimeOnlyIfMatchKind) { } : Action(action, RunTimeOnlyIfMatchKind) { }
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
}; };
} // namespace actions } // namespace actions

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "modsecurity/intervention.h" #include "modsecurity/intervention.h"
@ -32,13 +32,13 @@ Block::Block(std::string action)
} }
bool Block::evaluate(Rule *rule, Assay *assay) { bool Block::evaluate(Rule *rule, Transaction *transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(8, "Running action block"); transaction->debug(8, "Running action block");
#endif #endif
for (Action *a : rule->actions_runtime_pos) { for (Action *a : rule->actions_runtime_pos) {
if (a->isDisruptive() == true) { if (a->isDisruptive() == true) {
assay->actions.push_back(a); transaction->actions.push_back(a);
} }
} }
return true; return true;

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_BLOCK_H_ #define SRC_ACTIONS_BLOCK_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -33,7 +33,7 @@ class Block : public Action {
public: public:
explicit Block(std::string action); explicit Block(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
void fill_intervention(ModSecurityIntervention *i) override; void fill_intervention(ModSecurityIntervention *i) override;
bool isDisruptive() override { return true; } bool isDisruptive() override { return true; }
}; };

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include <list> #include <list>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "operators/operator.h" #include "operators/operator.h"
@ -31,7 +31,7 @@
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
bool Capture::evaluate(Rule *rule, Assay *assay) { bool Capture::evaluate(Rule *rule, Transaction *transaction) {
operators::Operator *op = rule->op; operators::Operator *op = rule->op;
std::list<std::string> *match; std::list<std::string> *match;
@ -61,7 +61,7 @@ bool Capture::evaluate(Rule *rule, Assay *assay) {
int i = 0; int i = 0;
while (match->empty() == false) { while (match->empty() == false) {
assay->m_collections.storeOrUpdateFirst("TX", transaction->m_collections.storeOrUpdateFirst("TX",
std::to_string(i), match->back()); std::to_string(i), match->back());
match->pop_back(); match->pop_back();
i++; i++;

View File

@ -31,7 +31,7 @@ class Capture : public Action {
explicit Capture(std::string action) explicit Capture(std::string action)
: Action(action, RunTimeOnlyIfMatchKind) { } : Action(action, RunTimeOnlyIfMatchKind) { }
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
}; };

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
namespace modsecurity { namespace modsecurity {
@ -26,7 +26,7 @@ namespace actions {
bool Chain::evaluate(Rule *rule, Assay *assay) { bool Chain::evaluate(Rule *rule, Transaction *transaction) {
rule->chained = true; rule->chained = true;
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_CHAIN_H_ #define SRC_ACTIONS_CHAIN_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
class Rule; class Rule;
namespace actions { namespace actions {
@ -35,7 +35,7 @@ class Chain : public Action {
explicit Chain(std::string action) explicit Chain(std::string action)
: Action(action, ConfigurationKind) { } : Action(action, ConfigurationKind) { }
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
}; };
} // namespace actions } // namespace actions

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
@ -35,8 +35,9 @@ CtlAuditLogParts::CtlAuditLogParts(std::string action)
} }
} }
bool CtlAuditLogParts::evaluate(Rule *rule, Assay *assay) { bool CtlAuditLogParts::evaluate(Rule *rule, Transaction *transaction) {
assay->auditLogModifier.push_back(std::make_pair(mPartsAction, mParts)); transaction->auditLogModifier.push_back(
std::make_pair(mPartsAction, mParts));
return true; return true;
} }

View File

@ -16,7 +16,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#ifndef SRC_ACTIONS_CTL_AUDIT_LOG_PARTS_H_ #ifndef SRC_ACTIONS_CTL_AUDIT_LOG_PARTS_H_
#define SRC_ACTIONS_CTL_AUDIT_LOG_PARTS_H_ #define SRC_ACTIONS_CTL_AUDIT_LOG_PARTS_H_
@ -29,7 +29,7 @@ class CtlAuditLogParts : public Action {
public: public:
explicit CtlAuditLogParts(std::string action); explicit CtlAuditLogParts(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
int mPartsAction; int mPartsAction;
std::string mParts; std::string mParts;
}; };

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
@ -30,11 +30,11 @@ Deny::Deny(std::string action)
} }
bool Deny::evaluate(Rule *rule, Assay *assay) { bool Deny::evaluate(Rule *rule, Transaction *transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(8, "Running action deny"); transaction->debug(8, "Running action deny");
#endif #endif
assay->actions.push_back(this); transaction->actions.push_back(this);
return true; return true;
} }

View File

@ -16,7 +16,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#ifndef SRC_ACTIONS_DENY_H_ #ifndef SRC_ACTIONS_DENY_H_
#define SRC_ACTIONS_DENY_H_ #define SRC_ACTIONS_DENY_H_
@ -29,7 +29,7 @@ class Deny : public Action {
public: public:
explicit Deny(std::string action); explicit Deny(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
void fill_intervention(ModSecurityIntervention *i) override; void fill_intervention(ModSecurityIntervention *i) override;
bool isDisruptive() override { return true; } bool isDisruptive() override { return true; }
}; };

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
@ -50,9 +50,9 @@ bool InitCol::init(std::string *error) {
} }
bool InitCol::evaluate(Rule *rule, Assay *assay) { bool InitCol::evaluate(Rule *rule, Transaction *transaction) {
std::string collectionName; std::string collectionName;
collectionName = MacroExpansion::expand(m_collection_value, assay); collectionName = MacroExpansion::expand(m_collection_value, transaction);
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_INIT_COL_H_ #ifndef SRC_ACTIONS_INIT_COL_H_
#define SRC_ACTIONS_INIT_COL_H_ #define SRC_ACTIONS_INIT_COL_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class InitCol : public Action {
public: public:
explicit InitCol(std::string action); explicit InitCol(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
bool init(std::string *error) override; bool init(std::string *error) override;
private: private:
std::string m_collection_key; std::string m_collection_key;

View File

@ -18,15 +18,15 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
bool Log::evaluate(Rule *rule, Assay *assay) { bool Log::evaluate(Rule *rule, Transaction *transaction) {
assay->save_in_auditlog = true; transaction->save_in_auditlog = true;
/* FIXME: assay->serverLog("Something...."); */ /* FIXME: transaction->serverLog("Something...."); */
assay->debug(9, "Saving transaction to logs"); transaction->debug(9, "Saving transaction to logs");
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_LOG_H_ #ifndef SRC_ACTIONS_LOG_H_
#define SRC_ACTIONS_LOG_H_ #define SRC_ACTIONS_LOG_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -32,7 +32,7 @@ class Log : public Action {
explicit Log(std::string action) explicit Log(std::string action)
: Action(action, RunTimeOnlyIfMatchKind) { } : Action(action, RunTimeOnlyIfMatchKind) { }
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
}; };
} // namespace actions } // namespace actions

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
@ -34,13 +34,13 @@ LogData::LogData(std::string action)
} }
bool LogData::evaluate(Rule *rule, Assay *assay) { bool LogData::evaluate(Rule *rule, Transaction *transaction) {
std::string msg = MacroExpansion::expand(m_data, assay); std::string msg = MacroExpansion::expand(m_data, transaction);
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(9, "Saving msg: " + msg); transaction->debug(9, "Saving msg: " + msg);
#endif #endif
assay->rulesMessages.push_back(msg); transaction->rulesMessages.push_back(msg);
assay->serverLog(msg); transaction->serverLog(msg);
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_LOG_DATA_H_ #ifndef SRC_ACTIONS_LOG_DATA_H_
#define SRC_ACTIONS_LOG_DATA_H_ #define SRC_ACTIONS_LOG_DATA_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class LogData : public Action {
public: public:
explicit LogData(std::string action); explicit LogData(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
std::string m_data; std::string m_data;

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
@ -34,13 +34,13 @@ Msg::Msg(std::string action)
} }
bool Msg::evaluate(Rule *rule, Assay *assay) { bool Msg::evaluate(Rule *rule, Transaction *transaction) {
std::string msg = MacroExpansion::expand(m_msg, assay); std::string msg = MacroExpansion::expand(m_msg, transaction);
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(9, "Saving msg: " + msg); transaction->debug(9, "Saving msg: " + msg);
#endif #endif
assay->rulesMessages.push_back(msg); transaction->rulesMessages.push_back(msg);
assay->serverLog(msg); transaction->serverLog(msg);
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_MSG_H_ #ifndef SRC_ACTIONS_MSG_H_
#define SRC_ACTIONS_MSG_H_ #define SRC_ACTIONS_MSG_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class Msg : public Action {
public: public:
explicit Msg(std::string action); explicit Msg(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
std::string m_msg; std::string m_msg;

View File

@ -18,13 +18,13 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
bool NoAuditLog::evaluate(Rule *rule, Assay *assay) { bool NoAuditLog::evaluate(Rule *rule, Transaction *transaction) {
assay->do_not_save_in_auditlog = true; transaction->do_not_save_in_auditlog = true;
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_NO_AUDIT_LOG_H_ #define SRC_ACTIONS_NO_AUDIT_LOG_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -34,7 +34,7 @@ class NoAuditLog : public Action {
explicit NoAuditLog(std::string action) explicit NoAuditLog(std::string action)
: Action(action, RunTimeOnlyIfMatchKind) { } : Action(action, RunTimeOnlyIfMatchKind) { }
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
}; };
} // namespace actions } // namespace actions

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
namespace modsecurity { namespace modsecurity {
@ -31,8 +31,8 @@ Pass::Pass(std::string action)
} }
bool Pass::evaluate(Rule *rule, Assay *assay) { bool Pass::evaluate(Rule *rule, Transaction *transaction) {
assay->actions.clear(); transaction->actions.clear();
return true; return true;
} }

View File

@ -16,7 +16,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#ifndef SRC_ACTIONS_PASS_H_ #ifndef SRC_ACTIONS_PASS_H_
#define SRC_ACTIONS_PASS_H_ #define SRC_ACTIONS_PASS_H_
@ -29,7 +29,7 @@ class Pass : public Action {
public: public:
explicit Pass(std::string action); explicit Pass(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
bool isDisruptive() override { return true; } bool isDisruptive() override { return true; }
}; };

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "src/utils.h" #include "src/utils.h"
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
@ -77,7 +77,7 @@ bool Phase::init(std::string *error) {
} }
bool Phase::evaluate(Rule *rule, Assay *assay) { bool Phase::evaluate(Rule *rule, Transaction *transaction) {
rule->phase = this->phase; rule->phase = this->phase;
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_PHASE_H_ #define SRC_ACTIONS_PHASE_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
class Rule; class Rule;
namespace actions { namespace actions {
@ -35,7 +35,7 @@ class Phase : public Action {
explicit Phase(std::string action); explicit Phase(std::string action);
bool init(std::string *error) override; bool init(std::string *error) override;
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
int phase; int phase;
int m_secRulesPhase; int m_secRulesPhase;
}; };

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
namespace modsecurity { namespace modsecurity {
@ -41,9 +41,9 @@ Redirect::Redirect(const std::string& action)
} }
bool Redirect::evaluate(Rule *rule, Assay *assay) { bool Redirect::evaluate(Rule *rule, Transaction *transaction) {
m_urlExpanded = MacroExpansion::expand(m_url, assay); m_urlExpanded = MacroExpansion::expand(m_url, transaction);
assay->actions.push_back(this); transaction->actions.push_back(this);
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_REDIRECT_H_ #define SRC_ACTIONS_REDIRECT_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -33,7 +33,7 @@ class Redirect : public Action {
explicit Redirect(const std::string &action); explicit Redirect(const std::string &action);
~Redirect() override; ~Redirect() override;
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
void fill_intervention(ModSecurityIntervention *i) override; void fill_intervention(ModSecurityIntervention *i) override;
bool isDisruptive() override { return true; } bool isDisruptive() override { return true; }
private: private:

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
@ -37,7 +37,7 @@ Rev::Rev(std::string action)
} }
bool Rev::evaluate(Rule *rule, Assay *assay) { bool Rev::evaluate(Rule *rule, Transaction *transaction) {
rule->rev = m_rev; rule->rev = m_rev;
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_REV_H_ #ifndef SRC_ACTIONS_REV_H_
#define SRC_ACTIONS_REV_H_ #define SRC_ACTIONS_REV_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class Rev : public Action {
public: public:
explicit Rev(std::string action); explicit Rev(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
std::string m_rev; std::string m_rev;

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
namespace modsecurity { namespace modsecurity {
@ -51,7 +51,7 @@ bool RuleId::init(std::string *error) {
return true; return true;
} }
bool RuleId::evaluate(Rule *rule, Assay *assay) { bool RuleId::evaluate(Rule *rule, Transaction *transaction) {
rule->rule_id = m_ruleId; rule->rule_id = m_ruleId;
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_RULE_ID_H_ #define SRC_ACTIONS_RULE_ID_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
class Rule; class Rule;
namespace actions { namespace actions {
@ -37,7 +37,7 @@ class RuleId : public Action {
m_ruleId(0) { } m_ruleId(0) { }
bool init(std::string *error) override; bool init(std::string *error) override;
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
double m_ruleId; double m_ruleId;

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "modsecurity/rule.h" #include "modsecurity/rule.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
#include "src/utils.h" #include "src/utils.h"
@ -99,11 +99,11 @@ void SetVar::dump() {
std::cout << " Predicate: " << predicate << std::endl; std::cout << " Predicate: " << predicate << std::endl;
} }
bool SetVar::evaluate(Rule *rule, Assay *assay) { bool SetVar::evaluate(Rule *rule, Transaction *transaction) {
std::string targetValue; std::string targetValue;
std::string variableNameExpanded = MacroExpansion::expand(variableName, std::string variableNameExpanded = MacroExpansion::expand(variableName,
assay); transaction);
std::string resolvedPre = MacroExpansion::expand(predicate, assay); std::string resolvedPre = MacroExpansion::expand(predicate, transaction);
if (operation == setOperation) { if (operation == setOperation) {
targetValue = resolvedPre; targetValue = resolvedPre;
@ -121,7 +121,7 @@ bool SetVar::evaluate(Rule *rule, Assay *assay) {
try { try {
std::string *resolvedValue = std::string *resolvedValue =
assay->m_collections.resolveFirst(collectionName, transaction->m_collections.resolveFirst(collectionName,
variableNameExpanded); variableNameExpanded);
if (resolvedValue == NULL) { if (resolvedValue == NULL) {
value = 0; value = 0;
@ -143,10 +143,10 @@ bool SetVar::evaluate(Rule *rule, Assay *assay) {
} }
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(8, "Saving variable: " + collectionName + ":" + \ transaction->debug(8, "Saving variable: " + collectionName + ":" + \
variableNameExpanded + " with value: " + targetValue); variableNameExpanded + " with value: " + targetValue);
#endif #endif
assay->m_collections.storeOrUpdateFirst(collectionName, transaction->m_collections.storeOrUpdateFirst(collectionName,
variableNameExpanded, targetValue); variableNameExpanded, targetValue);
return true; return true;

View File

@ -21,7 +21,7 @@
#define SRC_ACTIONS_SET_VAR_H_ #define SRC_ACTIONS_SET_VAR_H_
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
class Rule; class Rule;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class SetVar : public Action {
public: public:
explicit SetVar(std::string action); explicit SetVar(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
void dump(); void dump();
bool init(std::string *error) override; bool init(std::string *error) override;

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
namespace modsecurity { namespace modsecurity {
@ -50,15 +50,15 @@ Severity::Severity(std::string action)
} }
bool Severity::evaluate(Rule *rule, Assay *assay) { bool Severity::evaluate(Rule *rule, Transaction *transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(9, "This rule severity is: " + \ transaction->debug(9, "This rule severity is: " + \
std::to_string(this->m_severity) + " current assay is: " + \ std::to_string(this->m_severity) + " current transaction is: " + \
std::to_string(assay->highest_severity)); std::to_string(transaction->highest_severity));
#endif #endif
if (assay->highest_severity > this->m_severity) { if (transaction->highest_severity > this->m_severity) {
assay->highest_severity = this->m_severity; transaction->highest_severity = this->m_severity;
} }
return true; return true;
} }

View File

@ -21,10 +21,10 @@
#define SRC_ACTIONS_SEVERITY_H_ #define SRC_ACTIONS_SEVERITY_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -33,7 +33,7 @@ class Severity : public Action {
public: public:
explicit Severity(std::string action); explicit Severity(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
int m_severity; int m_severity;

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
namespace modsecurity { namespace modsecurity {
@ -31,11 +31,11 @@ SkipAfter::SkipAfter(std::string action)
} }
bool SkipAfter::evaluate(Rule *rule, Assay *assay) { bool SkipAfter::evaluate(Rule *rule, Transaction *transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(5, "Setting skipAfter for: " + m_marker); transaction->debug(5, "Setting skipAfter for: " + m_marker);
#endif #endif
assay->m_marker = m_marker; transaction->m_marker = m_marker;
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_SKIP_AFTER_H_ #ifndef SRC_ACTIONS_SKIP_AFTER_H_
#define SRC_ACTIONS_SKIP_AFTER_H_ #define SRC_ACTIONS_SKIP_AFTER_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class SkipAfter : public Action {
public: public:
explicit SkipAfter(std::string action); explicit SkipAfter(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
std::string m_marker; std::string m_marker;

View File

@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
namespace modsecurity { namespace modsecurity {
namespace actions { namespace actions {
@ -33,8 +33,8 @@ Status::Status(std::string action)
} }
bool Status::evaluate(Rule *rule, Assay *assay) { bool Status::evaluate(Rule *rule, Transaction *transaction) {
assay->actions.push_back(this); transaction->actions.push_back(this);
return true; return true;
} }

View File

@ -21,17 +21,17 @@
#define SRC_ACTIONS_STATUS_H_ #define SRC_ACTIONS_STATUS_H_
#ifdef __cplusplus #ifdef __cplusplus
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
class Status : public Action { class Status : public Action {
public: public:
explicit Status(std::string actions); explicit Status(std::string actions);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
void fill_intervention(ModSecurityIntervention *i) override; void fill_intervention(ModSecurityIntervention *i) override;
int status; int status;
}; };

View File

@ -19,7 +19,7 @@
#include <string> #include <string>
#include "actions/action.h" #include "actions/action.h"
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "src/utils.h" #include "src/utils.h"
#include "src/macro_expansion.h" #include "src/macro_expansion.h"
@ -34,12 +34,12 @@ Tag::Tag(std::string action)
} }
bool Tag::evaluate(Rule *rule, Assay *assay) { bool Tag::evaluate(Rule *rule, Transaction *transaction) {
std::string tag = MacroExpansion::expand(m_tag, assay); std::string tag = MacroExpansion::expand(m_tag, transaction);
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(9, "Rule tag: " + tag); transaction->debug(9, "Rule tag: " + tag);
#endif #endif
assay->ruleTags.push_back(tag); transaction->ruleTags.push_back(tag);
return true; return true;
} }

View File

@ -20,10 +20,10 @@
#ifndef SRC_ACTIONS_TAG_H_ #ifndef SRC_ACTIONS_TAG_H_
#define SRC_ACTIONS_TAG_H_ #define SRC_ACTIONS_TAG_H_
class Assay; class Transaction;
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
@ -31,7 +31,7 @@ class Tag : public Action {
public: public:
explicit Tag(std::string action); explicit Tag(std::string action);
bool evaluate(Rule *rule, Assay *assay) override; bool evaluate(Rule *rule, Transaction *transaction) override;
private: private:
std::string m_tag; std::string m_tag;

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ Base64Decode::Base64Decode(std::string action)
} }
std::string Base64Decode::evaluate(std::string value, std::string Base64Decode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation base64decode * @todo Implement the transformation base64decode
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation 64 is not implemented yet."); transaction->debug(4, "Transformation 64 is not implemented yet.");
#endif #endif
} }
return value; return value;

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class Base64Decode : public Transformation {
public: public:
explicit Base64Decode(std::string action); explicit Base64Decode(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ Base64DecodeExt::Base64DecodeExt(std::string action)
} }
std::string Base64DecodeExt::evaluate(std::string value, std::string Base64DecodeExt::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation Base64DecodeExt * @todo Implement the transformation Base64DecodeExt
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation Base64DecodeExt is" \ transaction->debug(4, "Transformation Base64DecodeExt is" \
" not implemented yet."); " not implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class Base64DecodeExt : public Transformation {
public: public:
explicit Base64DecodeExt(std::string action); explicit Base64DecodeExt(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ CmdLine::CmdLine(std::string action)
} }
std::string CmdLine::evaluate(std::string value, std::string CmdLine::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation CmdLine * @todo Implement the transformation CmdLine
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation CmdLine is not implemented yet."); transaction->debug(4, "Transformation CmdLine is not implemented yet.");
#endif #endif
} }
return value; return value;

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class CmdLine : public Transformation {
public: public:
explicit CmdLine(std::string action); explicit CmdLine(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,7 +36,7 @@ CompressWhitespace::CompressWhitespace(std::string action)
} }
std::string CompressWhitespace::evaluate(std::string value, std::string CompressWhitespace::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
std::string a; std::string a;
int inWhiteSpace = 0; int inWhiteSpace = 0;

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class CompressWhitespace : public Transformation {
public: public:
explicit CompressWhitespace(std::string action); explicit CompressWhitespace(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -24,7 +24,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -35,7 +35,7 @@ namespace transformations {
std::string CssDecode::evaluate(std::string value, std::string CssDecode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
char *tmp = reinterpret_cast<char *>( char *tmp = reinterpret_cast<char *>(
malloc(sizeof(char) * value.size() + 1)); malloc(sizeof(char) * value.size() + 1));

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -34,7 +34,7 @@ class CssDecode : public Transformation {
explicit CssDecode(std::string action) explicit CssDecode(std::string action)
: Transformation(action) { } : Transformation(action) { }
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -140,7 +140,7 @@ int EscapeSeqDecode::ansi_c_sequences_decode_inplace(unsigned char *input,
std::string EscapeSeqDecode::evaluate(std::string value, std::string EscapeSeqDecode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
unsigned char *tmp = (unsigned char *) malloc(sizeof(char) unsigned char *tmp = (unsigned char *) malloc(sizeof(char)
* value.size() + 1); * value.size() + 1);

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class EscapeSeqDecode : public Transformation {
public: public:
explicit EscapeSeqDecode(std::string action); explicit EscapeSeqDecode(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
int ansi_c_sequences_decode_inplace(unsigned char *input, int input_len); int ansi_c_sequences_decode_inplace(unsigned char *input, int input_len);
}; };

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -38,7 +38,7 @@ HexDecode::HexDecode(std::string action)
std::string HexDecode::evaluate(std::string value, std::string HexDecode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
int len = value.length(); int len = value.length();
std::string newString; std::string newString;

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class HexDecode : public Transformation {
public: public:
explicit HexDecode(std::string action); explicit HexDecode(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -23,7 +23,7 @@
#include <locale> #include <locale>
#include <iterator> #include <iterator>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -37,7 +37,7 @@ HexEncode::HexEncode(std::string action)
} }
std::string HexEncode::evaluate(std::string value, std::string HexEncode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
std::stringstream result; std::stringstream result;
for (std::size_t i=0; i < value.length(); i++) { for (std::size_t i=0; i < value.length(); i++) {

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class HexEncode : public Transformation {
public: public:
explicit HexEncode(std::string action); explicit HexEncode(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -24,7 +24,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -35,7 +35,7 @@ namespace transformations {
std::string HtmlEntityDecode::evaluate(std::string value, std::string HtmlEntityDecode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
if (HtmlEntityDecodeInstantCache::getInstance().count(value) > 0) { if (HtmlEntityDecodeInstantCache::getInstance().count(value) > 0) {
return HtmlEntityDecodeInstantCache::getInstance().at(value); return HtmlEntityDecodeInstantCache::getInstance().at(value);

View File

@ -24,7 +24,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -55,7 +55,7 @@ class HtmlEntityDecode : public Transformation {
: Transformation(action) { } : Transformation(action) { }
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };

View File

@ -24,7 +24,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -35,7 +35,7 @@ namespace transformations {
std::string JsDecode::evaluate(std::string value, std::string JsDecode::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
char *val = reinterpret_cast<char *>( char *val = reinterpret_cast<char *>(
malloc(sizeof(char) * value.size() + 1)); malloc(sizeof(char) * value.size() + 1));

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -34,7 +34,7 @@ class JsDecode : public Transformation {
: Transformation(action) { } : Transformation(action) { }
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,7 +36,7 @@ Length::Length(std::string action)
} }
std::string Length::evaluate(std::string value, std::string Length::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
return std::to_string(value.size()); return std::to_string(value.size());
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class Length : public Transformation {
public: public:
explicit Length(std::string action); explicit Length(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -18,7 +18,7 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "actions/action.h" #include "actions/action.h"
@ -32,7 +32,7 @@ LowerCase::LowerCase(std::string a)
} }
std::string LowerCase::evaluate(std::string value, std::string LowerCase::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
std::locale loc; std::locale loc;
if (LowerCaseInstantCache::getInstance().count(value) > 0) { if (LowerCaseInstantCache::getInstance().count(value) > 0) {

View File

@ -25,7 +25,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -52,7 +52,7 @@ class LowerCase : public Transformation {
public: public:
explicit LowerCase(std::string action); explicit LowerCase(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ Md5::Md5(std::string action)
} }
std::string Md5::evaluate(std::string value, std::string Md5::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation Md5 * @todo Implement the transformation Md5
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation Md5 is not implemented yet."); transaction->debug(4, "Transformation Md5 is not implemented yet.");
#endif #endif
} }
return value; return value;

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -33,7 +33,7 @@ class Md5 : public Transformation {
explicit Md5(std::string action); explicit Md5(std::string action);
std::string std::string
evaluate(std::string exp, evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -32,7 +32,7 @@ namespace transformations {
std::string None::evaluate(std::string value, std::string None::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
return value; return value;
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -35,7 +35,7 @@ class None : public Transformation {
{ m_isNone = true; } { m_isNone = true; }
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -24,7 +24,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -39,7 +39,7 @@ NormalisePath::NormalisePath(std::string action)
} }
std::string NormalisePath::evaluate(std::string value, std::string NormalisePath::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
int changed = 0; int changed = 0;
char *tmp = reinterpret_cast<char *>( char *tmp = reinterpret_cast<char *>(

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class NormalisePath : public Transformation {
public: public:
explicit NormalisePath(std::string action); explicit NormalisePath(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -24,7 +24,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -35,7 +35,7 @@ namespace transformations {
std::string NormalisePathWin::evaluate(std::string value, std::string NormalisePathWin::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
int changed; int changed;
char *tmp = reinterpret_cast<char *>( char *tmp = reinterpret_cast<char *>(

View File

@ -23,7 +23,7 @@
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -34,7 +34,7 @@ class NormalisePathWin : public Transformation {
: Transformation(action) { } : Transformation(action) { }
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ ParityEven7bit::ParityEven7bit(std::string action)
} }
std::string ParityEven7bit::evaluate(std::string value, std::string ParityEven7bit::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation ParityEven7bit * @todo Implement the transformation ParityEven7bit
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation ParityEven7bit is not" \ transaction->debug(4, "Transformation ParityEven7bit is not" \
" implemented yet."); " implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class ParityEven7bit : public Transformation {
public: public:
explicit ParityEven7bit(std::string action); explicit ParityEven7bit(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ ParityOdd7bit::ParityOdd7bit(std::string action)
} }
std::string ParityOdd7bit::evaluate(std::string value, std::string ParityOdd7bit::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation ParityOdd7bit * @todo Implement the transformation ParityOdd7bit
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation ParityOdd7bit is not " \ transaction->debug(4, "Transformation ParityOdd7bit is not " \
"implemented yet."); "implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class ParityOdd7bit : public Transformation {
public: public:
explicit ParityOdd7bit(std::string action); explicit ParityOdd7bit(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ ParityZero7bit::ParityZero7bit(std::string action)
} }
std::string ParityZero7bit::evaluate(std::string value, std::string ParityZero7bit::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation ParityZero7bit * @todo Implement the transformation ParityZero7bit
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation ParityZero7bit is not" \ transaction->debug(4, "Transformation ParityZero7bit is not" \
"implemented yet."); "implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class ParityZero7bit : public Transformation {
public: public:
explicit ParityZero7bit(std::string action); explicit ParityZero7bit(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ RemoveComments::RemoveComments(std::string action)
} }
std::string RemoveComments::evaluate(std::string value, std::string RemoveComments::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation RemoveComments * @todo Implement the transformation RemoveComments
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation RemoveComments is not " \ transaction->debug(4, "Transformation RemoveComments is not " \
"implemented yet."); "implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class RemoveComments : public Transformation {
public: public:
explicit RemoveComments(std::string action); explicit RemoveComments(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ RemoveCommentsChar::RemoveCommentsChar(std::string action)
} }
std::string RemoveCommentsChar::evaluate(std::string value, std::string RemoveCommentsChar::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation RemoveCommentsChar * @todo Implement the transformation RemoveCommentsChar
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation RemoveCommentsChar " \ transaction->debug(4, "Transformation RemoveCommentsChar " \
"is not implemented yet."); "is not implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class RemoveCommentsChar : public Transformation {
public: public:
explicit RemoveCommentsChar(std::string action); explicit RemoveCommentsChar(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -24,7 +24,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -34,7 +34,7 @@ namespace transformations {
std::string RemoveNulls::evaluate(std::string value, std::string RemoveNulls::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
int64_t i; int64_t i;
i = 0; i = 0;

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -34,7 +34,7 @@ class RemoveNulls : public Transformation {
: Transformation(action) { } : Transformation(action) { }
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
@ -36,13 +36,13 @@ RemoveWhitespace::RemoveWhitespace(std::string action)
} }
std::string RemoveWhitespace::evaluate(std::string value, std::string RemoveWhitespace::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
/** /**
* @todo Implement the transformation RemoveWhitespace * @todo Implement the transformation RemoveWhitespace
*/ */
if (assay) { if (transaction) {
#ifndef NO_LOGS #ifndef NO_LOGS
assay->debug(4, "Transformation RemoveWhitespace is " \ transaction->debug(4, "Transformation RemoveWhitespace is " \
"not implemented yet."); "not implemented yet.");
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class RemoveWhitespace : public Transformation {
public: public:
explicit RemoveWhitespace(std::string action); explicit RemoveWhitespace(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

View File

@ -22,7 +22,7 @@
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include "modsecurity/assay.h" #include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h" #include "actions/transformations/transformation.h"
#include "src/utils.h" #include "src/utils.h"
@ -37,7 +37,7 @@ ReplaceComments::ReplaceComments(std::string action)
} }
std::string ReplaceComments::evaluate(std::string value, std::string ReplaceComments::evaluate(std::string value,
Assay *assay) { Transaction *transaction) {
uint64_t i, j, incomment; uint64_t i, j, incomment;
char *input = reinterpret_cast<char *>( char *input = reinterpret_cast<char *>(

View File

@ -23,7 +23,7 @@
#ifdef __cplusplus #ifdef __cplusplus
namespace modsecurity { namespace modsecurity {
class Assay; class Transaction;
namespace actions { namespace actions {
namespace transformations { namespace transformations {
@ -32,7 +32,7 @@ class ReplaceComments : public Transformation {
public: public:
explicit ReplaceComments(std::string action); explicit ReplaceComments(std::string action);
std::string evaluate(std::string exp, std::string evaluate(std::string exp,
Assay *assay) override; Transaction *transaction) override;
}; };
} // namespace transformations } // namespace transformations

Some files were not shown because too many files have changed in this diff Show More