summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-02-25 14:46:07 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-02-25 14:46:07 +0100
commit74a71e798efd58e20cc150b04de2613bf518eed4 (patch)
tree5b0b04e1b44912c6a143b180dead5b62e4390343
parenta8760241a30dc2618c53c569d23acdec1e06908e (diff)
parent5b1cd3330196c5ffa2b8695798946aa2441b7e84 (diff)
downloadrsyslog-74a71e798efd58e20cc150b04de2613bf518eed4.tar.gz
rsyslog-74a71e798efd58e20cc150b04de2613bf518eed4.tar.xz
rsyslog-74a71e798efd58e20cc150b04de2613bf518eed4.zip
Merge branch 'v5-beta'
Conflicts: ChangeLog configure.ac doc/manual.html
-rw-r--r--ChangeLog31
-rw-r--r--configure.ac2
-rw-r--r--doc/manual.html2
-rw-r--r--plugins/imuxsock/imuxsock.c22
-rw-r--r--runtime/batch.h8
-rw-r--r--runtime/msg.c10
-rw-r--r--runtime/msg.h3
-rw-r--r--runtime/queue.c5
-rw-r--r--runtime/ruleset.c23
-rw-r--r--tests/Makefile.am24
-rwxr-xr-xtests/imuxsock_ccmiddle_root.sh18
-rwxr-xr-xtests/imuxsock_logger_root.sh18
-rwxr-xr-xtests/imuxsock_traillf_root.sh18
-rw-r--r--tests/resultdata/imuxsock_ccmiddle.log1
-rw-r--r--tests/resultdata/imuxsock_logger.log1
-rw-r--r--tests/resultdata/imuxsock_traillf.log1
-rw-r--r--tests/syslog_inject.c28
-rw-r--r--tests/testsuites/imuxsock_ccmiddle_root.conf7
-rw-r--r--tests/testsuites/imuxsock_logger_root.conf7
-rw-r--r--tests/testsuites/imuxsock_traillf_root.conf7
-rw-r--r--tools/iminternal.c1
-rw-r--r--tools/syslogd.c3
22 files changed, 214 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 5692d9c3..40fc9fc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
---------------------------------------------------------------------------
+Version 6.1.5 [DEVEL] (rgerhards), 2011-02-??
+- bugfix: fixed a memory leak and potential abort condition
+ this could happen if multiple rulesets were used and some output batches
+ contained messages belonging to more than one ruleset.
+ fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=226
+ fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218
+- bugfix: memory leak when $RepeatedMsgReduction on was used
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225
+---------------------------------------------------------------------------
Version 6.1.4 [DEVEL] (rgerhards), 2011-02-18
- bugfix/omhdfs: directive $OMHDFSFileName rendered unusable
due to a search and replace-induced bug ;)
@@ -100,11 +109,25 @@ expected that interfaces, even new ones, break during the initial
syslog plain tcp input plugin (NOT supporting TLS!)
[ported from v4]
---------------------------------------------------------------------------
-Version 5.7.5 [V5-BETA] (rgerhards), 2011-02-??
+Version 5.7.6 [V5-BETA] (rgerhards), 2011-02-25
+- bugfix: fixed a memory leak and potential abort condition
+ this could happen if multiple rulesets were used and some output batches
+ contained messages belonging to more than one ruleset.
+ fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=226
+ fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218
+- bugfix: memory leak when $RepeatedMsgReduction on was used
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225
+---------------------------------------------------------------------------
+Version 5.7.5 [V5-BETA] (rgerhards), 2011-02-23
- enhance: imfile did not yet support multiple rulesets, now added
we do this directly in the beta because a) it does not affect existing
functionality and b) one may argue that this missing functionality is
close to a bug.
+- improved testbench, added tests for imuxsock
+- bugfix: imuxsock did no longer sanitize received messages
+ This was a regression from the imuxsock partial rewrite. Happened
+ because the message is no longer run through the standard parsers.
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=224
- bugfix: minor race condition in action.c - considered cosmetic
This is considered cosmetic as multiple threads tried to write exactly
the same value into the same memory location without sync. The method
@@ -189,8 +212,12 @@ Version 5.7.0 [V5-DEVEL] (rgerhards), 2010-09-16
thanks to Lennart Poettering for this patch
* sd-systemd API added as part of rsyslog runtime library
---------------------------------------------------------------------------
+Version 5.6.4 [V5-STABLE] (rgerhards), 2011-02-25
+- bugfix: memory leak when $RepeatedMsgReduction on was used
+ bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225
+---------------------------------------------------------------------------
Version 5.6.3 [V5-STABLE] (rgerhards), 2011-01-26
-- bugfix: action processor released mememory too early, resulting in
+- bugfix: action processor released memory too early, resulting in
potential issue in retry cases (but very unlikely due to another
bug, which I also fixed -- only after the fix this problem here
became actually visible).
diff --git a/configure.ac b/configure.ac
index b5fcdb4b..936a61fc 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],[6.1.4],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[6.1.5],[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 448e58f1..e82d4cba 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -19,7 +19,7 @@ rsyslog support</a> available directly from the source!</p>
<p><b>Please visit the <a href="http://www.rsyslog.com/sponsors">rsyslog sponsor's page</a>
to honor the project sponsors or become one yourself!</b> We are very grateful for any help towards the
project goals.</p>
-<p><b>This documentation is for version 6.1.4 (devel branch) of rsyslog.</b>
+<p><b>This documentation is for version 6.1.5 (devel branch) of rsyslog.</b>
Visit the <i><a href="http://www.rsyslog.com/status">rsyslog status page</a></i></b>
to obtain current version information and project status.
</p><p><b>If you like rsyslog, you might
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index ede8d954..b90a3363 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -46,6 +46,7 @@
#include "net.h"
#include "glbl.h"
#include "msg.h"
+#include "parser.h"
#include "prop.h"
#include "debug.h"
#include "unlimited_select.h"
@@ -81,6 +82,7 @@ DEF_IMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
DEFobjCurrIf(glbl)
DEFobjCurrIf(prop)
+DEFobjCurrIf(parser)
DEFobjCurrIf(datetime)
DEFobjCurrIf(statsobj)
@@ -501,6 +503,7 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred)
{
msg_t *pMsg;
int lenMsg;
+ int offs;
int i;
uchar *parse;
int pri;
@@ -518,13 +521,14 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred)
*/
parse = pRcv;
lenMsg = lenRcv;
+ offs = 1; /* '<' */
- parse++; lenMsg--; /* '<' */
+ parse++;
pri = 0;
- while(lenMsg && isdigit(*parse)) {
+ while(offs < lenMsg && isdigit(*parse)) {
pri = pri * 10 + *parse - '0';
++parse;
- --lenMsg;
+ ++offs;
}
facil = LOG_FAC(pri);
sever = LOG_PRI(pri);
@@ -543,12 +547,14 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred)
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &st, tt));
MsgSetRawMsg(pMsg, (char*)pRcv, lenRcv);
+ parser.SanitizeMsg(pMsg);
+ lenMsg = pMsg->iLenRawMsg - offs;
MsgSetInputName(pMsg, pInputName);
MsgSetFlowControlType(pMsg, pLstn->flowCtl);
pMsg->iFacility = facil;
pMsg->iSeverity = sever;
- MsgSetAfterPRIOffs(pMsg, lenRcv - lenMsg);
+ MsgSetAfterPRIOffs(pMsg, offs);
parse++; lenMsg--; /* '>' */
@@ -568,7 +574,7 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred)
fixPID(bufParseTAG, &i, cred);
MsgSetTAG(pMsg, bufParseTAG, i);
- MsgSetMSGoffs(pMsg, lenRcv - lenMsg);
+ MsgSetMSGoffs(pMsg, pMsg->iLenRawMsg - lenMsg);
if(pLstn->bParseHost) {
pMsg->msgFlags = pLstn->flags | PARSE_HOSTNAME;
@@ -600,7 +606,9 @@ static rsRetVal readSocket(lstn_t *pLstn)
int iMaxLine;
struct msghdr msgh;
struct iovec msgiov;
+# if HAVE_SCM_CREDENTIALS
struct cmsghdr *cm;
+# endif
struct ucred *cred;
uchar bufRcv[4096+1];
char aux[128];
@@ -624,11 +632,13 @@ static rsRetVal readSocket(lstn_t *pLstn)
memset(&msgh, 0, sizeof(msgh));
memset(&msgiov, 0, sizeof(msgiov));
+# if HAVE_SCM_CREDENTIALS
if(pLstn->bUseCreds) {
memset(&aux, 0, sizeof(aux));
msgh.msg_control = aux;
msgh.msg_controllen = sizeof(aux);
}
+# endif
msgiov.iov_base = pRcv;
msgiov.iov_len = iMaxLine;
msgh.msg_iov = &msgiov;
@@ -836,6 +846,7 @@ BEGINmodExit
CODESTARTmodExit
statsobj.Destruct(&modStats);
+ objRelease(parser, CORE_COMPONENT);
objRelease(glbl, CORE_COMPONENT);
objRelease(errmsg, CORE_COMPONENT);
objRelease(prop, CORE_COMPONENT);
@@ -897,6 +908,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(prop, CORE_COMPONENT));
CHKiRet(objUse(statsobj, CORE_COMPONENT));
CHKiRet(objUse(datetime, CORE_COMPONENT));
+ CHKiRet(objUse(parser, CORE_COMPONENT));
dbgprintf("imuxsock version %s initializing\n", PACKAGE_VERSION);
diff --git a/runtime/batch.h b/runtime/batch.h
index d0504f2b..944889bd 100644
--- a/runtime/batch.h
+++ b/runtime/batch.h
@@ -136,11 +136,16 @@ batchIsValidElem(batch_t *pBatch, int i) {
/* copy one batch element to another.
* This creates a complete duplicate in those cases where
* it is needed. Use duplication only when absolutely necessary!
+ * Note that all working fields are reset to zeros. If that were
+ * not done, we would have potential problems with invalid
+ * or double pointer frees.
* rgerhards, 2010-06-10
*/
static inline void
batchCopyElem(batch_obj_t *pDest, batch_obj_t *pSrc) {
- memcpy(pDest, pSrc, sizeof(batch_obj_t));
+ memset(pDest, 0, sizeof(batch_obj_t));
+ pDest->pUsrp = pSrc->pUsrp;
+ pDest->state = pSrc->state;
}
@@ -171,6 +176,7 @@ batchFree(batch_t *pBatch) {
static inline rsRetVal
batchInit(batch_t *pBatch, int maxElem) {
DEFiRet;
+ pBatch->iDoneUpTo = 0;
pBatch->maxElem = maxElem;
CHKmalloc(pBatch->pElem = calloc((size_t)maxElem, sizeof(batch_obj_t)));
// TODO: replace calloc by inidividual writes?
diff --git a/runtime/msg.c b/runtime/msg.c
index ad045dec..70b20749 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -686,6 +686,7 @@ static inline rsRetVal msgBaseConstruct(msg_t **ppThis)
/* initialize members in ORDER they appear in structure (think "cache line"!) */
pM->flowCtlType = 0;
pM->bDoLock = 0;
+ pM->bAlreadyFreed = 0;
pM->iRefCount = 1;
pM->iSeverity = -1;
pM->iFacility = -1;
@@ -813,6 +814,15 @@ CODESTARTobjDestruct(msg)
if(currRefCount == 0)
{
/* DEV Debugging Only! dbgprintf("msgDestruct\t0x%lx, RefCount now 0, doing DESTROY\n", (unsigned long)pThis); */
+ /* The if below is included to try to nail down a well-hidden bug causing
+ * segfaults. I hope that do to the test code the problem is sooner detected and
+ * thus we get better data for debugging and resolving it. -- rgerhards, 2011-02-23.
+ * TODO: remove when no longer needed.
+ */
+ if(pThis->bAlreadyFreed)
+ abort();
+ pThis->bAlreadyFreed = 1;
+ /* end debug code */
if(pThis->pszRawMsg != pThis->szRawMsg)
free(pThis->pszRawMsg);
freeTAG(pThis);
diff --git a/runtime/msg.h b/runtime/msg.h
index 1fd95994..01a1e059 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -63,7 +63,8 @@ struct msg {
once data has entered the queue, this property is no longer needed. */
pthread_mutex_t mut;
int iRefCount; /* reference counter (0 = unused) */
- sbool bDoLock; /* use the mutex? */
+ sbool bDoLock; /* use the mutex? */
+ sbool bAlreadyFreed; /* aid to help detect a well-hidden bad bug -- TODO: remove when no longer needed */
short iSeverity; /* the severity 0..7 */
short iFacility; /* Facility code 0 .. 23*/
short offAfterPRI; /* offset, at which raw message WITHOUT PRI part starts in pszRawMsg */
diff --git a/runtime/queue.c b/runtime/queue.c
index 76327f6a..ef6e843b 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -842,6 +842,7 @@ static rsRetVal qAddDirect(qqueue_t *pThis, void* pUsr)
{
batch_t singleBatch;
batch_obj_t batchObj;
+ int i;
DEFiRet;
//TODO: init batchObj (states _OK and new fields -- CHECK)
@@ -863,6 +864,10 @@ static rsRetVal qAddDirect(qqueue_t *pThis, void* pUsr)
singleBatch.nElem = 1; /* there always is only one in direct mode */
singleBatch.pElem = &batchObj;
iRet = pThis->pConsumer(pThis->pUsr, &singleBatch, &pThis->bShutdownImmediate);
+ /* delete the batch string params: TODO: create its own "class" for this */
+ for(i = 0 ; i < CONF_OMOD_NUMSTRINGS_MAXSIZE ; ++i) {
+ free(batchObj.staticActStrings[i]);
+ }
objDestruct(pUsr);
RETiRet;
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index 8162c752..f48c2c2d 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -171,35 +171,40 @@ processBatchMultiRuleset(batch_t *pBatch)
int i;
int iStart; /* start index of partial batch */
int iNew; /* index for new (temporary) batch */
+ int bHaveUnprocessed; /* do we (still) have unprocessed entries? (loop term predicate) */
DEFiRet;
- CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem));
- snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImmediate;
-
- while(1) { /* loop broken inside */
+ do {
+ bHaveUnprocessed = 0;
/* search for first unprocessed element */
for(iStart = 0 ; iStart < pBatch->nElem && pBatch->pElem[iStart].state == BATCH_STATE_DISC ; ++iStart)
/* just search, no action */;
-
if(iStart == pBatch->nElem)
- FINALIZE; /* everything processed */
+ break; /* everything processed */
/* prepare temporary batch */
+ CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem));
+ snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImmediate;
currRuleset = batchElemGetRuleset(pBatch, iStart);
iNew = 0;
for(i = iStart ; i < pBatch->nElem ; ++i) {
if(batchElemGetRuleset(pBatch, i) == currRuleset) {
- batchCopyElem(&(snglRuleBatch.pElem[iNew++]), &(pBatch->pElem[i]));
+ /* for performance reasons, we copy only those members that we actually need */
+ snglRuleBatch.pElem[iNew].pUsrp = pBatch->pElem[i].pUsrp;
+ snglRuleBatch.pElem[iNew].state = pBatch->pElem[i].state;
+ ++iNew;
/* We indicate the element also as done, so it will not be processed again */
pBatch->pElem[i].state = BATCH_STATE_DISC;
+ } else {
+ bHaveUnprocessed = 1;
}
}
snglRuleBatch.nElem = iNew; /* was left just right by the for loop */
batchSetSingleRuleset(&snglRuleBatch, 1);
/* process temp batch */
processBatch(&snglRuleBatch);
- }
- batchFree(&snglRuleBatch);
+ batchFree(&snglRuleBatch);
+ } while(bHaveUnprocessed == 1);
finalize_it:
RETiRet;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 44c1daa7..261a56c1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
if ENABLE_TESTBENCH
TESTRUNS = rt_init rscript
-check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller
+check_PROGRAMS = $(TESTRUNS) ourtail nettester tcpflood chkseq msleep randomgen diagtalker uxsockrcvr syslog_caller syslog_inject
TESTS = $(TESTRUNS) cfg.sh \
arrayqueue.sh \
linkedlistqueue.sh \
@@ -13,7 +13,6 @@ TESTS = $(TESTRUNS) cfg.sh \
rulesetmultiqueue.sh \
manytcp.sh \
rsf_getenv.sh \
- manyptcp.sh \
imtcp_conndrop.sh \
imtcp_addtlframedelim.sh \
sndrcv.sh \
@@ -37,7 +36,6 @@ TESTS = $(TESTRUNS) cfg.sh \
complex1.sh \
queue-persist.sh \
pipeaction.sh \
- uxsock_simple.sh \
execonlyonce.sh \
execonlywhenprevsuspended.sh \
execonlywhenprevsuspended2.sh \
@@ -46,15 +44,23 @@ TESTS = $(TESTRUNS) cfg.sh \
pipe_noreader.sh \
dircreate_dflt.sh \
dircreate_off.sh \
+ imuxsock_logger_root.sh \
+ imuxsock_traillf_root.sh \
+ imuxsock_ccmiddle_root.sh \
queue-persist.sh
if ENABLE_IMPTCP
TESTS += \
+ manyptcp.sh \
imptcp_large.sh \
imptcp_addtlframedelim.sh \
imptcp_conndrop.sh
endif
+if ENABLE_OMUXSOCK
+TESTS += uxsock_simple.sh
+endif
+
if ENABLE_OMUDPSPOOF
TESTS += sndrcv_omudpspoof.sh \
sndrcv_omudpspoof_nonstdpt.sh
@@ -316,6 +322,15 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/dircreate_dflt.conf \
dircreate_off.sh \
testsuites/dircreate_off.conf \
+ imuxsock_logger_root.sh \
+ testsuites/imuxsock_logger_root.conf \
+ resultdata/imuxsock_logger.log \
+ imuxsock_traillf_root.sh \
+ testsuites/imuxsock_traillf_root.conf \
+ resultdata/imuxsock_traillf.log \
+ imuxsock_ccmiddle_root.sh \
+ testsuites/imuxsock_ccmiddle_root.conf \
+ resultdata/imuxsock_ccmiddle.log \
cfg.sh
ourtail_SOURCES = ourtail.c
@@ -331,6 +346,9 @@ tcpflood_LDADD = $(SOL_LIBS) $(PTHREADS_LIBS)
syslog_caller_SOURCES = syslog_caller.c
syslog_caller_LDADD = $(SOL_LIBS)
+syslog_inject_SOURCES = syslog_inject.c
+syslog_inject_LDADD = $(SOL_LIBS)
+
diagtalker_SOURCES = diagtalker.c
diagtalker_LDADD = $(SOL_LIBS)
diff --git a/tests/imuxsock_ccmiddle_root.sh b/tests/imuxsock_ccmiddle_root.sh
new file mode 100755
index 00000000..b487611a
--- /dev/null
+++ b/tests/imuxsock_ccmiddle_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test
+echo \[imuxsock_ccmiddle_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_ccmiddle_root.conf
+# send a message with trailing LF
+./syslog_inject -c
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_ccmiddle.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_ccmiddle_root.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/imuxsock_logger_root.sh b/tests/imuxsock_logger_root.sh
new file mode 100755
index 00000000..377999f7
--- /dev/null
+++ b/tests/imuxsock_logger_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test.
+echo \[imuxsock_logger_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_logger_root.conf
+# send a message with trailing LF
+logger test
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_logger.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_logger.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/imuxsock_traillf_root.sh b/tests/imuxsock_traillf_root.sh
new file mode 100755
index 00000000..1b821ee7
--- /dev/null
+++ b/tests/imuxsock_traillf_root.sh
@@ -0,0 +1,18 @@
+# note: we must be root and no other syslogd running in order to
+# carry out this test
+echo \[imuxsock_traillf_root.sh\]: test trailing LF handling in imuxsock
+echo This test must be run as root with no other active syslogd
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup imuxsock_traillf_root.conf
+# send a message with trailing LF
+./syslog_inject -l
+# the sleep below is needed to prevent too-early termination of rsyslogd
+./msleep 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+cmp rsyslog.out.log $srcdir/resultdata/imuxsock_traillf.log
+if [ ! $? -eq 0 ]; then
+echo "imuxsock_traillf_root.sh failed"
+exit 1
+fi;
+source $srcdir/diag.sh exit
diff --git a/tests/resultdata/imuxsock_ccmiddle.log b/tests/resultdata/imuxsock_ccmiddle.log
new file mode 100644
index 00000000..d2531f9d
--- /dev/null
+++ b/tests/resultdata/imuxsock_ccmiddle.log
@@ -0,0 +1 @@
+ test 1#0112
diff --git a/tests/resultdata/imuxsock_logger.log b/tests/resultdata/imuxsock_logger.log
new file mode 100644
index 00000000..883dabdf
--- /dev/null
+++ b/tests/resultdata/imuxsock_logger.log
@@ -0,0 +1 @@
+ test
diff --git a/tests/resultdata/imuxsock_traillf.log b/tests/resultdata/imuxsock_traillf.log
new file mode 100644
index 00000000..883dabdf
--- /dev/null
+++ b/tests/resultdata/imuxsock_traillf.log
@@ -0,0 +1 @@
+ test
diff --git a/tests/syslog_inject.c b/tests/syslog_inject.c
new file mode 100644
index 00000000..a5d77b1a
--- /dev/null
+++ b/tests/syslog_inject.c
@@ -0,0 +1,28 @@
+/* This tool deliberately logs a message with the a trailing LF */
+/* Options:
+ * -l: inject linefeed at end of message
+ * -c: inject control character in middle of message
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <string.h>
+
+static inline void usage(void) {
+ fprintf(stderr, "Usage: syslog_inject [-l] [-c]\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ if(argc != 2)
+ usage();
+ if(!strcmp(argv[1], "-l"))
+ syslog(LOG_NOTICE, "test\n");
+ else if(!strcmp(argv[1], "-c"))
+ syslog(LOG_NOTICE, "test 1\t2");
+ else
+ usage();
+
+ return 0;
+}
diff --git a/tests/testsuites/imuxsock_ccmiddle_root.conf b/tests/testsuites/imuxsock_ccmiddle_root.conf
new file mode 100644
index 00000000..8336ecfa
--- /dev/null
+++ b/tests/testsuites/imuxsock_ccmiddle_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_logger_root.conf b/tests/testsuites/imuxsock_logger_root.conf
new file mode 100644
index 00000000..8336ecfa
--- /dev/null
+++ b/tests/testsuites/imuxsock_logger_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imuxsock_traillf_root.conf b/tests/testsuites/imuxsock_traillf_root.conf
new file mode 100644
index 00000000..8336ecfa
--- /dev/null
+++ b/tests/testsuites/imuxsock_traillf_root.conf
@@ -0,0 +1,7 @@
+# rgerhards, 2011-02-21
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imuxsock/.libs/imuxsock
+
+$template outfmt,"%msg:%\n"
+*.notice ./rsyslog.out.log;outfmt
diff --git a/tools/iminternal.c b/tools/iminternal.c
index 12534ba0..167e2b29 100644
--- a/tools/iminternal.c
+++ b/tools/iminternal.c
@@ -123,7 +123,6 @@ rsRetVal iminternalRemoveMsg(msg_t **ppMsg)
iminternal_t *pThis;
linkedListCookie_t llCookie = NULL;
- assert(pPri != NULL);
assert(ppMsg != NULL);
CHKiRet(llGetNextElt(&llMsgs, &llCookie, (void*)&pThis));
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 9d18ce7d..73995e68 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -696,7 +696,6 @@ msgConsumer(void __attribute__((unused)) *notNeeded, batch_t *pBatch, int *pbShu
assert(pBatch != NULL);
pBatch->pbShutdownImmediate = pbShutdownImmediate; /* TODO: move this to batch creation! */
preprocessBatch(pBatch);
-//pBatch->bSingleRuleset = 0; // TODO: testing aid, remove!!!!
ruleset.ProcessBatch(pBatch);
//TODO: the BATCH_STATE_COMM must be set somewhere down the road, but we
//do not have this yet and so we emulate -- 2010-06-10
@@ -2870,7 +2869,7 @@ int realMain(int argc, char **argv)
if(iCompatibilityMode < 4) {
errmsg.LogError(0, NO_ERRCODE, "WARNING: rsyslogd is running in compatibility mode. Automatically "
"generated config directives may interfer with your rsyslog.conf settings. "
- "We suggest upgrading your config and adding -c4 as the first "
+ "We suggest upgrading your config and adding -c5 as the first "
"rsyslogd option.");
}