From d3173826268b18d38d67525d8d38083176742c8c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 28 Aug 2012 15:09:56 +0200 Subject: 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. --- runtime/rsconf.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'runtime/rsconf.c') 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 -- cgit v1.2.3