From b7e69a240037277e77685af5ea5623cdd89ec2d2 Mon Sep 17 00:00:00 2001 From: Andrew Stothard Date: Thu, 15 Sep 2011 15:17:09 +0200 Subject: typo fix --- tools/omfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/omfile.c') diff --git a/tools/omfile.c b/tools/omfile.c index a4f010c6..02418c46 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -749,7 +749,7 @@ CODESTARTparseSelectorAct if(pData->pStrm == NULL) { DBGPRINTF("Error opening log file: %s\n", pData->f_fname); - errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output file '%s'", pData->f_fname); + errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could not open output file '%s'", pData->f_fname); } } CODE_STD_FINALIZERparseSelectorAct -- cgit From 086db18cc304c9aff082e8ee4adfdadeacfa5c39 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 20 Sep 2011 15:16:53 +0200 Subject: bugfix: potential abort if ultra-large file io buffers are used and dynafile cache exhausts address space (primarily a problem on 32 bit platforms) --- tools/omfile.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tools/omfile.c') diff --git a/tools/omfile.c b/tools/omfile.c index 88e8115e..f7339300 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -355,6 +355,7 @@ prepareFile(instanceData *pData, uchar *newFileName) int fd; DEFiRet; + pData->pStrm = NULL; if(access((char*)newFileName, F_OK) == 0) { if(pData->bForceChown) { /* Try to fix wrong ownership set by someone else. Note that this code @@ -440,6 +441,11 @@ prepareFile(instanceData *pData, uchar *newFileName) CHKiRet(strm.ConstructFinalize(pData->pStrm)); finalize_it: + if(iRet != RS_RET_OK) { + if(pData->pStrm != NULL) { + strm.Destruct(&pData->pStrm); + } + } RETiRet; } @@ -516,7 +522,7 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts) pData->iCurrElt = -1; /* similarly, we need to set the current pStrm to NULL, because otherwise, if prepareFile() fails, * we may end up using an old stream. This bug depends on how exactly prepareFile fails, - * but it* could be triggered in the common case of a failed open() system call. + * but it could be triggered in the common case of a failed open() system call. * rgerhards, 2010-03-22 */ pData->pStrm = NULL; @@ -545,8 +551,8 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts) /* Ok, we finally can open the file */ localRet = prepareFile(pData, newFileName); /* ignore exact error, we check fd below */ - /* file is either open now or an error state set */ // RG: better check localRet? - if(pData->pStrm == NULL) { + /* check if we had an error */ + if(localRet != RS_RET_OK) { /* do not report anything if the message is an internally-generated * message. Otherwise, we could run into a never-ending loop. The bad * news is that we also lose errors on startup messages, but so it is. @@ -554,7 +560,7 @@ prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsgOpts) if(iMsgOpts & INTERNAL_MSG) { DBGPRINTF("Could not open dynaFile, discarding message\n"); } else { - errmsg.LogError(0, NO_ERRCODE, "Could not open dynamic file '%s' - discarding message", newFileName); + errmsg.LogError(0, NO_ERRCODE, "Could not open dynamic file '%s' [state %d] - discarding message", newFileName, localRet); } ABORT_FINALIZE(localRet); } -- cgit From b26387e6b28630b8e5e3582039141ebf1c7455e3 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 26 Sep 2011 11:36:44 +0200 Subject: bugfix: omfile returns fatal error code for things that go really wrong previously, RS_RET_RESUME was returned, which lead to a loop inside the rule engine as omfile could not really recover. --- tools/omfile.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tools/omfile.c') diff --git a/tools/omfile.c b/tools/omfile.c index 6a2d5e24..55801d40 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -663,8 +663,6 @@ finalize_it: /* in v5, we shall return different states for message-caused failure (but only there!) */ if(pData->strmType == STREAMTYPE_NAMED_PIPE) iRet = RS_RET_DISABLE_ACTION; /* this is the traditional semantic -- rgerhards, 2010-01-15 */ - else - iRet = RS_RET_SUSPENDED; } RETiRet; } @@ -697,7 +695,8 @@ ENDbeginTransaction BEGINendTransaction CODESTARTendTransaction - if(pData->bFlushOnTXEnd) { + /* Note: pStrm may be NULL if there was an error opening the stream */ + if(pData->bFlushOnTXEnd && pData->pStrm != NULL) { CHKiRet(strm.Flush(pData->pStrm)); } finalize_it: -- cgit