From 5552202b01fd4f472d23aa50db6614ec2fe9c68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 25 Sep 2012 13:52:41 +0200 Subject: Fix crash when date properties are used without a template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. in > set $!time = $timereported; > set $!time_rcvd = $timegenerated; pTpe is set to NULL by the caller. (Is "default" the correct format to use?) Signed-off-by: Miloslav Trmač --- runtime/msg.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/runtime/msg.c b/runtime/msg.c index d3c814e2..d874178b 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2698,6 +2698,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, uchar *pBuf; int iLen; short iOffs; + enum tplFormatTypes datefmt; BEGINfunc assert(pMsg != NULL); @@ -2717,7 +2718,11 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, bufLen = getMSGLen(pMsg); break; case PROP_TIMESTAMP: - pRes = (uchar*)getTimeReported(pMsg, pTpe->data.field.eDateFormat); + if (pTpe != NULL) + datefmt = pTpe->data.field.eDateFormat; + else + datefmt = tplFmtDefault; + pRes = (uchar*)getTimeReported(pMsg, datefmt); break; case PROP_HOSTNAME: pRes = (uchar*)getHOSTNAME(pMsg); @@ -2767,7 +2772,11 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, pRes = (uchar*)getSeverityStr(pMsg); break; case PROP_TIMEGENERATED: - pRes = (uchar*)getTimeGenerated(pMsg, pTpe->data.field.eDateFormat); + if (pTpe != NULL) + datefmt = pTpe->data.field.eDateFormat; + else + datefmt = tplFmtDefault; + pRes = (uchar*)getTimeGenerated(pMsg, datefmt); break; case PROP_PROGRAMNAME: pRes = getProgramName(pMsg, LOCK_MUTEX); -- cgit v1.2.3 From 17c15234a3ba9c094ec5a48ca0ab34a0d1df0ed6 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 11 Oct 2012 18:12:46 +0200 Subject: doc: add last patch to ChangeLog --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8cb054d7..2a17fa0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 7.1.11 [beta] 2012-10-?? +- bugfix: do not crash if set statement is used with date field + Thanks to Miloslav Trmač for the patch. - added deprecated note to omruleset (plus clue to use "call") - added deprecated note to discard action (plus clue to use "stop") --------------------------------------------------------------------------- -- cgit v1.2.3 From 829b0639a08a0194efd673b7e0166f385a3dacd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 26 Sep 2012 00:04:10 +0200 Subject: Don't require the trailing space in @cee: cookie The only mention of @cee: in the Lumberjack pages, https://fedorahosted.org/lumberjack/wiki/FieldList doesn't have a space, and libumberlog does not in fact generate one. --- plugins/mmjsonparse/mmjsonparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mmjsonparse/mmjsonparse.c b/plugins/mmjsonparse/mmjsonparse.c index 68f5e74c..da5cfb51 100644 --- a/plugins/mmjsonparse/mmjsonparse.c +++ b/plugins/mmjsonparse/mmjsonparse.c @@ -138,7 +138,7 @@ finalize_it: RETiRet; } -#define COOKIE "@cee: " +#define COOKIE "@cee:" #define LEN_COOKIE (sizeof(COOKIE)-1) BEGINdoAction msg_t *pMsg; -- cgit v1.2.3 From b8916d5cf10130b34ba8982a88d912e9f3f1e1c4 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 11 Oct 2012 18:21:57 +0200 Subject: change lumberjack cookie to "@cee" from "@cee " MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CEE originally specified the cookie with SP, whereas other lumberjack tools used it without space. In order to keep interop with lumberjack, we now use the cookie without space as well. I hope this can be changed in CEE as well when it is released at a later time. Thanks to Miloslav Trmač for pointing this out and a similiar v7 patch. --- ChangeLog | 6 ++++++ plugins/mmjsonparse/mmjsonparse.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e30c49ba..db39911f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ --------------------------------------------------------------------------- Version 6.4.3 [V6-STABLE] 2012-??-?? +- change lumberjack cookie to "@cee" from "@cee " + CEE originally specified the cookie with SP, whereas other lumberjack + tools used it without space. In order to keep interop with lumberjack, + we now use the cookie without space as well. I hope this can be changed + in CEE as well when it is released at a later time. + Thanks to Miloslav Trmač for pointing this out and a similiar v7 patch. - bugfix: comments inside objects (e.g. action()) were not properly handled - bugfix: sysklogd-emulating standard template was no longer present in v6 This was obviously lost during the transition to the new config format. diff --git a/plugins/mmjsonparse/mmjsonparse.c b/plugins/mmjsonparse/mmjsonparse.c index 03147b59..111ecc2f 100644 --- a/plugins/mmjsonparse/mmjsonparse.c +++ b/plugins/mmjsonparse/mmjsonparse.c @@ -99,7 +99,7 @@ BEGINtryResume CODESTARTtryResume ENDtryResume -#define COOKIE "@cee: " +#define COOKIE "@cee:" #define LEN_COOKIE (sizeof(COOKIE)-1) BEGINdoAction msg_t *pMsg; -- cgit v1.2.3