diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/modules.c | 8 | ||||
-rw-r--r-- | runtime/msg.c | 2 | ||||
-rw-r--r-- | runtime/obj.c | 37 | ||||
-rw-r--r-- | runtime/parser.c | 20 | ||||
-rw-r--r-- | runtime/ruleset.c | 9 | ||||
-rw-r--r-- | runtime/srutils.c | 8 | ||||
-rw-r--r-- | runtime/stream.c | 8 | ||||
-rw-r--r-- | runtime/syslogd-types.h | 5 | ||||
-rw-r--r-- | runtime/wti.c | 4 | ||||
-rw-r--r-- | runtime/wtp.h | 4 |
10 files changed, 71 insertions, 34 deletions
diff --git a/runtime/modules.c b/runtime/modules.c index bc8580f1..d3c51e90 100644 --- a/runtime/modules.c +++ b/runtime/modules.c @@ -657,11 +657,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)); @@ -990,9 +990,9 @@ Load(uchar *pModName, sbool bConfLoad, struct nvlst *lst) if(iModNameLen > 3 && !strcmp((char *) pModName + iModNameLen - 3, ".so")) { iModNameLen -= 3; - bHasExtension = TRUE; + bHasExtension = RSTRUE; } else - bHasExtension = FALSE; + bHasExtension = RSFALSE; CHKiRet(findModule(pModName, iModNameLen, &pModInfo)); if(pModInfo != NULL) { diff --git a/runtime/msg.c b/runtime/msg.c index 99874317..da751dba 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2814,11 +2814,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/runtime/obj.c b/runtime/obj.c index 99621124..eb151b67 100644 --- a/runtime/obj.c +++ b/runtime/obj.c @@ -610,6 +610,8 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm) number_t i; number_t iLen; uchar c; + int step = 0; /* which step was successful? */ + int64 offs; assert(pProp != NULL); @@ -630,13 +632,16 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm) NEXTC; } CHKiRet(cstrFinalize(pProp->pcsName)); + step = 1; /* property type */ CHKiRet(objDeserializeNumber(&i, pStrm)); pProp->varType = i; + step = 2; /* size (needed for strings) */ CHKiRet(objDeserializeNumber(&iLen, pStrm)); + step = 3; /* we now need to deserialize the value */ switch(pProp->varType) { @@ -653,12 +658,44 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm) dbgprintf("invalid VARTYPE %d\n", pProp->varType); break; } + step = 4; /* we should now be at the end of the line. So the next char must be \n */ NEXTC; if(c != '\n') ABORT_FINALIZE(RS_RET_INVALID_PROPFRAME); finalize_it: + if(Debug && iRet != RS_RET_OK) { + strm.GetCurrOffset(pStrm, &offs); + dbgprintf("error %d deserializing property name, offset %lld, step %d\n", + iRet, offs, step); + if(step >= 1) { + dbgprintf("error property name: '%s'\n", rsCStrGetSzStrNoNULL(pProp->pcsName)); + } + if(step >= 2) { + dbgprintf("error var type: '%d'\n", pProp->varType); + } + if(step >= 3) { + dbgprintf("error len: '%d'\n", (int) iLen); + } + if(step >= 4) { + switch(pProp->varType) { + case VARTYPE_STR: + dbgprintf("error data string: '%s'\n", + rsCStrGetSzStrNoNULL(pProp->val.pStr)); + break; + case VARTYPE_NUMBER: + dbgprintf("error number: %d\n", (int) pProp->val.num); + break; + case VARTYPE_SYSLOGTIME: + dbgprintf("syslog time was successfully parsed (but " + "is not displayed\n"); + break; + default: + break; + } + } + } RETiRet; } diff --git a/runtime/parser.c b/runtime/parser.c index f0515484..645ea0f4 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/ruleset.c b/runtime/ruleset.c index ecded4a3..5cb34148 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -497,7 +497,7 @@ debugPrintAll(rsconf_t *conf) static inline rsRetVal doRulesetCreateQueue(rsconf_t *conf, int *pNewVal) { - uchar *rulesetMainQName; + uchar *rsname; DEFiRet; if(conf->rulesets.pCurr == NULL) { @@ -515,10 +515,9 @@ doRulesetCreateQueue(rsconf_t *conf, 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"); - rulesetMainQName = (conf->rulesets.pCurr->pszName == NULL)? UCHAR_CONSTANT("ruleset") : - conf->rulesets.pCurr->pszName; - CHKiRet(createMainQueue(&conf->rulesets.pCurr->pQueue, rulesetMainQName)); + rsname = (conf->rulesets.pCurr->pszName == NULL) ? (uchar*) "[ruleset]" : conf->rulesets.pCurr->pszName; + DBGPRINTF("adding a ruleset-specific \"main\" queue for ruleset '%s'\n", rsname); + CHKiRet(createMainQueue(&conf->rulesets.pCurr->pQueue, rsname)); finalize_it: RETiRet; 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 <assert.h> #include <sys/wait.h> #include <ctype.h> -#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 bb1a0a42..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 { @@ -1170,7 +1170,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); @@ -1186,7 +1186,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 <syslog.h> #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 382f3668..f91fb5a9 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 */ |