diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-09-06 12:00:05 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-09-06 12:00:05 +0200 |
commit | 74b81c8c01b26a142793a4861340996ed956f5f6 (patch) | |
tree | 0a01b48d6bcc6a3fae57a0ed073e8a70f7fe9099 | |
parent | 0426ad7dd27fda6854f7d306e46331387b20947a (diff) | |
parent | 88faed212c045cd53671155bd4af8a606b08b706 (diff) | |
download | rsyslog-74b81c8c01b26a142793a4861340996ed956f5f6.tar.gz rsyslog-74b81c8c01b26a142793a4861340996ed956f5f6.tar.xz rsyslog-74b81c8c01b26a142793a4861340996ed956f5f6.zip |
Merge branch 'v6-stable' into v6-devel
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | runtime/netstrm.c | 2 | ||||
-rw-r--r-- | runtime/netstrm.h | 5 | ||||
-rw-r--r-- | runtime/nsd.h | 5 | ||||
-rw-r--r-- | runtime/nsd_gtls.c | 7 | ||||
-rw-r--r-- | runtime/nsd_ptcp.c | 6 | ||||
-rw-r--r-- | runtime/rsconf.c | 18 | ||||
-rw-r--r-- | tools/omfwd.c | 11 | ||||
-rw-r--r-- | tools/omusrmsg.c | 1 |
9 files changed, 56 insertions, 11 deletions
@@ -46,6 +46,18 @@ Version 6.4.1 [V6-STABLE] 2012-08-?? small risk that this may break some things that relied on the previous inconsistency. Thanks to Miloslav Trmač for the patch +- bugfix: omusrsmsg incorrect return state & config warning handling + During config file processing, Omusrmsg often incorrectly returned a + warning status, even when no warning was present (caused by + uninitialized variable). Also, the core handled warning messages + incorrectly, and treated them as errors. As a result, omusrmsg + (most often) could not properly be loaded. Note that this only + occurs with legacy config action syntax. This was a regression + caused by an incorrect merge in to the 6.3.x codebase. + Thanks to Stefano Mason for alerting us of this bug. +- bugfix: Fixed TCP CheckConnection handling in omfwd.c. Interface needed + to be changed in lower stream classes. Syslog TCP Sending is now resumed + properly. --------------------------------------------------------------------------- Version 6.4.0 [V6-STABLE] 2012-08-20 - THIS IS THE FIRST VERSION OF THE 6.4.x STABLE BRANCH diff --git a/runtime/netstrm.c b/runtime/netstrm.c index a6f840a5..49ba8f35 100644 --- a/runtime/netstrm.c +++ b/runtime/netstrm.c @@ -250,7 +250,7 @@ EnableKeepAlive(netstrm_t *pThis) /* check connection - slim wrapper for NSD driver function */ -static void +static rsRetVal CheckConnection(netstrm_t *pThis) { ISOBJ_TYPE_assert(pThis, netstrm); diff --git a/runtime/netstrm.h b/runtime/netstrm.h index f6931104..ee8d9e59 100644 --- a/runtime/netstrm.h +++ b/runtime/netstrm.h @@ -53,7 +53,7 @@ BEGINinterface(netstrm) /* name must also be changed in ENDinterface macro! */ rsRetVal (*SetDrvrMode)(netstrm_t *pThis, int iMode); rsRetVal (*SetDrvrAuthMode)(netstrm_t *pThis, uchar*); rsRetVal (*SetDrvrPermPeers)(netstrm_t *pThis, permittedPeers_t*); - void (*CheckConnection)(netstrm_t *pThis); /* This is a trick mostly for plain tcp syslog */ + rsRetVal (*CheckConnection)(netstrm_t *pThis); /* This is a trick mostly for plain tcp syslog */ /* the GetSock() below is a hack to make imgssapi work. In the long term, * we should migrate imgssapi to a stream driver, which will relieve us of * this problem. Please note that nobody else should use GetSock(). Using it @@ -72,9 +72,10 @@ BEGINinterface(netstrm) /* name must also be changed in ENDinterface macro! */ /* v4 */ rsRetVal (*EnableKeepAlive)(netstrm_t *pThis); ENDinterface(netstrm) -#define netstrmCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */ +#define netstrmCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */ /* interface version 3 added GetRemAddr() * interface version 4 added EnableKeepAlive() -- rgerhards, 2009-06-02 + * interface version 5 changed return of CheckConnection from void to rsRetVal -- alorbach, 2012-09-06 * */ /* prototypes */ diff --git a/runtime/nsd.h b/runtime/nsd.h index ab64c443..d7d6abbd 100644 --- a/runtime/nsd.h +++ b/runtime/nsd.h @@ -63,7 +63,7 @@ BEGINinterface(nsd) /* name must also be changed in ENDinterface macro! */ rsRetVal (*SetMode)(nsd_t *pThis, int mode); /* sets a driver specific mode - see driver doc for details */ rsRetVal (*SetAuthMode)(nsd_t *pThis, uchar*); /* sets a driver specific mode - see driver doc for details */ rsRetVal (*SetPermPeers)(nsd_t *pThis, permittedPeers_t*); /* sets driver permitted peers for auth needs */ - void (*CheckConnection)(nsd_t *pThis); /* This is a trick mostly for plain tcp syslog */ + rsRetVal (*CheckConnection)(nsd_t *pThis); /* This is a trick mostly for plain tcp syslog */ rsRetVal (*GetSock)(nsd_t *pThis, int *pSock); rsRetVal (*SetSock)(nsd_t *pThis, int sock); /* GetSock() and SetSock() return an error if the driver does not use plain @@ -80,9 +80,10 @@ BEGINinterface(nsd) /* name must also be changed in ENDinterface macro! */ /* v5 */ rsRetVal (*EnableKeepAlive)(nsd_t *pThis); ENDinterface(nsd) -#define nsdCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */ +#define nsdCURR_IF_VERSION 6 /* increment whenever you change the interface structure! */ /* interface version 4 added GetRemAddr() * interface version 5 added EnableKeepAlive() -- rgerhards, 2009-06-02 + * interface version 6 changed return of CheckConnection from void to rsRetVal -- alorbach, 2012-09-06 */ /* interface for the select call */ diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index c2db9c94..71eafbd2 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -1316,13 +1316,16 @@ finalize_it: * This is a dummy here. For details, check function common in ptcp driver. * rgerhards, 2008-06-09 */ -static void +static rsRetVal CheckConnection(nsd_t __attribute__((unused)) *pNsd) { + DEFiRet; nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd; ISOBJ_TYPE_assert(pThis, nsd_gtls); - nsd_ptcp.CheckConnection(pThis->pTcp); + CHKiRet(nsd_ptcp.CheckConnection(pThis->pTcp)); +finalize_it: + RETiRet; } diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c index a174899c..12f891ea 100644 --- a/runtime/nsd_ptcp.c +++ b/runtime/nsd_ptcp.c @@ -694,9 +694,10 @@ finalize_it: * http://blog.gerhards.net/2008/06/getting-bit-more-reliability-from-plain.html * rgerhards, 2008-06-09 */ -static void +static rsRetVal CheckConnection(nsd_t *pNsd) { + DEFiRet; int rc; char msgbuf[1]; /* dummy */ nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd; @@ -709,7 +710,10 @@ CheckConnection(nsd_t *pNsd) * need to close our side, too. */ sockClose(&pThis->sock); + ABORT_FINALIZE(RS_RET_IO_ERROR); } +finalize_it: + RETiRet; } diff --git a/runtime/rsconf.c b/runtime/rsconf.c index 5d2407ec..032d01a3 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -248,6 +248,7 @@ cnfDoActlst(struct cnfactlst *actlst, rule_t *pRule) struct cnfcfsyslinelst *cflst; action_t *pAction; uchar *str; + rsRetVal localRet; DEFiRet; while(actlst != NULL) { @@ -261,9 +262,22 @@ cnfDoActlst(struct cnfactlst *actlst, rule_t *pRule) "around line %d", actlst->cnfFile, actlst->lineno); } } else { - dbgprintf("legacy action line:%s\n", actlst->data.legActLine); + DBGPRINTF("legacy action line:%s\n", actlst->data.legActLine); str = (uchar*) actlst->data.legActLine; - CHKiRet(cflineDoAction(loadConf, &str, &pAction)); + if((localRet = cflineDoAction(loadConf, &str, &pAction)) != RS_RET_OK) { + uchar szErrLoc[MAXFNAME + 64]; + if(localRet != RS_RET_OK_WARN) { + DBGPRINTF("legacy action line NOT successfully processed\n"); + } + snprintf((char*)szErrLoc, sizeof(szErrLoc) / sizeof(uchar), + "%s, line %d", actlst->cnfFile, actlst->lineno); + errmsg.LogError(0, NO_ERRCODE, "the last %s occured in %s:\"%s\"", + (localRet == RS_RET_OK_WARN) ? "warning" : "error", + (char*)szErrLoc, (char*)actlst->data.legActLine); + if(localRet != RS_RET_OK_WARN) { + ABORT_FINALIZE(localRet); + } + } iRet = llAppend(&(pRule)->llActList, NULL, (void*) pAction); } for( cflst = actlst->syslines diff --git a/tools/omfwd.c b/tools/omfwd.c index 155e00d1..2fd24bdf 100644 --- a/tools/omfwd.c +++ b/tools/omfwd.c @@ -436,7 +436,7 @@ TCPSendBuf(instanceData *pData, uchar *buf, unsigned len) ssize_t lenSend; alreadySent = 0; - netstrm.CheckConnection(pData->pNetstrm); /* hack for plain tcp syslog - see ptcp driver for details */ + CHKiRet(netstrm.CheckConnection(pData->pNetstrm)); /* hack for plain tcp syslog - see ptcp driver for details */ while(alreadySent != len) { lenSend = len - alreadySent; CHKiRet(netstrm.Send(pData->pNetstrm, buf+alreadySent, &lenSend)); @@ -445,6 +445,12 @@ TCPSendBuf(instanceData *pData, uchar *buf, unsigned len) } finalize_it: + if(iRet != RS_RET_OK) { + /* error! */ + dbgprintf("TCPSendBuf error %d, destruct TCP Connection!\n", iRet); + DestructTCPInstanceData(pData); + iRet = RS_RET_SUSPENDED; + } RETiRet; } @@ -489,6 +495,7 @@ static rsRetVal TCPSendPrepRetry(void *pvData) { DEFiRet; instanceData *pData = (instanceData *) pvData; +dbgprintf("TCPSendPrepRetry performs a DestructTCPInstanceData\n"); assert(pData != NULL); DestructTCPInstanceData(pData); @@ -506,6 +513,7 @@ static rsRetVal TCPSendInit(void *pvData) assert(pData != NULL); if(pData->pNetstrm == NULL) { + dbgprintf("TCPSendInit CREATE\n"); CHKiRet(netstrms.Construct(&pData->pNS)); /* the stream driver must be set before the object is finalized! */ CHKiRet(netstrms.SetDrvrName(pData->pNS, pData->pszStrmDrvr)); @@ -529,6 +537,7 @@ static rsRetVal TCPSendInit(void *pvData) finalize_it: if(iRet != RS_RET_OK) { + dbgprintf("TCPSendInit FAILED with %d.\n", iRet); DestructTCPInstanceData(pData); } diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c index e57d7ef9..a7df9243 100644 --- a/tools/omusrmsg.c +++ b/tools/omusrmsg.c @@ -385,6 +385,7 @@ BEGINparseSelectorAct int bHadWarning; CODESTARTparseSelectorAct CODE_STD_STRING_REQUESTparseSelectorAct(1) + bHadWarning = 0; if(!strncmp((char*) p, ":omusrmsg:", sizeof(":omusrmsg:") - 1)) { p += sizeof(":omusrmsg:") - 1; /* eat indicator sequence (-1 because of '\0'!) */ } else { |