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