From d92ad440da788fea9f17bfa4b0185f12644bf714 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 22 Aug 2012 14:30:12 +0200 Subject: bugfix: multiple main queues with same queue file name were not detected This lead to queue file corruption. While the root cause is a config error, it is a bug that this important and hard to find config error was not detected by rsyslog. --- ChangeLog | 4 ++++ runtime/ruleset.c | 6 ++++-- tools/syslogd.c | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2efbaa8a..32409fd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ Version 5.8.13 [V5-stable] 2012-06-?? Thanks to bodik and Rohit Prasad for alerting us on this bug and analyzing it. fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=347 +- bugfix: multiple main queues with same queue file name was not detected + This lead to queue file corruption. While the root cause is a config + error, it is a bug that this important and hard to find config error + was not detected by rsyslog. --------------------------------------------------------------------------- Version 5.8.12 [V5-stable] 2012-06-06 - add small delay (50ms) after sending shutdown message diff --git a/runtime/ruleset.c b/runtime/ruleset.c index 8e241c8a..d608f3ad 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -500,6 +500,7 @@ debugPrintAll(void) static rsRetVal rulesetCreateQueue(void __attribute__((unused)) *pVal, int *pNewVal) { + uchar *rsname; DEFiRet; if(pCurrRuleset == NULL) { @@ -517,8 +518,9 @@ rulesetCreateQueue(void __attribute__((unused)) *pVal, int *pNewVal) if(pNewVal == 0) FINALIZE; /* if it is turned off, we do not need to change anything ;) */ - dbgprintf("adding a ruleset-specific \"main\" queue"); - CHKiRet(createMainQueue(&pCurrRuleset->pQueue, UCHAR_CONSTANT("ruleset"))); + rsname = (pCurrRuleset->pszName == NULL) ? (uchar*) "[NONAME]" : pCurrRuleset->pszName; + DBGPRINTF("adding a ruleset-specific \"main\" queue for ruleset '%s'\n", rsname); + CHKiRet(createMainQueue(&pCurrRuleset->pQueue, rsname)); finalize_it: RETiRet; diff --git a/tools/syslogd.c b/tools/syslogd.c index 8fc1d1e1..d8e50327 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -231,6 +231,11 @@ typedef struct legacyOptsLL_s { } legacyOptsLL_t; legacyOptsLL_t *pLegacyOptsLL = NULL; +struct queuefilenames_s { + struct queuefilenames_s *next; + uchar *name; +} *queuefilenames = NULL; + /* global variables for config file state */ int iCompatibilityMode = 0; /* version we should be compatible with; 0 means sysklogd. It is the default, so if no -c option is given, we make ourselvs @@ -1031,6 +1036,14 @@ static void doDie(int sig) static void freeAllDynMemForTermination(void) { + struct queuefilenames_s *qfn, *qfnDel; + + for(qfn = queuefilenames ; qfn != NULL ; ) { + qfnDel = qfn; + qfn = qfn->next; + free(qfnDel->name); + free(qfnDel); + } free(pszMainMsgQFName); free(pModDir); free(pszConfDAGFile); @@ -1559,6 +1572,10 @@ startInputModules(void) */ rsRetVal createMainQueue(qqueue_t **ppQueue, uchar *pszQueueName) { + struct queuefilenames_s *qfn; + uchar *qfname = NULL; + static int qfn_renamenum = 0; + uchar qfrenamebuf[1024]; DEFiRet; /* switch the message object to threaded operation, if necessary */ @@ -1584,10 +1601,32 @@ rsRetVal createMainQueue(qqueue_t **ppQueue, uchar *pszQueueName) errmsg.LogError(0, NO_ERRCODE, "Invalid " #directive ", error %d. Ignored, running with default setting", iRet); \ } + if(pszMainMsgQFName != NULL) { + /* check if the queue file name is unique, else emit an error */ + for(qfn = queuefilenames ; qfn != NULL ; qfn = qfn->next) { + dbgprintf("check queue file name '%s' vs '%s'\n", qfn->name, pszMainMsgQFName); + if(!ustrcmp(qfn->name, pszMainMsgQFName)) { + snprintf((char*)qfrenamebuf, sizeof(qfrenamebuf), "%d-%s-%s", + ++qfn_renamenum, pszMainMsgQFName, + (pszQueueName == NULL) ? "NONAME" : (char*)pszQueueName); + qfname = ustrdup(qfrenamebuf); + errmsg.LogError(0, NO_ERRCODE, "Error: queue file name '%s' already in use " + " - using '%s' instead", pszMainMsgQFName, qfname); + break; + } + } + if(qfname == NULL) + qfname = ustrdup(pszMainMsgQFName); + qfn = malloc(sizeof(struct queuefilenames_s)); + qfn->name = qfname; + qfn->next = queuefilenames; + queuefilenames = qfn; + } + setQPROP(qqueueSetMaxFileSize, "$MainMsgQueueFileSize", iMainMsgQueMaxFileSize); setQPROP(qqueueSetsizeOnDiskMax, "$MainMsgQueueMaxDiskSpace", iMainMsgQueMaxDiskSpace); setQPROP(qqueueSetiDeqBatchSize, "$MainMsgQueueDequeueBatchSize", iMainMsgQueDeqBatchSize); - setQPROPstr(qqueueSetFilePrefix, "$MainMsgQueueFileName", pszMainMsgQFName); + setQPROPstr(qqueueSetFilePrefix, "$MainMsgQueueFileName", qfname); setQPROP(qqueueSetiPersistUpdCnt, "$MainMsgQueueCheckpointInterval", iMainMsgQPersistUpdCnt); setQPROP(qqueueSetbSyncQueueFiles, "$MainMsgQueueSyncQueueFiles", bMainMsgQSyncQeueFiles); setQPROP(qqueueSettoQShutdown, "$MainMsgQueueTimeoutShutdown", iMainMsgQtoQShutdown ); -- cgit From 9faf2240c4a8f09f3f6c2c9bbd47e48520524e03 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 22 Aug 2012 15:29:02 +0200 Subject: changed TRUE/FALSE to RSTRUE/RSFALSE This is done to prevent name claches with libraries. --- action.c | 14 +++++++------- plugins/imsolaris/imsolaris.c | 4 ++-- plugins/imudp/imudp.c | 4 ++-- plugins/omudpspoof/omudpspoof.c | 6 +++--- runtime/modules.c | 8 ++++---- runtime/parser.c | 20 ++++++++++---------- runtime/srutils.c | 8 +++----- runtime/stream.c | 4 ++-- runtime/syslogd-types.h | 5 +++-- runtime/wti.c | 4 ++-- runtime/wtp.h | 4 ++-- tcpsrv.c | 2 +- threads.c | 2 +- tools/omfwd.c | 6 +++--- 14 files changed, 45 insertions(+), 46 deletions(-) diff --git a/action.c b/action.c index f131e53d..ae116ad9 100644 --- a/action.c +++ b/action.c @@ -20,7 +20,7 @@ * - actionWriteToAction * - qqueueEnqObj * (now queue engine processing) - * if(pThis->bWriteAllMarkMsgs == FALSE) - this is the DEFAULT + * if(pThis->bWriteAllMarkMsgs == RSFALSE) - this is the DEFAULT * - doSubmitToActionQNotAllMarkBatch * - doSubmitToActionQBatch (and from here like in the else case below!) * else @@ -137,7 +137,7 @@ static int glbliActionResumeInterval = 30; int glbliActionResumeRetryCount = 0; /* how often should suspended actions be retried? */ static int bActionRepMsgHasMsg = 0; /* last messsage repeated... has msg fragment in it */ -static int bActionWriteAllMarkMsgs = FALSE; /* should all mark messages be unconditionally written? */ +static int bActionWriteAllMarkMsgs = RSFALSE; /* should all mark messages be unconditionally written? */ static uchar *pszActionName; /* short name for the action */ /* action queue and its configuration parameters */ static queueType_t ActionQueType = QUEUETYPE_DIRECT; /* type of the main message queue above */ @@ -377,7 +377,7 @@ actionConstructFinalize(action_t *pThis) pThis->iSecsExecOnceInterval ); pThis->submitToActQ = doSubmitToActionQComplexBatch; - } else if(pThis->bWriteAllMarkMsgs == FALSE) { + } else if(pThis->bWriteAllMarkMsgs == RSFALSE) { /* nearly full-speed submission mode, default case */ pThis->submitToActQ = doSubmitToActionQNotAllMarkBatch; } else { @@ -1164,7 +1164,7 @@ prepareBatch(action_t *pAction, batch_t *pBatch) if(pElem->bFilterOK && pElem->state != BATCH_STATE_DISC) { pElem->state = BATCH_STATE_RDY; if(prepareDoActionParams(pAction, pElem) != RS_RET_OK) - pElem->bFilterOK = FALSE; + pElem->bFilterOK = RSFALSE; } } RETiRet; @@ -1456,7 +1456,7 @@ doActionCallAction(action_t *pAction, batch_t *pBatch, int idxBtch) pAction->tActNow = -1; /* we do not yet know our current time (clear prev. value) */ /* don't output marks to recently written outputs */ - if(pAction->bWriteAllMarkMsgs == FALSE + if(pAction->bWriteAllMarkMsgs == RSFALSE && (pMsg->msgFlags & MARK) && (getActNow(pAction) - pAction->f_time) < MarkInterval / 2) { ABORT_FINALIZE(RS_RET_OK); } @@ -1512,7 +1512,7 @@ finalize_it: /* This submits the message to the action queue in case where we need to handle - * bWriteAllMarkMessage == FALSE only. Note that we use a non-blocking CAS loop + * bWriteAllMarkMessage == RSFALSE only. Note that we use a non-blocking CAS loop * for the synchronization. Here, we just modify the filter condition to be false when * a mark message must not be written. However, in this case we must save the previous * filter as we may need it in the next action (potential future optimization: check if this is @@ -1769,7 +1769,7 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringReques pAction->pszName = pszActionName; pszActionName = NULL; /* free again! */ pAction->bWriteAllMarkMsgs = bActionWriteAllMarkMsgs; - bActionWriteAllMarkMsgs = FALSE; /* reset */ + bActionWriteAllMarkMsgs = RSFALSE; /* reset */ pAction->bExecWhenPrevSusp = bActExecWhenPrevSusp; pAction->iSecsExecOnceInterval = iActExecOnceInterval; pAction->iExecEveryNthOccur = iActExecEveryNthOccur; diff --git a/plugins/imsolaris/imsolaris.c b/plugins/imsolaris/imsolaris.c index ee9ec5c6..029de722 100644 --- a/plugins/imsolaris/imsolaris.c +++ b/plugins/imsolaris/imsolaris.c @@ -247,12 +247,12 @@ getMsgs(thrdInfo_t *pThrd, int timeout) CHKmalloc(pRcv = (uchar*) malloc(sizeof(uchar) * (iMaxLine + 1))); } - while(pThrd->bShallStop != TRUE) { + while(pThrd->bShallStop != RSTRUE) { DBGPRINTF("imsolaris: waiting for next message (timeout %d)...\n", timeout); if(timeout == 0) { nfds = poll(&sun_Pfd, 1, timeout); /* wait without timeout */ - if(pThrd->bShallStop == TRUE) { + if(pThrd->bShallStop == RSTRUE) { break; } diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index 46631e97..70c21bb9 100644 --- a/plugins/imudp/imudp.c +++ b/plugins/imudp/imudp.c @@ -314,7 +314,7 @@ processSocket(thrdInfo_t *pThrd, struct lstn_s *lstn, struct sockaddr_storage *f assert(pThrd != NULL); iNbrTimeUsed = 0; while(1) { /* loop is terminated if we have a bad receive, done below in the body */ - if(pThrd->bShallStop == TRUE) + if(pThrd->bShallStop == RSTRUE) ABORT_FINALIZE(RS_RET_FORCE_TERM); socklen = sizeof(struct sockaddr_storage); lenRcvBuf = recvfrom(lstn->sock, (char*) pRcvBuf, iMaxLine, 0, (struct sockaddr *)&frominet, &socklen); @@ -499,7 +499,7 @@ rsRetVal rcvMainLoop(thrdInfo_t *pThrd) nfds = epoll_wait(efd, currEvt, NUM_EPOLL_EVENTS, -1); DBGPRINTF("imudp: epoll_wait() returned with %d fds\n", nfds); - if(pThrd->bShallStop == TRUE) + if(pThrd->bShallStop == RSTRUE) break; /* terminate input! */ for(i = 0 ; i < nfds ; ++i) { diff --git a/plugins/omudpspoof/omudpspoof.c b/plugins/omudpspoof/omudpspoof.c index 30792531..c83cc540 100644 --- a/plugins/omudpspoof/omudpspoof.c +++ b/plugins/omudpspoof/omudpspoof.c @@ -208,7 +208,7 @@ UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len) inet_pton(AF_INET, (char*)pszSourcename, &(source_ip.sin_addr)); - bSendSuccess = FALSE; + bSendSuccess = RSFALSE; d_pthread_mutex_lock(&mutLibnet); bNeedUnlock = 1; for (r = pData->f_addr; r; r = r->ai_next) { @@ -251,12 +251,12 @@ UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len) if (lsent == -1) { DBGPRINTF("Write error: %s\n", libnet_geterror(libnet_handle)); } else { - bSendSuccess = TRUE; + bSendSuccess = RSTRUE; break; } } /* finished looping */ - if (bSendSuccess == FALSE) { + if (bSendSuccess == RSFALSE) { DBGPRINTF("error forwarding via udp, suspending\n"); iRet = RS_RET_SUSPENDED; } diff --git a/runtime/modules.c b/runtime/modules.c index b353e983..45788ef7 100644 --- a/runtime/modules.c +++ b/runtime/modules.c @@ -498,11 +498,11 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_ /* check some features */ localRet = pNew->isCompatibleWithFeature(sFEATUREAutomaticSanitazion); if(localRet == RS_RET_OK){ - CHKiRet(parser.SetDoSanitazion(pParser, TRUE)); + CHKiRet(parser.SetDoSanitazion(pParser, RSTRUE)); } localRet = pNew->isCompatibleWithFeature(sFEATUREAutomaticPRIParsing); if(localRet == RS_RET_OK){ - CHKiRet(parser.SetDoPRIParsing(pParser, TRUE)); + CHKiRet(parser.SetDoPRIParsing(pParser, RSTRUE)); } CHKiRet(parser.SetName(pParser, pName)); @@ -787,9 +787,9 @@ Load(uchar *pModName) if(iModNameLen > 3 && !strcmp((char *) pModName + iModNameLen - 3, ".so")) { iModNameLen -= 3; - bHasExtension = TRUE; + bHasExtension = RSTRUE; } else - bHasExtension = FALSE; + bHasExtension = RSFALSE; pModInfo = GetNxt(NULL); while(pModInfo != NULL) { diff --git a/runtime/parser.c b/runtime/parser.c index 300db1e0..180814cf 100644 --- a/runtime/parser.c +++ b/runtime/parser.c @@ -311,7 +311,7 @@ SanitizeMsg(msg_t *pMsg) size_t iDst; size_t iMaxLine; size_t maxDest; - sbool bUpdatedLen = FALSE; + sbool bUpdatedLen = RSFALSE; uchar szSanBuf[32*1024]; /* buffer used for sanitizing a string */ assert(pMsg != NULL); @@ -326,7 +326,7 @@ SanitizeMsg(msg_t *pMsg) */ if(pszMsg[lenMsg-1] == '\0') { DBGPRINTF("dropped NUL at very end of message\n"); - bUpdatedLen = TRUE; + bUpdatedLen = RSTRUE; lenMsg--; } @@ -339,7 +339,7 @@ SanitizeMsg(msg_t *pMsg) DBGPRINTF("dropped LF at very end of message (DropTrailingLF is set)\n"); lenMsg--; pszMsg[lenMsg] = '\0'; - bUpdatedLen = TRUE; + bUpdatedLen = RSTRUE; } /* it is much quicker to sweep over the message and see if it actually @@ -370,7 +370,7 @@ SanitizeMsg(msg_t *pMsg) } if(!bNeedSanitize) { - if(bUpdatedLen == TRUE) + if(bUpdatedLen == RSTRUE) MsgSetRawMsgSize(pMsg, lenMsg); FINALIZE; } @@ -508,17 +508,17 @@ ParseMsg(msg_t *pMsg) DBGPRINTF("parse using parser list %p%s.\n", pParserList, (pParserList == pDfltParsLst) ? " (the default list)" : ""); - bIsSanitized = FALSE; - bPRIisParsed = FALSE; + bIsSanitized = RSFALSE; + bPRIisParsed = RSFALSE; while(pParserList != NULL) { pParser = pParserList->pParser; - if(pParser->bDoSanitazion && bIsSanitized == FALSE) { + if(pParser->bDoSanitazion && bIsSanitized == RSFALSE) { CHKiRet(SanitizeMsg(pMsg)); - if(pParser->bDoPRIParsing && bPRIisParsed == FALSE) { + if(pParser->bDoPRIParsing && bPRIisParsed == RSFALSE) { CHKiRet(ParsePRI(pMsg)); - bPRIisParsed = TRUE; + bPRIisParsed = RSTRUE; } - bIsSanitized = TRUE; + bIsSanitized = RSTRUE; } localRet = pParser->pModule->mod.pm.parse(pMsg); dbgprintf("Parser '%s' returned %d\n", pParser->pName, localRet); diff --git a/runtime/srutils.c b/runtime/srutils.c index a473c83e..f420c0f7 100644 --- a/runtime/srutils.c +++ b/runtime/srutils.c @@ -41,8 +41,6 @@ #include #include #include -#define TRUE 1 -#define FALSE 0 #include "srUtils.h" #include "obj.h" @@ -128,11 +126,11 @@ rsRetVal srUtilItoA(char *pBuf, int iLenBuf, number_t iToConv) if(iToConv < 0) { - bIsNegative = TRUE; + bIsNegative = RSTRUE; iToConv *= -1; } else - bIsNegative = FALSE; + bIsNegative = RSFALSE; /* first generate a string with the digits in the reverse direction */ i = 0; @@ -148,7 +146,7 @@ rsRetVal srUtilItoA(char *pBuf, int iLenBuf, number_t iToConv) return RS_RET_PROVIDED_BUFFER_TOO_SMALL; /* then move it to the right direction... */ - if(bIsNegative == TRUE) + if(bIsNegative == RSTRUE) *pBuf++ = '-'; while(i >= 0) *pBuf++ = szBuf[i--]; diff --git a/runtime/stream.c b/runtime/stream.c index 6b88d3f4..9645a3fe 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -1172,7 +1172,7 @@ doZipWrite(strm_t *pThis, uchar *pBuf, size_t lenBuf) { z_stream zstrm; int zRet; /* zlib return state */ - sbool bzInitDone = FALSE; + sbool bzInitDone = RSFALSE; DEFiRet; assert(pThis != NULL); assert(pBuf != NULL); @@ -1188,7 +1188,7 @@ doZipWrite(strm_t *pThis, uchar *pBuf, size_t lenBuf) DBGPRINTF("error %d returned from zlib/deflateInit2()\n", zRet); ABORT_FINALIZE(RS_RET_ZLIB_ERR); } - bzInitDone = TRUE; + bzInitDone = RSTRUE; /* now doing the compression */ zstrm.next_in = (Bytef*) pBuf; /* as of zlib doc, this must be set BEFORE DeflateInit2 */ diff --git a/runtime/syslogd-types.h b/runtime/syslogd-types.h index 30ce896a..6947a110 100644 --- a/runtime/syslogd-types.h +++ b/runtime/syslogd-types.h @@ -31,8 +31,9 @@ #include #endif -#define FALSE 0 -#define TRUE 1 +/* we use RSTRUE/FALSE to prevent name claches with other packages */ +#define RSFALSE 0 +#define RSTRUE 1 #ifdef UT_NAMESIZE # define UNAMESZ UT_NAMESIZE /* length of a login name */ diff --git a/runtime/wti.c b/runtime/wti.c index e44086af..7b88c3eb 100644 --- a/runtime/wti.c +++ b/runtime/wti.c @@ -86,7 +86,7 @@ rsRetVal wtiSetAlwaysRunning(wti_t *pThis) { ISOBJ_TYPE_assert(pThis, wti); - pThis->bAlwaysRunning = TRUE; + pThis->bAlwaysRunning = RSTRUE; return RS_RET_OK; } @@ -198,7 +198,7 @@ wtiConstructFinalize(wti_t *pThis) dbgprintf("%s: finalizing construction of worker instance data\n", wtiGetDbgHdr(pThis)); /* initialize our thread instance descriptor (no concurrency here) */ - pThis->bIsRunning = FALSE; + pThis->bIsRunning = RSFALSE; /* we now alloc the array for user pointers. We obtain the max from the queue itself. */ CHKiRet(pThis->pWtp->pfGetDeqBatchSize(pThis->pWtp->pUsr, &iDeqBatchSize)); diff --git a/runtime/wtp.h b/runtime/wtp.h index 7e24ec82..25992f7f 100644 --- a/runtime/wtp.h +++ b/runtime/wtp.h @@ -27,8 +27,8 @@ #include "atomic.h" /* states for worker threads. */ -#define WRKTHRD_STOPPED FALSE -#define WRKTHRD_RUNNING TRUE +#define WRKTHRD_STOPPED RSFALSE +#define WRKTHRD_RUNNING RSTRUE /* possible states of a worker thread pool */ diff --git a/tcpsrv.c b/tcpsrv.c index f6daadeb..238b1e8d 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -687,7 +687,7 @@ Run(tcpsrv_t *pThis) dbgprintf("tcpsrv uses epoll() interface, nsdpol driver found\n"); /* flag that we are in epoll mode */ - pThis->bUsingEPoll = TRUE; + pThis->bUsingEPoll = RSTRUE; /* Add the TCP listen sockets to the list of sockets to monitor */ for(i = 0 ; i < pThis->iLstnCurr ; ++i) { diff --git a/threads.c b/threads.c index 1aca6dbc..182b4789 100644 --- a/threads.c +++ b/threads.c @@ -96,7 +96,7 @@ thrdTerminateNonCancel(thrdInfo_t *pThis) assert(pThis != NULL); DBGPRINTF("request term via SIGTTIN for input thread 0x%x\n", (unsigned) pThis->thrdID); - pThis->bShallStop = TRUE; + pThis->bShallStop = RSTRUE; do { d_pthread_mutex_lock(&pThis->mutThrd); pthread_kill(pThis->thrdID, SIGTTIN); diff --git a/tools/omfwd.c b/tools/omfwd.c index b456db17..812da109 100644 --- a/tools/omfwd.c +++ b/tools/omfwd.c @@ -207,12 +207,12 @@ static rsRetVal UDPSend(instanceData *pData, char *msg, size_t len) * call fails. Then, lsent has the error status, even though * the sendto() succeeded. -- rgerhards, 2007-06-22 */ - bSendSuccess = FALSE; + bSendSuccess = RSFALSE; for (r = pData->f_addr; r; r = r->ai_next) { for (i = 0; i < *pData->pSockArray; i++) { lsent = sendto(pData->pSockArray[i+1], msg, len, 0, r->ai_addr, r->ai_addrlen); if (lsent == len) { - bSendSuccess = TRUE; + bSendSuccess = RSTRUE; break; } else { int eno = errno; @@ -225,7 +225,7 @@ static rsRetVal UDPSend(instanceData *pData, char *msg, size_t len) break; } /* finished looping */ - if (bSendSuccess == FALSE) { + if (bSendSuccess == RSFALSE) { dbgprintf("error forwarding via udp, suspending\n"); iRet = RS_RET_SUSPENDED; } -- cgit From 06cf49e5a6cd25abe7c77fe3df97b7f87b9c576e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 22 Aug 2012 15:32:32 +0200 Subject: nit: forward-compatible default ruleset name as used in next version --- runtime/ruleset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/ruleset.c b/runtime/ruleset.c index d608f3ad..14dc4c74 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -518,7 +518,7 @@ rulesetCreateQueue(void __attribute__((unused)) *pVal, int *pNewVal) if(pNewVal == 0) FINALIZE; /* if it is turned off, we do not need to change anything ;) */ - rsname = (pCurrRuleset->pszName == NULL) ? (uchar*) "[NONAME]" : pCurrRuleset->pszName; + rsname = (pCurrRuleset->pszName == NULL) ? (uchar*) "[ruleset]" : pCurrRuleset->pszName; DBGPRINTF("adding a ruleset-specific \"main\" queue for ruleset '%s'\n", rsname); CHKiRet(createMainQueue(&pCurrRuleset->pQueue, rsname)); -- cgit From c8d66987a2aff47d5cd8d1dc811893ce91c8410d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 22 Aug 2012 16:54:41 +0200 Subject: small bugfix: stream timeout API use was incorrect Thanks to Andre Lorbach for mentioning this. --- runtime/stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/stream.c b/runtime/stream.c index d6ee1e39..742799d2 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -1010,6 +1010,7 @@ asyncWriterThread(void *pPtr) struct timespec t; sbool bTimedOut = 0; strm_t *pThis = (strm_t*) pPtr; + int err; ISOBJ_TYPE_assert(pThis, strm); BEGINfunc @@ -1036,8 +1037,7 @@ asyncWriterThread(void *pPtr) bTimedOut = 0; timeoutComp(&t, pThis->iFlushInterval * 1000); /* *1000 millisconds */ if(pThis->bDoTimedWait) { - if(pthread_cond_timedwait(&pThis->notEmpty, &pThis->mut, &t) != 0) { - int err = errno; + if((err = pthread_cond_timedwait(&pThis->notEmpty, &pThis->mut, &t)) != 0) { if(err == ETIMEDOUT) { bTimedOut = 1; } else { -- cgit From d7f26ff418237415834f5c34d10de120e16dc721 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 22 Aug 2012 17:12:57 +0200 Subject: preparing for 5.8.13 release --- ChangeLog | 2 +- configure.ac | 2 +- doc/manual.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32409fd7..7ac02170 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 5.8.13 [V5-stable] 2012-06-?? +Version 5.8.13 [V5-stable] 2012-08-22 - bugfix: DA queue could cause abort - bugfix: "last message repeated n times" message was missing hostname Thanks to Zdenek Salvet for finding this bug and to Bodik for reporting diff --git a/configure.ac b/configure.ac index 7f5815eb..c217555a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[5.8.12],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[5.8.13],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/doc/manual.html b/doc/manual.html index 747b412a..4e29aa0d 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@ rsyslog support available directly from the source!

Please visit the rsyslog sponsor's page to honor the project sponsors or become one yourself! We are very grateful for any help towards the project goals.

-

This documentation is for version 5.8.12 (v5-stable branch) of rsyslog. +

This documentation is for version 5.8.13 (v5-stable branch) of rsyslog. Visit the rsyslog status page to obtain current version information and project status.

If you like rsyslog, you might -- cgit From a568626d4a627d226f203eb83f41b731e0f00ac9 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 22 Aug 2012 18:54:13 +0200 Subject: preparing for 5.10.0 release --- ChangeLog | 7 ++++++- configure.ac | 2 +- doc/manual.html | 2 +- tests/Makefile.am | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcb259b6..3073d2f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ --------------------------------------------------------------------------- -Version 5.10.0 [V5-STABLE], 2012-05-?? +Version 5.10.0 [V5-STABLE], 2012-08-23 + +NOTE: this is the new rsyslog v5-stable, incorporating all changes from the + 5.9.x series. In addition to that, it contains the fixes and + enhancements listed below in this entry. + - bugfix: delayble source could block action queue, even if there was a disk queue associated with it. The root cause of this problem was that it makes no sense to delay messages once they arrive in the diff --git a/configure.ac b/configure.ac index 243cd6d8..cf8a205e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[5.9.7],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[5.10.0],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/doc/manual.html b/doc/manual.html index e96dbe40..4250e2f0 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@ rsyslog support available directly from the source!

Please visit the rsyslog sponsor's page to honor the project sponsors or become one yourself! We are very grateful for any help towards the project goals.

-

This documentation is for version 5.9.7 (stable branch) of rsyslog. +

This documentation is for version 5.10.0 (stable branch) of rsyslog. Visit the rsyslog status page to obtain current version information and project status.

If you like rsyslog, you might diff --git a/tests/Makefile.am b/tests/Makefile.am index 77381d2f..110a6eaa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -137,7 +137,9 @@ endif endif if ENABLE_EXTENDED_TESTS -TESTS += random.sh +# random.sh is temporarily disabled as it needs some work +# to rsyslog core to complete in reasonable time +#TESTS += random.sh endif if ENABLE_IMFILE -- cgit From 1824ab8d98b983402315b86954a7ad160b43b508 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 25 Aug 2012 11:21:26 +0200 Subject: change template.[ch] to ASL 2.0, removing a GPLv3-only patch see template.c file header for details Note that this functionality was almost never used in practice --- runtime/msg.c | 2 ++ template.c | 39 ++++++++++++++++++++++++--------------- template.h | 37 ++++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/runtime/msg.c b/runtime/msg.c index f9acb842..0d22b29a 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2547,11 +2547,13 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, ++pFld; /* skip to field terminator */ if(*pFld == pTpe->data.field.field_delim) { ++pFld; /* eat it */ +#ifdef STRICT_GPLV3 if (pTpe->data.field.field_expand != 0) { while (*pFld == pTpe->data.field.field_delim) { ++pFld; } } +#endif ++iCurrFld; } } diff --git a/template.c b/template.c index 2038c6c1..45ae99a1 100644 --- a/template.c +++ b/template.c @@ -1,25 +1,30 @@ /* This is the template processing code of rsyslog. - * Please see syslogd.c for license information. * begun 2004-11-17 rgerhards * - * Copyright 2004, 2007 Rainer Gerhards and Adiscon + * Copyright 2004-2012 Rainer Gerhards and Adiscon * * This file is part of rsyslog. * - * Rsyslog is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * Rsyslog is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Rsyslog. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this distribution. + * Note: there is a tiny bit of code left where I could not get any response + * from the author if this code can be placed under ASL2.0. I have guarded this + * with #ifdef STRICT_GPLV3. Only if that macro is defined, the code will be + * compiled. Otherwise this feature is not present. The plan is to do a + * different implementation in the future to get rid of this problem. + * rgerhards, 2012-08-25 */ #include "config.h" @@ -683,7 +688,9 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl) /* now we fall through the "regular" FromPos code */ #endif /* #ifdef FEATURE_REGEXP */ if(*p == 'F') { +#ifdef STRICT_GPLV3 pTpe->data.field.field_expand = 0; +#endif /* we have a field counter, so indicate it in the template */ ++p; /* eat 'F' */ if (*p == ':') { @@ -711,10 +718,12 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl) pTpe->data.field.field_delim = 9; } else { pTpe->data.field.field_delim = iNum; +#ifdef STRICT_GPLV3 if (*p == '+') { pTpe->data.field.field_expand = 1; p ++; } +#endif } } } else { diff --git a/template.h b/template.h index f7ac2e08..707bd52a 100644 --- a/template.h +++ b/template.h @@ -1,25 +1,30 @@ /* This is the header for template processing code of rsyslog. - * Please see syslogd.c for license information. * begun 2004-11-17 rgerhards * - * Copyright (C) 2004 by Rainer Gerhards and Adiscon GmbH + * Copyright 2004-2012 Rainer Gerhards and Adiscon * * This file is part of rsyslog. * - * Rsyslog is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * Rsyslog is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Rsyslog. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this distribution. + * Note: there is a tiny bit of code left where I could not get any response + * from the author if this code can be placed under ASL2.0. I have guarded this + * with #ifdef STRICT_GPLV3. Only if that macro is defined, the code will be + * compiled. Otherwise this feature is not present. The plan is to do a + * different implementation in the future to get rid of this problem. + * rgerhards, 2012-08-25 */ #ifndef TEMPLATE_H_INCLUDED @@ -86,7 +91,9 @@ struct templateEntry { #endif unsigned has_fields; /* support for field-counting: field to extract */ unsigned char field_delim; /* support for field-counting: field delemiter char */ +#ifdef STRICT_GPLV3 int field_expand; /* use multiple instances of the field delimiter as a single one? */ +#endif enum tplFormatTypes eDateFormat; enum tplFormatCaseConvTypes eCaseConv; -- cgit