diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-01 14:21:49 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-01 14:21:49 +0100 |
commit | abef390dae4e959a0650a1f8ff747dc5d1528305 (patch) | |
tree | 744badfb1d749ad241691781576a122276896dca /runtime | |
parent | ebf058226120b89bc2735ff72c4c12c14cfa2599 (diff) | |
parent | b4cdb7c997eee95df96321d11d03cf90e4a6caba (diff) | |
download | rsyslog-abef390dae4e959a0650a1f8ff747dc5d1528305.tar.gz rsyslog-abef390dae4e959a0650a1f8ff747dc5d1528305.tar.xz rsyslog-abef390dae4e959a0650a1f8ff747dc5d1528305.zip |
Merge branch 'beta' into master
Conflicts:
ChangeLog
configure.ac
doc/manual.html
tools/syslogd.c
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/ctok.c | 37 | ||||
-rw-r--r-- | runtime/rule.c | 1 |
2 files changed, 31 insertions, 7 deletions
diff --git a/runtime/ctok.c b/runtime/ctok.c index 6f5f0273..18ddaed2 100644 --- a/runtime/ctok.c +++ b/runtime/ctok.c @@ -87,11 +87,12 @@ ctokUngetCharFromStream(ctok_t *pThis, uchar __attribute__((unused)) c) } -/* get the next character from the input "stream" (currently just a in-memory - * string...) -- rgerhards, 2008-02-19 +/* 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 rsRetVal -ctokGetCharFromStream(ctok_t *pThis, uchar *pc) +static inline rsRetVal +ctokGetCharFromStreamNoComment(ctok_t *pThis, uchar *pc) { DEFiRet; @@ -99,7 +100,7 @@ ctokGetCharFromStream(ctok_t *pThis, uchar *pc) ASSERT(pc != NULL); /* end of string or begin of comment terminates the "stream" */ - if(*pThis->pp == '\0' || *pThis->pp == '#') { + if(*pThis->pp == '\0') { ABORT_FINALIZE(RS_RET_EOS); } else { *pc = *pThis->pp; @@ -111,6 +112,28 @@ finalize_it: } +/* get the next character from the input "stream" (currently just a in-memory + * string...) -- rgerhards, 2008-02-19 + */ +static rsRetVal +ctokGetCharFromStream(ctok_t *pThis, uchar *pc) +{ + DEFiRet; + + ISOBJ_TYPE_assert(pThis, ctok); + ASSERT(pc != NULL); + + CHKiRet(ctokGetCharFromStreamNoComment(pThis, pc)); + /* begin of comment terminates the "stream"! */ + if(*pc == '#') { + ABORT_FINALIZE(RS_RET_EOS); + } + +finalize_it: + RETiRet; +} + + /* skip whitespace in the input "stream". * rgerhards, 2008-02-19 */ @@ -302,7 +325,7 @@ ctokGetSimpStr(ctok_t *pThis, ctok_token_t *pToken) pToken->tok = ctok_SIMPSTR; CHKiRet(cstrConstruct(&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. */ @@ -317,7 +340,7 @@ ctokGetSimpStr(ctok_t *pThis, ctok_token_t *pToken) CHKiRet(cstrAppendChar(pstrVal, c)); } } - CHKiRet(ctokGetCharFromStream(pThis, &c)); + CHKiRet(ctokGetCharFromStreamNoComment(pThis, &c)); } CHKiRet(cstrFinalize(pstrVal)); diff --git a/runtime/rule.c b/runtime/rule.c index ae0da0d6..65ad071e 100644 --- a/runtime/rule.c +++ b/runtime/rule.c @@ -193,6 +193,7 @@ RUNLOG_VAR("%p", pRule->pCSProgNameComp); if(pRule->f_filter_type == FILTER_PRI) { /* skip messages that are incorrect priority */ +dbgprintf("testing filter, f_pmask %d\n", pRule->f_filterData.f_pmask[pMsg->iFacility]); if ( (pRule->f_filterData.f_pmask[pMsg->iFacility] == TABLE_NOPRI) || \ ((pRule->f_filterData.f_pmask[pMsg->iFacility] & (1<<pMsg->iSeverity)) == 0) ) bRet = 0; |