@@ -35,21 +35,43 @@ class Action {
3535 public:
3636 explicit Action (const std::string& _action)
3737 : action_kind(2 ),
38- action(_action ),
39- name(_action ),
38+ m_name( " " ),
39+ m_parser_payload( " " ),
4040 m_isNone(false ),
4141 temporaryAction(false ) {
42- name. erase ( 0 , 2 );
42+ set_name_and_payload (_action );
4343 }
4444 explicit Action (const std::string& _action, int kind)
4545 : action_kind(kind),
46- action(_action ),
47- name(_action ),
46+ m_name( " " ),
47+ m_parser_payload( " " ),
4848 m_isNone(false ),
4949 temporaryAction(false ) {
50- name. erase ( 0 , 2 );
50+ set_name_and_payload (_action );
5151 }
5252
53+ void set_name_and_payload (const std::string& data) {
54+ size_t pos = data.find (" :" );
55+ std::string t = " t:" ;
56+
57+ if (data.compare (0 , t.length (), t) == 0 ) {
58+ pos = data.find (" :" , 2 );
59+ }
60+
61+ if (pos == std::string::npos) {
62+ m_name = data;
63+ return ;
64+ }
65+
66+ m_name = std::string (data, 0 , pos);
67+ m_parser_payload = std::string (data, pos + 1 , data.length ());
68+
69+ if (m_parser_payload.at (0 ) == ' \' ' && m_parser_payload.size () > 2 ) {
70+ m_parser_payload.erase (0 , 1 );
71+ m_parser_payload.pop_back ();
72+ }
73+ }
74+
5375 virtual ~Action () { }
5476 /* *
5577 *
@@ -83,9 +105,6 @@ class Action {
83105 RunTimeOnlyIfMatchKind,
84106 };
85107
86- std::string action;
87- int action_kind;
88- std::string name;
89108
90109 virtual std::string evaluate (std::string exp,
91110 Transaction *transaction);
@@ -94,14 +113,20 @@ class Action {
94113 RuleMessage *ruleMessage) {
95114 return evaluate (rule, transaction);
96115 }
116+
97117 virtual bool init (std::string *error) { return true ; }
118+
98119 virtual bool isDisruptive () { return false ; }
99120
121+ virtual void fillIntervention (ModSecurityIntervention *intervention);
122+
100123 static Action *instantiate (const std::string& name);
101124
102- virtual void fill_intervention (ModSecurityIntervention *intervention);
103125 bool temporaryAction;
126+ std::string m_name;
127+ std::string m_parser_payload;
104128 bool m_isNone;
129+ int action_kind;
105130};
106131
107132
0 commit comments