From cf1aaf14fa2bcb457a306d42723ed91a76df00f1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 6 Oct 2011 11:42:47 +0200 Subject: fixed compiler warnings in tcpflood.c --- tests/tcpflood.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tcpflood.c b/tests/tcpflood.c index 49b1e9e6..8485acbb 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -797,7 +797,7 @@ closeTLSSess(int i) # else /* NO TLS available */ static void initTLS(void) {} static void initTLSSess(int __attribute__((unused)) i) {} -static int sendTLS(int i, char *buf, int lenBuf) { return 0; } +static int sendTLS(int __attribute__((unused)) i, char __attribute__((unused)) *buf, int __attribute__((unused)) lenBuf) { return 0; } static void closeTLSSess(int __attribute__((unused)) i) {} # endif @@ -889,7 +889,8 @@ int main(int argc, char *argv[]) # if defined(ENABLE_GNUTLS) transport = TP_TLS; # else - fprintf(stderr, "compiled without TLS support!\n", optarg); + fprintf(stderr, "compiled without TLS support: " + "\"-Ttls\" not supported!\n"); exit(1); # endif } else { -- cgit v1.2.3 From cd5253fa82fdbd7529f76c9cec2130e1ccb210bb Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 7 Oct 2011 11:42:49 +0200 Subject: bugfix: imfile did invalid system call under some circumstances when a file that was to be monitored did not exist BUT the state file actually existed. Mostly a cosmetic issue. Root cause was incomplete error checking in stream.c; so patch may affect other code areas. --- ChangeLog | 4 ++++ plugins/imfile/imfile.c | 4 ++-- runtime/stream.c | 10 ++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11a75c26..b89429f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ Version 5.8.6 [V5-stable] (rgerhards/al), 2011-??-?? - 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. +- bugfix: imfile did invalid system call under some circumstances + when a file that was to be monitored did not exist BUT the state file + actually existed. Mostly a cosmetic issue. Root cause was incomplete + error checking in stream.c; so patch may affect other code areas. - bugfix: rsyslogd -v always said 64 atomics were not present thanks to mono_matsuko for the patch --------------------------------------------------------------------------- diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index cac3a55d..40a41a98 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -147,10 +147,10 @@ openFile(fileInfo_t *pThis) /* check if the file exists */ if(stat((char*) pszSFNam, &stat_buf) == -1) { if(errno == ENOENT) { - /* currently no object! dbgoprint((obj_t*) pThis, "clean startup, no .si file found\n"); */ + dbgprintf("filemon %p: clean startup, no .si file found\n", pThis); ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND); } else { - /* currently no object! dbgoprint((obj_t*) pThis, "error %d trying to access .si file\n", errno); */ + dbgprintf("filemon %p: error %d trying to access .si file\n", pThis, errno); ABORT_FINALIZE(RS_RET_IO_ERROR); } } diff --git a/runtime/stream.c b/runtime/stream.c index ae716815..0238d25e 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -1276,16 +1276,18 @@ static rsRetVal strmSeek(strm_t *pThis, off64_t offs) ISOBJ_TYPE_assert(pThis, strm); - if(pThis->fd == -1) - strmOpenFile(pThis); - else - strmFlushInternal(pThis); + if(pThis->fd == -1) { + CHKiRet(strmOpenFile(pThis)); + } else { + CHKiRet(strmFlushInternal(pThis)); + } long long i; DBGOPRINT((obj_t*) pThis, "file %d seek, pos %llu\n", pThis->fd, (long long unsigned) offs); i = lseek64(pThis->fd, offs, SEEK_SET); // TODO: check error! pThis->iCurrOffs = offs; /* we are now at *this* offset */ pThis->iBufPtr = 0; /* buffer invalidated */ +finalize_it: RETiRet; } -- cgit v1.2.3 From 4831a51f5a7c8e3821cb98bc21fb47204e5470c2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 13 Oct 2011 08:04:40 +0200 Subject: bugfix: race condition when extracting program name and APPNAME could lead to invalid characters e.g. in dynamic file names --- ChangeLog | 4 +++- runtime/msg.c | 28 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b89429f6..67359a96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- -Version 5.8.6 [V5-stable] (rgerhards/al), 2011-??-?? +Version 5.8.6 [V5-stable] 2011-??-?? +- bugfix: race condition when extracting program name and APPNAME + could lead to invalid characters e.g. in dynamic file names - bugfix: imuxsock did no longer ignore message-provided timestamp, if so configured (the *default*). Lead to no longer sub-second timestamps. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=281 diff --git a/runtime/msg.c b/runtime/msg.c index 7cc588b7..eb1e3ae4 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1873,8 +1873,18 @@ int getProgramNameLen(msg_t *pM, sbool bLockMutex) */ uchar *getProgramName(msg_t *pM, sbool bLockMutex) { - prepareProgramName(pM, bLockMutex); - return (pM->pCSProgName == NULL) ? UCHAR_CONSTANT("") : rsCStrGetSzStrNoNULL(pM->pCSProgName); + uchar *pszRet; + + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + prepareProgramName(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSProgName == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSProgName); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return pszRet; } @@ -1920,9 +1930,19 @@ static inline void prepareAPPNAME(msg_t *pM, sbool bLockMutex) */ char *getAPPNAME(msg_t *pM, sbool bLockMutex) { + uchar *pszRet; + assert(pM != NULL); - prepareAPPNAME(pM, bLockMutex); - return (pM->pCSAPPNAME == NULL) ? "" : (char*) rsCStrGetSzStrNoNULL(pM->pCSAPPNAME); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + prepareAPPNAME(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSAPPNAME == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSAPPNAME); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return (char*)pszRet; } /* rgerhards, 2005-11-24 -- cgit v1.2.3 From d6a6666b66733e63255f806dd272a0b85e0f0c13 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 13 Oct 2011 08:15:54 +0200 Subject: bugfix: race condition when extracting structured data and PROCID same issue as previous commit for PROGNAME and APPNAME --- ChangeLog | 6 ++++-- runtime/msg.c | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67359a96..a0878d75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ --------------------------------------------------------------------------- Version 5.8.6 [V5-stable] 2011-??-?? -- bugfix: race condition when extracting program name and APPNAME - could lead to invalid characters e.g. in dynamic file names +- bugfix: race condition when extracting program name, APPNAME, structured + data and PROCID (RFC5424 fields) could lead to invalid characters e.g. + in dynamic file names or during forwarding (general malfunction of these + fields in templates, mostly under heavy load) - bugfix: imuxsock did no longer ignore message-provided timestamp, if so configured (the *default*). Lead to no longer sub-second timestamps. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=281 diff --git a/runtime/msg.c b/runtime/msg.c index eb1e3ae4..0744edd5 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1605,9 +1605,19 @@ static inline int getPROCIDLen(msg_t *pM, sbool bLockMutex) */ char *getPROCID(msg_t *pM, sbool bLockMutex) { + uchar *pszRet; + ISOBJ_TYPE_assert(pM, msg); - preparePROCID(pM, bLockMutex); - return (pM->pCSPROCID == NULL) ? "-" : (char*) cstrGetSzStrNoNULL(pM->pCSPROCID); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + preparePROCID(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSPROCID == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSPROCID); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return (char*) pszRet; } @@ -1834,7 +1844,15 @@ static int getStructuredDataLen(msg_t *pM) */ static inline char *getStructuredData(msg_t *pM) { - return (pM->pCSStrucData == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSStrucData); + uchar *pszRet; + + MsgUnlock(pM); + if(pM->pCSStrucData == NULL) + pszRet = UCHAR_CONSTANT("-"); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSStrucData); + MsgUnlock(pM); + return (char*) pszRet; } -- cgit v1.2.3 From 8dd9959735014aab70a65a9e8832cd1818ba210d Mon Sep 17 00:00:00 2001 From: Tomas Heinrich Date: Thu, 13 Oct 2011 10:43:59 +0200 Subject: bugfix: $ActionExecOnlyOnce interval did not work properly Signed-off-by: Rainer Gerhards --- ChangeLog | 2 ++ action.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 78c9217b..b28bfbee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 4.8.1 [v4-beta], 2011-09-?? +- bugfix: $ActionExecOnlyOnce interval did not work properly + Thanks to Tomas Heinrich for the patch - bugfix: potential abort if ultra-large file io buffers are used and dynafile cache exhausts address space (primarily a problem on 32 bit platforms) diff --git a/action.c b/action.c index 5451ef13..119bb3ba 100644 --- a/action.c +++ b/action.c @@ -716,7 +716,6 @@ actionWriteToAction(action_t *pAction) DBGPRINTF("action not yet ready again to be executed, onceInterval %d, tCurr %d, tNext %d\n", (int) pAction->iSecsExecOnceInterval, (int) getActNow(pAction), (int) (pAction->iSecsExecOnceInterval + pAction->tLastExec)); - pAction->tLastExec = getActNow(pAction); /* re-init time flags */ FINALIZE; } -- cgit v1.2.3 From 0de862d5a6938b73a8b11d125946740c591a5a1f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 13 Oct 2011 10:45:25 +0200 Subject: doc: mention imported bugfix in ChangeLog --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index c3e9f555..7db95f73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 5.8.6 [V5-stable] 2011-??-?? +- bugfix: $ActionExecOnlyOnce interval did not work properly + Thanks to Tomas Heinrich for the patch - bugfix: race condition when extracting program name, APPNAME, structured data and PROCID (RFC5424 fields) could lead to invalid characters e.g. in dynamic file names or during forwarding (general malfunction of these -- cgit v1.2.3 From e2836f5f430e63bd96502cca74dbc302938e5a23 Mon Sep 17 00:00:00 2001 From: Vlad Grigorescu Date: Mon, 17 Oct 2011 13:03:52 +0200 Subject: bugfix: ActionQueue could malfunction due to index error Signed-off-by: Rainer Gerhards --- ChangeLog | 2 ++ action.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b89429f6..aa0ff579 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 5.8.6 [V5-stable] (rgerhards/al), 2011-??-?? +- bugfix: ActionQueue could malfunction due to index error + Thanks to Vlad Grigorescu for the patch - bugfix: imuxsock did no longer ignore message-provided timestamp, if so configured (the *default*). Lead to no longer sub-second timestamps. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=281 diff --git a/action.c b/action.c index 951b4724..633b2664 100644 --- a/action.c +++ b/action.c @@ -767,7 +767,7 @@ finalize_it: */ static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch) { - int iArr; + int jArr; int i, j; batch_obj_t *pElem; uchar ***ppMsgs; @@ -781,15 +781,15 @@ static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch) switch(pAction->eParamPassing) { case ACT_ARRAY_PASSING: ppMsgs = (uchar***) pElem->staticActParams; - for(i = 0 ; i < pAction->iNumTpls ; ++i) { - if(((uchar**)ppMsgs)[i] != NULL) { - iArr = 0; - while(ppMsgs[i][iArr] != NULL) { - d_free(ppMsgs[i][iArr++]); - ppMsgs[i][iArr++] = NULL; + for(j = 0 ; j < pAction->iNumTpls ; ++j) { + if(((uchar**)ppMsgs)[j] != NULL) { + jArr = 0; + while(ppMsgs[j][jArr] != NULL) { + d_free(ppMsgs[j][jArr++]); + ppMsgs[j][jArr++] = NULL; } - d_free(((uchar**)ppMsgs)[i]); - ((uchar**)ppMsgs)[i] = NULL; + d_free(((uchar**)ppMsgs)[j]); + ((uchar**)ppMsgs)[j] = NULL; } } break; -- cgit v1.2.3 From 9a0548d290fd8306251c02bc3bb14e1267cd4e8f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 17 Oct 2011 14:43:43 +0200 Subject: doc: clarified that imklog does not support Solaris --- doc/imklog.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/imklog.html b/doc/imklog.html index 5bfab5ce..f273753f 100644 --- a/doc/imklog.html +++ b/doc/imklog.html @@ -65,6 +65,8 @@ Linux only, ignored on other platforms (but may be specified)
imsolaris.

Sample:

The following sample pulls messages from the kernel log. All parameters are left by default, which is usually a good idea. Please -- cgit v1.2.3