mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 02:10:36 +03:00
actions: Removes Rule parameter from runtime execute
Generals organization on the Action class
This commit is contained in:
committed by
Felipe Zimmerle
parent
eb3e05646d
commit
bf3a1d84ff
@@ -13,11 +13,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "src/actions/data/status.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "modsecurity/transaction.h"
|
||||
|
||||
@@ -26,11 +25,12 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
namespace data {
|
||||
|
||||
|
||||
bool Status::init(std::string *error) {
|
||||
try {
|
||||
m_status = std::stoi(m_parser_payload);
|
||||
m_status = std::stoi(m_parserPayload);
|
||||
} catch (...) {
|
||||
error->assign("Not a valid number: " + m_parser_payload);
|
||||
error->assign("Not a valid number: " + m_parserPayload);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ bool Status::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Status::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Status::execute(Transaction *transaction) noexcept {
|
||||
transaction->m_it.status = m_status;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,32 +13,36 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "modsecurity/actions/action.h"
|
||||
#include "modsecurity/rule_message.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
|
||||
#include "src/actions/action_allowed_in_sec_default_action.h"
|
||||
|
||||
|
||||
#ifndef SRC_ACTIONS_DATA_STATUS_H_
|
||||
#define SRC_ACTIONS_DATA_STATUS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
class Transaction;
|
||||
|
||||
namespace modsecurity {
|
||||
class Transaction;
|
||||
namespace actions {
|
||||
namespace data {
|
||||
|
||||
|
||||
class Status : public Action {
|
||||
class Status : public ActionAllowedAsSecDefaultAction {
|
||||
public:
|
||||
explicit Status(const std::string &action) : Action(action, 2),
|
||||
m_status(0) { }
|
||||
explicit Status(const std::string &action)
|
||||
: Action(action),
|
||||
m_status(0)
|
||||
{ }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
bool execute(Transaction *transaction) noexcept override;
|
||||
|
||||
private:
|
||||
int m_status;
|
||||
};
|
||||
|
||||
@@ -46,6 +50,6 @@ class Status : public Action {
|
||||
} // namespace data
|
||||
} // namespace actions
|
||||
} // namespace modsecurity
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SRC_ACTIONS_DATA_STATUS_H_
|
||||
|
||||
Reference in New Issue
Block a user