From cac0a1efdc9ce79b4503431d07075b932a6dcdb2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2012 14:05:03 +0100 Subject: bugfix: on termination, actions were incorrectly called The problem was that incomplete fiter evaluation was done *during the shutdown phase*. This affected only the LAST batches being processed. No problem existed during the regular run. Could usually only happen on very busy systems, which were still busy during shutdown. --- ChangeLog | 5 +++++ runtime/ruleset.c | 25 ++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4f53ce2..9bf2102f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ Version 7.2.5 [v7-stable] 2013-01-?? due to missing libmath. Thanks to Michael Biebl for the fix - bugfix: invalid DST handling under Solaris Thanks to Scott Severtson for the patch. +- bugfix: on termination, actions were incorrectly called + The problem was that incomplete fiter evaluation was done *during the + shutdown phase*. This affected only the LAST batches being processed. No + problem existed during the regular run. Could usually only happen on + very busy systems, which were still busy during shutdown. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/runtime/ruleset.c b/runtime/ruleset.c index 3459f545..b74f8ec8 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -299,7 +299,9 @@ execIf(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) sbool bRet; DEFiRet; newAct = newActive(pBatch); - for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { + for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) { + if(*(pBatch->pbShutdownImmediate)) + FINALIZE; if(pBatch->pElem[i].state == BATCH_STATE_DISC) continue; /* will be ignored in any case */ if(active == NULL || active[i]) { @@ -315,13 +317,16 @@ execIf(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) scriptExec(stmt->d.s_if.t_then, pBatch, newAct); } if(stmt->d.s_if.t_else != NULL) { - for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) - ; ++i) + for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) { + if(*(pBatch->pbShutdownImmediate)) + FINALIZE; if(pBatch->pElem[i].state != BATCH_STATE_DISC) newAct[i] = !newAct[i]; + } scriptExec(stmt->d.s_if.t_else, pBatch, newAct); } freeActive(newAct); +finalize_it: RETiRet; } @@ -334,7 +339,9 @@ execPRIFILT(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) int bRet; int i; newAct = newActive(pBatch); - for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { + for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) { + if(*(pBatch->pbShutdownImmediate)) + return; if(pBatch->pElem[i].state == BATCH_STATE_DISC) continue; /* will be ignored in any case */ pMsg = (msg_t*)(pBatch->pElem[i].pUsrp); @@ -355,10 +362,12 @@ execPRIFILT(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) scriptExec(stmt->d.s_prifilt.t_then, pBatch, newAct); } if(stmt->d.s_prifilt.t_else != NULL) { - for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) - ; ++i) + for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) { + if(*(pBatch->pbShutdownImmediate)) + return; if(pBatch->pElem[i].state != BATCH_STATE_DISC) newAct[i] = !newAct[i]; + } scriptExec(stmt->d.s_prifilt.t_else, pBatch, newAct); } freeActive(newAct); @@ -461,7 +470,9 @@ execPROPFILT(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) sbool bRet; int i; thenAct = newActive(pBatch); - for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { + for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) { + if(*(pBatch->pbShutdownImmediate)) + return; if(pBatch->pElem[i].state == BATCH_STATE_DISC) continue; /* will be ignored in any case */ if(active == NULL || active[i]) { -- cgit v1.2.3 From 5cd9b52ea5a75c4dff3d92683ff51d4e02cb1fd5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 7 Jan 2013 15:27:27 +0100 Subject: bugfix: very large memory consumption (and probably out of memory) ...when FromPos was specified in template, but ToPos not. Thanks to Radu Gheorghe for alerting us of this bug. --- ChangeLog | 3 +++ runtime/msg.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9bf2102f..0d088727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ Version 7.2.5 [v7-stable] 2013-01-?? shutdown phase*. This affected only the LAST batches being processed. No problem existed during the regular run. Could usually only happen on very busy systems, which were still busy during shutdown. +- bugfix: very large memory consumption (and probably out of memory) when + FromPos was specified in template, but ToPos not. + Thanks to Radu Gheorghe for alerting us of this bug. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/runtime/msg.c b/runtime/msg.c index 09f6d649..10605ba4 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3027,6 +3027,8 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, */ ; /*DO NOTHING*/ } else { + if(iTo > bufLen) /* iTo is very large, if no to-position is set in the template! */ + iTo = bufLen; iLen = iTo - iFrom + 1; /* the +1 is for an actual char, NOT \0! */ pBufStart = pBuf = MALLOC((iLen + 1) * sizeof(char)); if(pBuf == NULL) { -- cgit v1.2.3 From 5c9fd7c96fe5f2d363fe0f7d60922cb97632b884 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 8 Jan 2013 09:30:56 +0100 Subject: bugfix: timeval2syslogTime cause problems on some platforms ...due to invalid assumption on structure data types. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=394 --- ChangeLog | 4 ++++ runtime/datetime.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0d088727..67a458ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ Version 7.2.5 [v7-stable] 2013-01-?? - bugfix: very large memory consumption (and probably out of memory) when FromPos was specified in template, but ToPos not. Thanks to Radu Gheorghe for alerting us of this bug. +- bugfix: timeval2syslogTime cause problems on some platforms + due to invalid assumption on structure data types. + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=394 + Thanks to David Hill for the patch. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/runtime/datetime.c b/runtime/datetime.c index c03abab9..7d974471 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -61,8 +61,10 @@ timeval2syslogTime(struct timeval *tp, struct syslogTime *t) struct tm *tm; struct tm tmBuf; long lBias; + time_t secs; - tm = localtime_r((time_t*) &(tp->tv_sec), &tmBuf); + secs = tp->tv_sec; + tm = localtime_r(&secs, &tmBuf); t->year = tm->tm_year + 1900; t->month = tm->tm_mon + 1; -- cgit v1.2.3 From 9955c1f5795b2397e3cf75c5bf89f5e1e28ba001 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Jan 2013 09:36:03 +0100 Subject: amend last commit with license info (ASL 2.0 as of email conversation with David) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 67a458ae..f1e2ab73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,8 @@ Version 7.2.5 [v7-stable] 2013-01-?? - bugfix: timeval2syslogTime cause problems on some platforms due to invalid assumption on structure data types. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=394 - Thanks to David Hill for the patch. + Thanks to David Hill for the patch [under ASL2.0 as per email conversation + 2013-01-03]. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages -- cgit v1.2.3 From 9fb9fa03a2cfeab700f8c3c893f08d1a60d3f75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20K=C3=B6rper?= Date: Tue, 8 Jan 2013 11:51:53 +0100 Subject: bugfix: compile errors in im3195 --- ChangeLog | 2 ++ plugins/im3195/im3195.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f1e2ab73..744110df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ Version 7.2.5 [v7-stable] 2013-01-?? closes: http://bugzilla.adiscon.com/show_bug.cgi?id=394 Thanks to David Hill for the patch [under ASL2.0 as per email conversation 2013-01-03]. +- bugfix: compile errors in im3195 + Thanks to Martin Körper for the patch ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c index c75e0e34..4b04b124 100644 --- a/plugins/im3195/im3195.c +++ b/plugins/im3195/im3195.c @@ -48,6 +48,7 @@ #include "cfsysline.h" #include "msg.h" #include "errmsg.h" +#include "unicode-helper.h" MODULE_TYPE_INPUT MODULE_TYPE_NOKEEP @@ -56,6 +57,7 @@ MODULE_CNFNAME("im3195") /* Module static data */ DEF_IMOD_STATIC_DATA DEFobjCurrIf(errmsg) +DEFobjCurrIf(prop) /* configuration settings */ @@ -71,6 +73,8 @@ static int listenPort = 601; */ static srAPIObj* pAPI; +static prop_t *pInputName = NULL; /* there is only one global inputName for all messages generated by this module */ + /* This method is called when a message has been fully received. * It passes the received message to the rsyslog main message @@ -90,7 +94,7 @@ void OnReceive(srAPIObj __attribute__((unused)) *pMyAPI, srSLMGObj* pSLMG) srSLMGGetRawMSG(pSLMG, &pszRawMsg); parseAndSubmitMessage(fromHost, fromHostIP, pszRawMsg, strlen((char*)pszRawMsg), - PARSE_HOSTNAME, eFLOWCTL_FULL_DELAY, (uchar*)"im3195", NULL, 0, NULL); + PARSE_HOSTNAME, eFLOWCTL_FULL_DELAY, pInputName, NULL, 0, NULL); } @@ -171,6 +175,9 @@ ENDafterRun BEGINmodExit CODESTARTmodExit srAPIExitLib(pAPI); /* terminate liblogging */ + /* global variable cleanup */ + if(pInputName != NULL) + prop.Destruct(&pInputName); /* release objects we used */ objRelease(errmsg, CORE_COMPONENT); ENDmodExit @@ -193,9 +200,15 @@ CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); + CHKiRet(objUse(prop, CORE_COMPONENT)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"input3195listenport", 0, eCmdHdlrInt, NULL, &listenPort, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); + + CHKiRet(prop.Construct(&pInputName)); + CHKiRet(prop.SetString(pInputName, UCHAR_CONSTANT("im3195"), sizeof("im3195") - 1)); + CHKiRet(prop.ConstructFinalize(pInputName)); + ENDmodInit /* vim:set ai: */ -- cgit v1.2.3 From 3b0f635bd579c4cc00e189871e77ef120a6c6a4d Mon Sep 17 00:00:00 2001 From: Chandler Latour Date: Tue, 8 Jan 2013 12:01:10 +0100 Subject: bugfix: doGetFileCreateMode() had invalid validity check ;) --- ChangeLog | 2 ++ grammar/rainerscript.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 744110df..792a8d53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ Version 7.2.5 [v7-stable] 2013-01-?? 2013-01-03]. - bugfix: compile errors in im3195 Thanks to Martin Körper for the patch +- bugfix: doGetFileCreateMode() had invalid validity check ;) + Thanks to Chandler Latour for the patch. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index c5f2148e..0584d6a9 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -463,17 +463,17 @@ doGetFileCreateMode(struct nvlst *valnode, struct cnfparamdescr *param, if(es_strlen(valnode->val.d.estr) == 4) { c = es_getBufAddr(valnode->val.d.estr); - if(!( (c[0] == '0') - && (c[1] >= '0' && c[1] <= '7') - && (c[2] >= '0' && c[2] <= '7') - && (c[3] >= '0' && c[3] <= '7') ) ) { + if( (c[0] == '0') + && (c[1] >= '0' && c[1] <= '7') + && (c[2] >= '0' && c[2] <= '7') + && (c[3] >= '0' && c[3] <= '7') ) { fmtOK = 1; } } if(fmtOK) { val->val.datatype = 'N'; - val->val.d.n = (c[1]-'0') * 64 + (c[2]-'0') * 8 + (c[3]-'0');; + val->val.d.n = (c[1]-'0') * 64 + (c[2]-'0') * 8 + (c[3]-'0'); } else { cstr = es_str2cstr(valnode->val.d.estr, NULL); parser_errmsg("file modes need to be specified as " -- cgit v1.2.3 From bbb2066d17824f366d0f83a010cae6ebe99d4fa0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Jan 2013 12:49:02 +0100 Subject: bugfix: mmjsonparse errornously returned action error when no CEE cookie was present. --- ChangeLog | 2 ++ plugins/mmjsonparse/mmjsonparse.c | 1 + 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 792a8d53..12db54e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ Version 7.2.5 [v7-stable] 2013-01-?? Thanks to Martin Körper for the patch - bugfix: doGetFileCreateMode() had invalid validity check ;) Thanks to Chandler Latour for the patch. +- bugfix: mmjsonparse errornously returned action error when no CEE cookie + was present. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/plugins/mmjsonparse/mmjsonparse.c b/plugins/mmjsonparse/mmjsonparse.c index 40cfa919..a13962ab 100644 --- a/plugins/mmjsonparse/mmjsonparse.c +++ b/plugins/mmjsonparse/mmjsonparse.c @@ -172,6 +172,7 @@ finalize_it: jval = json_object_new_string((char*)buf); json_object_object_add(json, "msg", jval); msgAddJSON(pMsg, (uchar*)"!", json); + iRet = RS_RET_OK; } MsgSetParseSuccess(pMsg, bSuccess); ENDdoAction -- cgit v1.2.3