bugfix: comment char ('#') in literal terminated script parsing

...and thus could not be used.
but tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=119
This commit is contained in:
Rainer Gerhards 2010-03-01 12:44:57 +01:00
parent 8021912232
commit 01e6df368c
2 changed files with 33 additions and 7 deletions

View File

@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 3.22.2 [v3-stable] (rgerhards), 2009-07-??
- bugfix: comment char ('#') in literal terminated script parsing
and thus could not be used.
but tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=119
- enhance: imrelp now also provides remote peer's IP address
[if librelp != 1.0.0 is used]
- bugfix: sending syslog messages with zip compression did not work

View File

@ -87,6 +87,31 @@ ctokUngetCharFromStream(ctok_t *pThis, uchar __attribute__((unused)) c)
}
/* get the next character from the input "stream". Note that this version
* does NOT look for comment characters as end-of-stream, so it is suitable
* when building constant strings! -- rgerhards, 2010-03-01
*/
static inline rsRetVal
ctokGetCharFromStreamNoComment(ctok_t *pThis, uchar *pc)
{
DEFiRet;
ISOBJ_TYPE_assert(pThis, ctok);
ASSERT(pc != NULL);
/* end of string or begin of comment terminates the "stream" */
if(*pThis->pp == '\0') {
ABORT_FINALIZE(RS_RET_EOS);
} else {
*pc = *pThis->pp;
++pThis->pp;
}
finalize_it:
RETiRet;
}
/* get the next character from the input "stream" (currently just a in-memory
* string...) -- rgerhards, 2008-02-19
*/
@ -98,12 +123,10 @@ ctokGetCharFromStream(ctok_t *pThis, uchar *pc)
ISOBJ_TYPE_assert(pThis, ctok);
ASSERT(pc != NULL);
/* end of string or begin of comment terminates the "stream" */
if(*pThis->pp == '\0' || *pThis->pp == '#') {
CHKiRet(ctokGetCharFromStreamNoComment(pThis, pc));
/* begin of comment terminates the "stream"! */
if(*pc == '#') {
ABORT_FINALIZE(RS_RET_EOS);
} else {
*pc = *pThis->pp;
++pThis->pp;
}
finalize_it:
@ -297,7 +320,7 @@ ctokGetSimpStr(ctok_t *pThis, ctok_token_t *pToken)
pToken->tok = ctok_SIMPSTR;
CHKiRet(rsCStrConstruct(&pstrVal));
CHKiRet(ctokGetCharFromStream(pThis, &c));
CHKiRet(ctokGetCharFromStreamNoComment(pThis, &c));
/* while we are in escape mode (had a backslash), no sequence
* terminates the loop. If outside, it is terminated by a single quote.
*/
@ -312,7 +335,7 @@ ctokGetSimpStr(ctok_t *pThis, ctok_token_t *pToken)
CHKiRet(rsCStrAppendChar(pstrVal, c));
}
}
CHKiRet(ctokGetCharFromStream(pThis, &c));
CHKiRet(ctokGetCharFromStreamNoComment(pThis, &c));
}
CHKiRet(rsCStrFinish(pStrB));