mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Handles better the memory utilization
- Added reference counts to Rule and AuditLog; - Some memory leaks were removed, including GeoLookup; - Deal better with parser errors; - Overriding the AutlogLogWritter destructor.
This commit is contained in:
@@ -55,7 +55,7 @@ bool Action::evaluate(Rule *rule) {
|
||||
void Action::fill_intervention(ModSecurityIntervention *i) {
|
||||
}
|
||||
|
||||
Action *Action::instantiate(std::string name) {
|
||||
Action *Action::instantiate(const std::string& name) {
|
||||
std::string status("status:");
|
||||
std::string redirect("redirect:");
|
||||
std::string block("block");
|
||||
|
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "modsecurity/intervention.h"
|
||||
|
||||
@@ -31,13 +32,16 @@ namespace actions {
|
||||
|
||||
class Action {
|
||||
public:
|
||||
explicit Action(std::string _action)
|
||||
explicit Action(const std::string& _action)
|
||||
: action_kind(2),
|
||||
action(_action) { }
|
||||
explicit Action(std::string _action, int kind)
|
||||
action(_action),
|
||||
temporaryAction(false) { }
|
||||
explicit Action(const std::string& _action, int kind)
|
||||
: action_kind(kind),
|
||||
action(_action) { }
|
||||
action(_action),
|
||||
temporaryAction(false) { }
|
||||
|
||||
virtual ~Action() { }
|
||||
/**
|
||||
*
|
||||
* Define the action kind regarding to the execution time.
|
||||
@@ -79,9 +83,10 @@ class Action {
|
||||
virtual bool evaluate(Assay *assay);
|
||||
virtual bool evaluate(Rule *rule);
|
||||
|
||||
static Action *instantiate(std::string action);
|
||||
static Action *instantiate(const std::string& name);
|
||||
|
||||
virtual void fill_intervention(ModSecurityIntervention *intervention);
|
||||
bool temporaryAction;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -23,12 +23,13 @@
|
||||
namespace ModSecurity {
|
||||
namespace actions {
|
||||
|
||||
Redirect::Redirect(std::string action)
|
||||
: Action(action) {
|
||||
this->url = action;
|
||||
this->url.erase(0, 9);
|
||||
this->action = action;
|
||||
this->action_kind = 2;
|
||||
Redirect::~Redirect() {
|
||||
}
|
||||
|
||||
Redirect::Redirect(const std::string& action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind),
|
||||
url(action) {
|
||||
this->url = this->url.erase(0, 9);
|
||||
this->status = 302;
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,8 @@ namespace actions {
|
||||
|
||||
class Redirect : public Action {
|
||||
public:
|
||||
explicit Redirect(std::string action);
|
||||
explicit Redirect(const std::string &action);
|
||||
~Redirect() override;
|
||||
|
||||
bool evaluate(Assay *assay) override;
|
||||
int status;
|
||||
|
Reference in New Issue
Block a user