From 702140afad013a94450397f72fe1a5452178ee1b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 4 Sep 2008 14:18:42 +0200 Subject: bugfix: error code -2025 was used for two different errors. Queue full is now -2074 and -2025 is unique again. (did cause no real problem except for troubleshooting) --- ChangeLog | 3 +++ rsyslog.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7b24ac20..a967f4a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ Version 3.18.4 (rgerhards), 2008-09-?? patch. - doc bugfix: rsyslog.conf man page improved and minor nit fixed thanks to Lukas Kuklinek for the patch. +- bugfix: error code -2025 was used for two different errors. queue full + is now -2074 and -2025 is unique again. (did cause no real problem + except for troubleshooting) --------------------------------------------------------------------------- Version 3.18.3 (rgerhards), 2008-08-18 - bugfix: imfile could cause a segfault upon rsyslogd HUP and termination diff --git a/rsyslog.h b/rsyslog.h index c73c659c..88429631 100644 --- a/rsyslog.h +++ b/rsyslog.h @@ -123,7 +123,6 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_GSS_SEND_ERROR = -2024, /**< error during GSS (via TCP) send process */ RS_RET_TCP_SOCKCREATE_ERR = -2025, /**< error during creation of TCP socket */ RS_RET_GSS_SENDINIT_ERROR = -2024, /**< error during GSS (via TCP) send initialization process */ - RS_RET_QUEUE_FULL = -2025, /**< queue is full, operation could not be completed */ RS_RET_EOF = -2026, /**< end of file reached, not necessarily an error */ RS_RET_IO_ERROR = -2027, /**< some kind of IO error happened */ RS_RET_INVALID_OID = -2028, /**< invalid object ID */ @@ -172,6 +171,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_MAIL_NO_TO = -2071, /**< recipient for mail destination is missing */ RS_RET_MAIL_NO_FROM = -2072, /**< sender for mail destination is missing */ RS_RET_INVALID_PRI = -2073, /**< PRI value is invalid */ + RS_RET_QUEUE_FULL = -2074, /**< queue is full, operation could not be completed */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ -- cgit v1.2.3 From 8cb83af1118b633d88cd01fefe2571e91918a9f9 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 10 Sep 2008 08:14:12 +0200 Subject: bugfix: incorrect default discard severity could cause message loss default discard severity was incorrectly set to 4, which lead to discard-on-queue-full to be enabled by default. That could cause message loss where non was expected. The default has now been changed to the correct value of 8, which disables the functionality. This problem applied both to the main message queue and the action queues. Thanks to Raoul Bhatia for pointing out this problem. --- ChangeLog | 6 ++++++ action.c | 2 +- syslogd.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a967f4a7..1534f36b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,12 @@ Version 3.18.4 (rgerhards), 2008-09-?? - bugfix: error code -2025 was used for two different errors. queue full is now -2074 and -2025 is unique again. (did cause no real problem except for troubleshooting) +- bugfix: default discard severity was incorrectly set to 4, which lead + to discard-on-queue-full to be enabled by default. That could cause + message loss where non was expected. The default has now been changed + to the correct value of 8, which disables the functionality. This + problem applied both to the main message queue and the action queues. + Thanks to Raoul Bhatia for pointing out this problem. --------------------------------------------------------------------------- Version 3.18.3 (rgerhards), 2008-08-18 - bugfix: imfile could cause a segfault upon rsyslogd HUP and termination diff --git a/action.c b/action.c index 8b47f541..5de16b23 100644 --- a/action.c +++ b/action.c @@ -105,7 +105,7 @@ actionResetQueueParams(void) iActionQHighWtrMark = 800; /* high water mark for disk-assisted queues */ iActionQLowWtrMark = 200; /* low water mark for disk-assisted queues */ iActionQDiscardMark = 9800; /* begin to discard messages */ - iActionQDiscardSeverity = 4; /* discard warning and above */ + iActionQDiscardSeverity = 8; /* discard warning and above */ iActionQueueNumWorkers = 1; /* number of worker threads for the mm queue above */ iActionQueMaxFileSize = 1024*1024; iActionQPersistUpdCnt = 0; /* persist queue info every n updates */ diff --git a/syslogd.c b/syslogd.c index 26a15293..d90ead7f 100644 --- a/syslogd.c +++ b/syslogd.c @@ -399,7 +399,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a iMainMsgQHighWtrMark = 8000; iMainMsgQLowWtrMark = 2000; iMainMsgQDiscardMark = 9800; - iMainMsgQDiscardSeverity = 4; + iMainMsgQDiscardSeverity = 8; iMainMsgQueMaxFileSize = 1024 * 1024; iMainMsgQueueNumWorkers = 1; iMainMsgQPersistUpdCnt = 0; -- cgit v1.2.3 From 7ad8addeb5b16669d67492188cb18646dd562484 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Wed, 10 Sep 2008 11:53:34 +0200 Subject: bugfix: option value for legacy -a option could not be specified resulting in strange operations. Signed-off-by: Rainer Gerhards --- ChangeLog | 3 +++ syslogd.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1534f36b..35041e63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,9 @@ Version 3.18.4 (rgerhards), 2008-09-?? to the correct value of 8, which disables the functionality. This problem applied both to the main message queue and the action queues. Thanks to Raoul Bhatia for pointing out this problem. +- bugfix: option value for legacy -a option could not be specified, + resulting in strange operations. Thanks to Marius Tomaschewski + for the patch. --------------------------------------------------------------------------- Version 3.18.3 (rgerhards), 2008-08-18 - bugfix: imfile could cause a segfault upon rsyslogd HUP and termination diff --git a/syslogd.c b/syslogd.c index d90ead7f..a5483d80 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3075,7 +3075,7 @@ int realMain(int argc, char **argv) * only when actually neeeded. * rgerhards, 2008-04-04 */ - while ((ch = getopt(argc, argv, "46aAc:def:g:hi:l:m:M:nopqQr::s:t:u:vwx")) != EOF) { + while ((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nopqQr::s:t:u:vwx")) != EOF) { switch((char)ch) { case '4': case '6': -- cgit v1.2.3 From 920cc1e1640a7a01145111530106cf96a60b6086 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Sep 2008 14:20:47 +0200 Subject: bugfix: colon after date should be ignored, but was not. This has now been corrected. Required change to the internal ParseTIMESTAMP3164() interface. --- ChangeLog | 3 +++ datetime.c | 17 ++++++++++++++--- datetime.h | 10 ++++++++-- syslogd.c | 13 +++++++++---- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35041e63..5491c407 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,9 @@ Version 3.18.4 (rgerhards), 2008-09-?? - bugfix: option value for legacy -a option could not be specified, resulting in strange operations. Thanks to Marius Tomaschewski for the patch. +- bugfix: colon after date should be ignored, but was not. This has + now been corrected. Required change to the internal ParseTIMESTAMP3164() + interface. --------------------------------------------------------------------------- Version 3.18.3 (rgerhards), 2008-08-18 - bugfix: imfile could cause a segfault upon rsyslogd HUP and termination diff --git a/datetime.c b/datetime.c index a4817a6d..a178d14c 100644 --- a/datetime.c +++ b/datetime.c @@ -265,10 +265,14 @@ ParseTIMESTAMP3339(struct syslogTime *pTime, char** ppszTS) * Returns TRUE on parse OK, FALSE on parse error. */ static int -ParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS) +ParseTIMESTAMP3164(struct syslogTime *pTime, char** ppszTS) { - assert(pTime != NULL); + char *pszTS; + + assert(ppszTS != NULL); + pszTS = *ppszTS; assert(pszTS != NULL); + assert(pTime != NULL); getCurrTime(pTime); /* obtain the current year and UTC offsets! */ @@ -435,13 +439,20 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS) pTime->second = srSLMGParseInt32(&pszTS); if(pTime->second < 0 || pTime->second > 60) return FALSE; - if(*pszTS++ != ':') + + /* we provide support for an exter ":" after the date. While this is an + * invalid format, it occurs frequently enough (e.g. with Cisco devices) + * to permit it as a valid case. -- rgerhards, 2008-09-12 + */ + if(*pszTS++ == ':') + ++pszTS; /* OK, we actually have a 3164 timestamp, so let's indicate this * and fill the rest of the properties. */ pTime->timeType = 1; pTime->secfracPrecision = 0; pTime->secfrac = 0; + *ppszTS = pszTS; /* provide updated parse position back to caller */ return TRUE; } diff --git a/datetime.h b/datetime.h index a35dfe8a..9e115583 100644 --- a/datetime.h +++ b/datetime.h @@ -37,13 +37,19 @@ BEGINinterface(datetime) /* name must also be changed in ENDinterface macro! */ void (*getCurrTime)(struct syslogTime *t); //static int srSLMGParseInt32(char** ppsz); int (*ParseTIMESTAMP3339)(struct syslogTime *pTime, char** ppszTS); - int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char* pszTS); + int (*ParseTIMESTAMP3164)(struct syslogTime *pTime, char** pszTS); int (*formatTimestampToMySQL)(struct syslogTime *ts, char* pDst, size_t iLenDst); int (*formatTimestampToPgSQL)(struct syslogTime *ts, char *pDst, size_t iLenDst); int (*formatTimestamp3339)(struct syslogTime *ts, char* pBuf, size_t iLenBuf); int (*formatTimestamp3164)(struct syslogTime *ts, char* pBuf, size_t iLenBuf); ENDinterface(datetime) -#define datetimeCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */ +#define datetimeCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */ +/* interface changes: + * 1 - initial version + * 2 - not compatible to 1 - bugfix required ParseTIMESTAMP3164 to accept char ** as + * last parameter. Did not try to remain compatible as this is not something any + * third-party module should call. -- rgerhards, 2008.-09-12 + */ /* prototypes */ PROTOTYPEObj(datetime); diff --git a/syslogd.c b/syslogd.c index a5483d80..6855a8a5 100644 --- a/syslogd.c +++ b/syslogd.c @@ -1392,13 +1392,18 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) */ if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) { /* we are done - parse pointer is moved by ParseTIMESTAMP3339 */; - } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), p2parse) == TRUE) { - p2parse += 16; + } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) { + /* we are done - parse pointer is moved by ParseTIMESTAMP3164 */; } else if(*p2parse == ' ') { /* try to see if it is slighly malformed - HP procurve seems to do that sometimes */ - if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), p2parse+1) == TRUE) { + ++p2parse; /* move over space */ + if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == TRUE) { /* indeed, we got it! */ - p2parse += 17; + /* we are done - parse pointer is moved by ParseTIMESTAMP3164 */; } else { + /* parse pointer needs to be restored, as we moved it off-by-one + * for this try. + */ + --p2parse; flags |= ADDDATE; } } else { -- cgit v1.2.3 From 4bc99a5ead6892393033d22d6ce46052aca36155 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Sep 2008 14:46:16 +0200 Subject: bugfix: copy&paste error lead to dangling if this caused a very minor issue with re-formatting a RFC3164 date when the message was invalidly formatted and had a colon immediately after the date. This was in the code for some years (even v1 had it) and I think it never had any effect at all in practice. Though, it should be fixed - but definitely nothing to worry about. --- ChangeLog | 8 ++++++++ syslogd.c | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1db933ff..730f65bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ --------------------------------------------------------------------------- +Version 2.0.6 V2-STABLE (rgerhards), 2008-??-?? +- bugfix: copy&paste error lead to dangling if - this caused a very minor + issue with re-formatting a RFC3164 date when the message was invalidly + formatted and had a colon immediately after the date. This was in the + code for some years (even v1 had it) and I think it never had any + effect at all in practice. Though, it should be fixed - but definitely + nothing to worry about. +--------------------------------------------------------------------------- Version 2.0.6 V2-STABLE (rgerhards), 2008-08-07 - bugfix: IPv6 addresses could not be specified in forwarding actions New syntax @[addr]:port introduced to enable that. Root problem was IPv6 diff --git a/syslogd.c b/syslogd.c index a039eeed..afcc3b92 100644 --- a/syslogd.c +++ b/syslogd.c @@ -1417,7 +1417,6 @@ static int srSLMGParseTIMESTAMP3164(struct syslogTime *pTime, char* pszTS) pTime->second = srSLMGParseInt32(&pszTS); if(pTime->second < 0 || pTime->second > 60) return FALSE; - if(*pszTS++ != ':') /* OK, we actually have a 3164 timestamp, so let's indicate this * and fill the rest of the properties. */ -- cgit v1.2.3 From 4e86efaf0e20626d8f740fcff131bfd38453de4d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Sep 2008 15:15:28 +0200 Subject: fixed duplicate error number This probably happened during a branch merge and was not detected. Fixed now, should not haved any harm. --- runtime/rsyslog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index 8843df85..7927af3a 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -219,7 +219,6 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_MAIL_NO_FROM = -2072, /**< sender for mail destination is missing */ RS_RET_INVALID_PRI = -2073, /**< PRI value is invalid */ RS_RET_MALICIOUS_HNAME = -2074, /**< remote peer is trying malicious things with its hostname */ - RS_RET_ACCEPT_ERR = -2074, /**< error during accept() system call */ RS_RET_INVALID_HNAME = -2075, /**< remote peer's hostname invalid or unobtainable */ RS_RET_INVALID_PORT = -2076, /**< invalid port value */ RS_RET_COULD_NOT_BIND = -2077, /**< could not bind socket, defunct */ @@ -248,6 +247,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_GSS_ERR = -2101, /**< generic error occured in GSSAPI subsystem */ RS_RET_CERTLESS = -2102, /**< state: we run without machine cert (this may be OK) */ RS_RET_QUEUE_FULL = -2103, /**< queue is full, operation could not be completed */ + RS_RET_ACCEPT_ERR = -2104, /**< error during accept() system call */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ -- cgit v1.2.3