@@ -40,11 +40,17 @@ class Rule_DictElement : public VariableDictElement { \
40
40
static void id (Transaction *t,
41
41
Rule *rule,
42
42
std::vector<const VariableValue *> *l) {
43
- if (!rule) {
43
+ Rule *r = rule;
44
+
45
+ while (r && r->m_ruleId == 0 ) {
46
+ r = r->m_chainedRuleParent ;
47
+ }
48
+
49
+ if (!r || r->m_ruleId == 0 ) {
44
50
return ;
45
51
}
46
52
std::unique_ptr<VariableOrigin> origin (new VariableOrigin ());
47
- std::string *a = new std::string (std::to_string (rule ->m_ruleId ));
53
+ std::string *a = new std::string (std::to_string (r ->m_ruleId ));
48
54
VariableValue *var = new VariableValue (
49
55
std::make_shared<std::string>(" RULE:id" ),
50
56
a
@@ -60,11 +66,18 @@ class Rule_DictElement : public VariableDictElement { \
60
66
static void rev (Transaction *t,
61
67
Rule *rule,
62
68
std::vector<const VariableValue *> *l) {
63
- if (!rule) {
69
+ Rule *r = rule;
70
+
71
+ while (r && r->m_rev .empty ()) {
72
+ r = r->m_chainedRuleParent ;
73
+ }
74
+
75
+ if (!r) {
64
76
return ;
65
77
}
78
+
66
79
std::unique_ptr<VariableOrigin> origin (new VariableOrigin ());
67
- std::string *a = new std::string (rule ->m_rev );
80
+ std::string *a = new std::string (r ->m_rev );
68
81
VariableValue *var = new VariableValue (
69
82
std::make_shared<std::string>(" RULE:rev" ),
70
83
a
@@ -80,9 +93,15 @@ class Rule_DictElement : public VariableDictElement { \
80
93
static void severity (Transaction *t,
81
94
Rule *rule,
82
95
std::vector<const VariableValue *> *l) {
83
- if (rule && rule->m_severity ) {
96
+ Rule *r = rule;
97
+
98
+ while (r && !r->m_severity ) {
99
+ r = r->m_chainedRuleParent ;
100
+ }
101
+
102
+ if (r && r->m_severity ) {
84
103
std::unique_ptr<VariableOrigin> origin (new VariableOrigin ());
85
- std::string *a = new std::string (std::to_string (rule ->m_severity ->m_severity ));
104
+ std::string *a = new std::string (std::to_string (r ->m_severity ->m_severity ));
86
105
VariableValue *var = new VariableValue (
87
106
std::make_shared<std::string>(" RULE:severity" ),
88
107
a
@@ -99,9 +118,15 @@ class Rule_DictElement : public VariableDictElement { \
99
118
static void logData (Transaction *t,
100
119
Rule *rule,
101
120
std::vector<const VariableValue *> *l) {
102
- if (rule && rule->m_logData ) {
121
+ Rule *r = rule;
122
+
123
+ while (r && !r->m_logData ) {
124
+ r = r->m_chainedRuleParent ;
125
+ }
126
+
127
+ if (r && r->m_logData ) {
103
128
std::unique_ptr<VariableOrigin> origin (new VariableOrigin ());
104
- std::string *a = new std::string (rule ->m_logData ->data (t));
129
+ std::string *a = new std::string (r ->m_logData ->data (t));
105
130
VariableValue *var = new VariableValue (
106
131
std::make_shared<std::string>(" RULE:logdata" ),
107
132
a
@@ -117,9 +142,15 @@ class Rule_DictElement : public VariableDictElement { \
117
142
static void msg (Transaction *t,
118
143
Rule *rule,
119
144
std::vector<const VariableValue *> *l) {
120
- if (rule && rule->m_msg ) {
145
+ Rule *r = rule;
146
+
147
+ while (r && !r->m_msg ) {
148
+ r = r->m_chainedRuleParent ;
149
+ }
150
+
151
+ if (r && r->m_msg ) {
121
152
std::unique_ptr<VariableOrigin> origin (new VariableOrigin ());
122
- std::string *a = new std::string (rule ->m_msg ->data (t));
153
+ std::string *a = new std::string (r ->m_msg ->data (t));
123
154
VariableValue *var = new VariableValue (
124
155
std::make_shared<std::string>(" RULE:msg" ),
125
156
a
0 commit comments