summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--grammar/rainerscript.c1
-rw-r--r--runtime/rsconf.c2
-rw-r--r--runtime/ruleset.c6
-rw-r--r--runtime/ruleset.h7
5 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 56f688eb..bab7e59e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------
+Version 7.1.8 [devel] 2012-10-??
+- bugfix: ruleset(){} directive errornously changed default ruleset
+ much like the $ruleset legacy conf statement. This potentially lead
+ to statements being assigned to the wrong ruleset.
+---------------------------------------------------------------------------
Version 7.1.7 [devel] 2012-10-01
- implemented RainerScript "call" statement
- implemented RainerScript array-based string comparison operations
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 2e5381f4..a72b4155 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -2129,6 +2129,7 @@ struct cnfstmt *
cnfstmtNewCall(es_str_t *name)
{
struct cnfstmt* cnfstmt;
+dbgprintf("DDDD: got CALL\n");
if((cnfstmt = cnfstmtNew(S_CALL)) != NULL) {
cnfstmt->d.s_call.name = name;
}
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index 97680795..ad588832 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -871,6 +871,7 @@ setCurrRuleset(void __attribute__((unused)) *pVal, uchar *pszName)
CHKiRet(ruleset.Construct(&pRuleset));
CHKiRet(ruleset.SetName(pRuleset, pszName));
CHKiRet(ruleset.ConstructFinalize(ourConf, pRuleset));
+ rulesetSetCurrRulesetPtr(pRuleset);
} else {
ABORT_FINALIZE(localRet);
}
@@ -1072,6 +1073,7 @@ initLegacyConf(void)
ruleset.Construct(&pRuleset);
ruleset.SetName(pRuleset, UCHAR_CONSTANT("RSYSLOG_DefaultRuleset"));
ruleset.ConstructFinalize(loadConf, pRuleset);
+ rulesetSetCurrRulesetPtr(pRuleset);
/* now register config handlers */
CHKiRet(regCfSysLineHdlr((uchar *)"sleep", 0, eCmdHdlrGoneAway,
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index 230b376b..8a93b022 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -657,8 +657,7 @@ finalize_it:
}
-/* Set a new current rule set. If the ruleset can not be found, no change happens.
- */
+/* Set a new current rule set. If the ruleset can not be found, no change happens */
static rsRetVal
SetCurrRuleset(rsconf_t *conf, uchar *pszName)
{
@@ -700,9 +699,6 @@ rulesetConstructFinalize(rsconf_t *conf, ruleset_t *pThis)
CHKmalloc(keyName = ustrdup(pThis->pszName));
CHKiRet(llAppend(&(conf->rulesets.llRulesets), keyName, pThis));
- /* this now also is the new current ruleset */
- conf->rulesets.pCurr = pThis;
-
/* and also the default, if so far none has been set */
if(conf->rulesets.pDflt == NULL)
conf->rulesets.pDflt = pThis;
diff --git a/runtime/ruleset.h b/runtime/ruleset.h
index 93a2f06e..cbf8243b 100644
--- a/runtime/ruleset.h
+++ b/runtime/ruleset.h
@@ -25,6 +25,7 @@
#include "queue.h"
#include "linkedlist.h"
+#include "rsconf.h"
/* the ruleset object */
struct ruleset_s {
@@ -96,4 +97,10 @@ rulesetGetName(ruleset_t *pRuleset)
rsRetVal rulesetGetRuleset(rsconf_t *conf, ruleset_t **ppRuleset, uchar *pszName);
rsRetVal rulesetOptimizeAll(rsconf_t *conf);
rsRetVal rulesetProcessCnf(struct cnfobj *o);
+
+/* Set a current rule set to already-known pointer */
+static inline void
+rulesetSetCurrRulesetPtr(ruleset_t *pRuleset) {
+ loadConf->rulesets.pCurr = pRuleset;
+}
#endif /* #ifndef INCLUDED_RULESET_H */