summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--plugins/omruleset/omruleset.c21
2 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 00af71d9..5f647de1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------
+Version 5.3.8 [BETA] (rgerhards), 2010-02-??
+- bugfix: omruleset failed to work in many cases
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=179
+ Thanks to Ryan B. Lynch for reporting this issue.
+---------------------------------------------------------------------------
Version 5.3.7 [BETA] (rgerhards), 2010-01-27
- bugfix: queues in direct mode could case a segfault, especially if an
action failed for action queues. The issue was an invalid increment of
diff --git a/plugins/omruleset/omruleset.c b/plugins/omruleset/omruleset.c
index eebe1708..0e0fc13b 100644
--- a/plugins/omruleset/omruleset.c
+++ b/plugins/omruleset/omruleset.c
@@ -41,7 +41,6 @@
#include <unistd.h>
#include "conf.h"
#include "syslogd-types.h"
-//#include "srUtils.h"
#include "template.h"
#include "module-template.h"
#include "errmsg.h"
@@ -61,10 +60,12 @@ DEF_OMOD_STATIC_DATA
/* config variables */
ruleset_t *pRuleset = NULL; /* ruleset to enqueue message to (NULL = Default, not recommended) */
+uchar *pszRulesetName = NULL;
typedef struct _instanceData {
ruleset_t *pRuleset; /* ruleset to enqueue to */
+ uchar *pszRulesetName; /* primarily for debugging/display purposes */
} instanceData;
@@ -80,11 +81,13 @@ ENDisCompatibleWithFeature
BEGINfreeInstance
CODESTARTfreeInstance
+ free(pData->pszRulesetName);
ENDfreeInstance
BEGINdbgPrintInstInfo
CODESTARTdbgPrintInstInfo
+ dbgprintf("omruleset target %s[%p]\n", (char*) pData->pszRulesetName, pData->pRuleset);
ENDdbgPrintInstInfo
@@ -99,11 +102,13 @@ ENDtryResume
BEGINdoAction
msg_t *pMsg;
CODESTARTdoAction
- pMsg = (msg_t*) ppString[0];
- DBGPRINTF(":omruleset: forwarding message %p to ruleset %p\n", pMsg, pData->pRuleset);
+ CHKmalloc(pMsg = MsgDup((msg_t*) ppString[0]));
+ DBGPRINTF(":omruleset: forwarding message %p to ruleset %s[%p]\n", pMsg,
+ (char*) pData->pszRulesetName, pData->pRuleset);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
MsgSetRuleset(pMsg, pData->pRuleset);
- submitMsg(MsgAddRef(pMsg));
+ submitMsg(pMsg);
+finalize_it:
ENDdoAction
/* set the ruleset name */
@@ -118,9 +123,12 @@ setRuleset(void __attribute__((unused)) *pVal, uchar *pszName)
errmsg.LogError(0, RS_RET_RULESET_NOT_FOUND, "error: ruleset '%s' not found - ignored", pszName);
}
CHKiRet(localRet);
+ pszRulesetName = pszName; /* save for later display purposes */
finalize_it:
- free(pszName); /* no longer needed */
+ if(iRet != RS_RET_OK) { /* cleanup needed? */
+ free(pszName);
+ }
RETiRet;
}
@@ -153,13 +161,16 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
*/
CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, iTplOpts, (uchar*) "RSYSLOG_FileFormat"));
pData->pRuleset = pRuleset;
+ pData->pszRulesetName = pszRulesetName;
pRuleset = NULL; /* re-set, because there is a high risk of unwanted behavior if we leave it in! */
+ pszRulesetName = NULL; /* note: we must not free, as we handed over this pointer to the instanceDat to the instanceDataa! */
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
BEGINmodExit
CODESTARTmodExit
+ free(pszRulesetName);
objRelease(errmsg, CORE_COMPONENT);
objRelease(ruleset, CORE_COMPONENT);
ENDmodExit