diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | plugins/imuxsock/imuxsock.c | 5 | ||||
-rw-r--r-- | runtime/msg.c | 11 | ||||
-rw-r--r-- | template.h | 2 |
4 files changed, 22 insertions, 4 deletions
@@ -1,4 +1,12 @@ --------------------------------------------------------------------------- +Version 7.1.1 [devel] 2012-09-?? +- imuxsock now stores trusted properties by default in the CEE root + This was done in order to keep compatible with other implementations of + the lumberjack schema + Thanks to Miloslav Trmač for pointing to this. +- bugfix: string-generating templates caused abort if CEE field could not + be found +--------------------------------------------------------------------------- Version 7.1.0 [devel] 2012-09-06 - added support for hierarchical properties (CEE/lumberjack) - added pure JSON output plugin parameter passing mode diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index 61ce857c..bb0e998f 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -879,7 +879,10 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim parse++; lenMsg--; /* '>' */ if(json != NULL) { - msgAddJSON(pMsg, (uchar*)"!trusted", json); + /* as per lumberjack spec, these properties need to go into + * the CEE root. + */ + msgAddJSON(pMsg, (uchar*)"!", json); } if(ts == NULL) { diff --git a/runtime/msg.c b/runtime/msg.c index afc79042..f1f7997c 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2434,10 +2434,15 @@ dbgprintf("AAAA: leaf '%s'\n", leaf); CHKiRet(jsonPathFindParent(pM, name, leaf, &parent, 1)); field = json_object_object_get(parent, (char*)leaf); } - *pRes = (uchar*) strdup(json_object_get_string(field)); + if(field == 0) { + *pRes = (uchar*) ""; + *pbMustBeFreed = 0; + } else { + *pRes = (uchar*) strdup(json_object_get_string(field)); dbgprintf("AAAA: json_object_get_string() returns '%s'\n", *pRes); - *buflen = (int) ustrlen(*pRes); - *pbMustBeFreed = 1; + *buflen = (int) ustrlen(*pRes); + *pbMustBeFreed = 1; + } finalize_it: free(name); @@ -30,6 +30,7 @@ #ifndef TEMPLATE_H_INCLUDED #define TEMPLATE_H_INCLUDED 1 +#include <json/json.h> #include <libestr.h> #include "regexp.h" #include "stringbuf.h" @@ -147,6 +148,7 @@ rsRetVal ExtendBuf(uchar **pBuf, size_t *pLenBuf, size_t iMinSize); */ rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr); rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar** ppSz, size_t *); +rsRetVal tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **); rsRetVal doEscape(uchar **pp, size_t *pLen, unsigned short *pbMustBeFreed, int escapeMode); rsRetVal templateInit(); |