summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-10-21 14:05:59 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-10-21 14:05:59 +0200
commit10947b3f4a762ff6f1c2687bc1b4a2f33d7b6510 (patch)
tree9403751ce742d28dd6878abff4236d327bf546f9
parent5cf2c696680a90a23fabdd8761cdc7d0a3221e6a (diff)
downloadrsyslog-10947b3f4a762ff6f1c2687bc1b4a2f33d7b6510.zip
rsyslog-10947b3f4a762ff6f1c2687bc1b4a2f33d7b6510.tar.gz
rsyslog-10947b3f4a762ff6f1c2687bc1b4a2f33d7b6510.tar.xz
bugfix: missing whitespace after property-based filter was not detected
-rw-r--r--ChangeLog1
-rw-r--r--parse.c18
-rw-r--r--parse.h2
-rw-r--r--runtime/conf.c2
-rw-r--r--runtime/rsyslog.h1
5 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 35de07e..a6f5875 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
---------------------------------------------------------------------------
Version 5.8.6 [V5-stable] 2011-??-??
+- bugfix: missing whitespace after property-based filter was not detected
- bugfix: $OMFileFlushInterval period was doubled - now using correct value
- bugfix: ActionQueue could malfunction due to index error
Thanks to Vlad Grigorescu for the patch
diff --git a/parse.c b/parse.c
index e335d42..4c9c27c 100644
--- a/parse.c
+++ b/parse.c
@@ -210,22 +210,32 @@ rsRetVal parsSkipAfterChar(rsParsObj *pThis, char c)
/* Skip whitespace. Often used to trim parsable entries.
* Returns with ParsePointer set to first non-whitespace
* character (or at end of string).
+ * If bRequireOne is set to true, at least one whitespace
+ * must exist, else an error is returned.
*/
-rsRetVal parsSkipWhitespace(rsParsObj *pThis)
+rsRetVal parsSkipWhitespace(rsParsObj *pThis, sbool bRequireOne)
{
register unsigned char *pC;
+ int numSkipped;
+ DEFiRet;
+
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
pC = rsCStrGetBufBeg(pThis->pCStr);
+ numSkipped = 0;
while(pThis->iCurrPos < rsCStrLen(pThis->pCStr)) {
if(!isspace((int)*(pC+pThis->iCurrPos)))
break;
++pThis->iCurrPos;
+ ++numSkipped;
}
- return RS_RET_OK;
+ if(bRequireOne && numSkipped == 0)
+ iRet = RS_RET_MISSING_WHITESPACE;
+
+ RETiRet;
}
/* Parse string up to a delimiter.
@@ -252,7 +262,7 @@ rsRetVal parsDelimCStr(rsParsObj *pThis, cstr_t **ppCStr, char cDelim, int bTrim
CHKiRet(rsCStrConstruct(&pCStr));
if(bTrimLeading)
- parsSkipWhitespace(pThis);
+ parsSkipWhitespace(pThis, 0);
pC = rsCStrGetBufBeg(pThis->pCStr) + pThis->iCurrPos;
@@ -383,7 +393,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
CHKiRet(cstrConstruct(&pCStr));
- parsSkipWhitespace(pThis);
+ parsSkipWhitespace(pThis, 0);
pC = rsCStrGetBufBeg(pThis->pCStr) + pThis->iCurrPos;
/* we parse everything until either '/', ',' or
diff --git a/parse.h b/parse.h
index 0fe2bb7..fb62d1e 100644
--- a/parse.h
+++ b/parse.h
@@ -77,7 +77,7 @@ rsRetVal rsParsAssignString(rsParsObj *pThis, cstr_t *pCStr);
rsRetVal parsInt(rsParsObj *pThis, int* pInt);
/* Skip whitespace. Often used to trim parsable entries. */
-rsRetVal parsSkipWhitespace(rsParsObj *pThis);
+rsRetVal parsSkipWhitespace(rsParsObj *pThis, sbool bRequireOne);
/* Parse string up to a delimiter.
*
diff --git a/runtime/conf.c b/runtime/conf.c
index 529142e..8e885a1 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -924,7 +924,7 @@ static rsRetVal cflineProcessPropFilter(uchar **pline, register rule_t *f)
}
/* skip to action part */
- if((iRet = parsSkipWhitespace(pPars)) != RS_RET_OK) {
+ if((iRet = parsSkipWhitespace(pPars, 1)) != RS_RET_OK) {
errmsg.LogError(0, iRet, "error %d skipping to action part - ignoring selector", iRet);
rsParsDestruct(pPars);
return(iRet);
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index f14e072..69b3c8d 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -344,6 +344,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_ERR_WRKDIR = -2181, /**< problems with the rsyslog working directory */
RS_RET_WRN_WRKDIR = -2182, /**< correctable problems with the rsyslog working directory */
RS_RET_OUTDATED_STMT = -2184, /**< some outdated statement/functionality is being used in conf file */
+ RS_RET_MISSING_WHITESPACE = -2185, /**< whitespace is missing in some config construct */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */