diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-10-13 08:18:08 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-10-13 08:18:08 +0200 |
commit | b0d33ab78056f06dee06694990a71fc7895ddbb5 (patch) | |
tree | ea4d633e8452b2f56df419d9e6bf5ec4da95e0b0 | |
parent | 76b4c6547d5526a375ee217e2722a164c811c58c (diff) | |
parent | d6a6666b66733e63255f806dd272a0b85e0f0c13 (diff) | |
download | rsyslog-b0d33ab78056f06dee06694990a71fc7895ddbb5.tar.gz rsyslog-b0d33ab78056f06dee06694990a71fc7895ddbb5.tar.xz rsyslog-b0d33ab78056f06dee06694990a71fc7895ddbb5.zip |
Merge branch 'v5-stable' into beta
Conflicts:
ChangeLog
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | plugins/imfile/imfile.c | 4 | ||||
-rw-r--r-- | runtime/msg.c | 52 | ||||
-rw-r--r-- | runtime/stream.c | 10 | ||||
-rw-r--r-- | tests/tcpflood.c | 5 |
5 files changed, 69 insertions, 16 deletions
@@ -1,5 +1,9 @@ --------------------------------------------------------------------------- Version 6.2.0 [v6-stable], 2011-0?-?? +- 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 @@ -233,13 +237,21 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-03-?? affected directive was: $ActionExecOnlyWhenPreviousIsSuspended on closes: http://bugzilla.adiscon.com/show_bug.cgi?id=236 --------------------------------------------------------------------------- -Version 5.8.6 [V5-stable] (rgerhards/al), 2011-??-?? +Version 5.8.6 [V5-stable] 2011-??-?? +- 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 - 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 37d3136c..834afd6d 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/msg.c b/runtime/msg.c index 63b4c7bc..e7cf825f 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1617,9 +1617,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; } @@ -1846,7 +1856,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; } @@ -1885,8 +1903,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; } @@ -1932,9 +1960,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 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; } 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 { |