summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/conf.c6
-rw-r--r--runtime/rule.c22
-rw-r--r--runtime/rule.h3
3 files changed, 28 insertions, 3 deletions
diff --git a/runtime/conf.c b/runtime/conf.c
index e0ed3d6a..014d5a9a 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -471,7 +471,7 @@ processConfFile(uchar *pConfFile)
/* we probably have one selector left to be added - so let's do that now */
if(pCurrRule != NULL) {
- CHKiRet(ruleset.AddRule(pCurrRuleset, &pCurrRule));
+ CHKiRet(ruleset.AddRule(rule.GetAssRuleset(pCurrRule), &pCurrRule));
}
/* close the configuration file */
@@ -1141,9 +1141,10 @@ cflineClassic(uchar *p, rule_t **ppRule)
* all. -- rgerhards, 2007-08-01
*/
if(*ppRule != NULL) {
- CHKiRet(ruleset.AddRule(pCurrRuleset, ppRule));
+ CHKiRet(ruleset.AddRule(rule.GetAssRuleset(*ppRule), ppRule));
}
CHKiRet(rule.Construct(ppRule)); /* create "fresh" selector */
+ CHKiRet(rule.SetAssRuleset(*ppRule, pCurrRuleset)); /* create "fresh" selector */
CHKiRet(rule.ConstructFinalize(*ppRule)); /* create "fresh" selector */
CHKiRet(cflineDoFilter(&p, *ppRule)); /* pull filters */
}
@@ -1166,7 +1167,6 @@ cfline(uchar *line, rule_t **pfCurr)
DEFiRet;
ASSERT(line != NULL);
-if(*pfCurr != NULL){ ISOBJ_TYPE_assert(*pfCurr, rule);}
dbgprintf("cfline: '%s'\n", line);
diff --git a/runtime/rule.c b/runtime/rule.c
index c157242c..f17c524e 100644
--- a/runtime/rule.c
+++ b/runtime/rule.c
@@ -320,6 +320,26 @@ CODESTARTobjDestruct(rule)
ENDobjDestruct(rule)
+/* set the associated ruleset */
+static rsRetVal
+setAssRuleset(rule_t *pThis, ruleset_t *pRuleset)
+{
+ DEFiRet;
+ ISOBJ_TYPE_assert(pThis, rule);
+ ISOBJ_TYPE_assert(pRuleset, ruleset);
+ pThis->pRuleset = pRuleset;
+ RETiRet;
+}
+
+/* get the associated ruleset (may be NULL if not set!) */
+static ruleset_t*
+getAssRuleset(rule_t *pThis)
+{
+ ISOBJ_TYPE_assert(pThis, rule);
+ return pThis->pRuleset;
+}
+
+
/* helper to DebugPrint, to print out all actions via
* the llExecFunc() facility.
*/
@@ -393,6 +413,8 @@ CODESTARTobjQueryInterface(rule)
pIf->IterateAllActions = iterateAllActions;
pIf->ProcessMsg = processMsg;
+ pIf->SetAssRuleset = setAssRuleset;
+ pIf->GetAssRuleset = getAssRuleset;
finalize_it:
ENDobjQueryInterface(rule)
diff --git a/runtime/rule.h b/runtime/rule.h
index 96be9e30..38b11c63 100644
--- a/runtime/rule.h
+++ b/runtime/rule.h
@@ -53,6 +53,7 @@ struct rule_s {
expr_t *f_expr; /* expression object */
} f_filterData;
+ ruleset_t *pRuleset; /* associated ruleset */
linkedList_t llActList; /* list of configured actions */
};
@@ -64,6 +65,8 @@ BEGINinterface(rule) /* name must also be changed in ENDinterface macro! */
rsRetVal (*Destruct)(rule_t **ppThis);
rsRetVal (*IterateAllActions)(rule_t *pThis, rsRetVal (*pFunc)(void*, void*), void *pParam);
rsRetVal (*ProcessMsg)(rule_t *pThis, msg_t *pMsg);
+ rsRetVal (*SetAssRuleset)(rule_t *pThis, ruleset_t*);
+ ruleset_t* (*GetAssRuleset)(rule_t *pThis);
ENDinterface(rule)
#define ruleCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */