diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-28 15:09:56 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-28 15:09:56 +0200 |
commit | d3173826268b18d38d67525d8d38083176742c8c (patch) | |
tree | 390efcefe119f6ea8d7ee8b0640990eca90d8004 /runtime/rsconf.c | |
parent | 9a9282b86c785d7c0b67a0b546748e3591a487a2 (diff) | |
download | rsyslog-d3173826268b18d38d67525d8d38083176742c8c.tar.gz rsyslog-d3173826268b18d38d67525d8d38083176742c8c.tar.xz rsyslog-d3173826268b18d38d67525d8d38083176742c8c.zip |
bugfix: omusrsmsg incorrect return state & config warning handling
During config file processing, Omusrmsg often incorrectly returned a
warning status, even when no warning was present (caused by
uninitialized variable). Also, the core handled warning messages
incorrectly, and treated them as errors. As a result, omusrmsg
(most often) could not properly be loaded. Note that this only
occurs with legacy config action syntax. This was a regression
caused by an incorrect merge in to the 6.3.x codebase.
Thanks to Stefano Mason for alerting us of this bug.
Diffstat (limited to 'runtime/rsconf.c')
-rw-r--r-- | runtime/rsconf.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/runtime/rsconf.c b/runtime/rsconf.c index 16929b71..b83ba063 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -223,6 +223,7 @@ cnfDoActlst(struct cnfactlst *actlst, rule_t *pRule) struct cnfcfsyslinelst *cflst; action_t *pAction; uchar *str; + rsRetVal localRet; DEFiRet; while(actlst != NULL) { @@ -236,9 +237,22 @@ cnfDoActlst(struct cnfactlst *actlst, rule_t *pRule) "around line %d", actlst->cnfFile, actlst->lineno); } } else { - dbgprintf("legacy action line:%s\n", actlst->data.legActLine); + DBGPRINTF("legacy action line:%s\n", actlst->data.legActLine); str = (uchar*) actlst->data.legActLine; - CHKiRet(cflineDoAction(loadConf, &str, &pAction)); + if((localRet = cflineDoAction(loadConf, &str, &pAction)) != RS_RET_OK) { + uchar szErrLoc[MAXFNAME + 64]; + if(localRet != RS_RET_OK_WARN) { + DBGPRINTF("legacy action line NOT successfully processed\n"); + } + snprintf((char*)szErrLoc, sizeof(szErrLoc) / sizeof(uchar), + "%s, line %d", actlst->cnfFile, actlst->lineno); + errmsg.LogError(0, NO_ERRCODE, "the last %s occured in %s:\"%s\"", + (localRet == RS_RET_OK_WARN) ? "warning" : "error", + (char*)szErrLoc, (char*)actlst->data.legActLine); + if(localRet != RS_RET_OK_WARN) { + ABORT_FINALIZE(localRet); + } + } iRet = llAppend(&(pRule)->llActList, NULL, (void*) pAction); } for( cflst = actlst->syslines |