|
|
f656cf |
From c49e42f4f8381fc8e92579c41cefb2c85fe45929 Mon Sep 17 00:00:00 2001
|
|
|
f656cf |
From: Rainer Gerhards <rgerhards@adiscon.com>
|
|
|
f656cf |
Date: Tue, 7 Feb 2017 13:09:40 +0100
|
|
|
f656cf |
Subject: [PATCH] core: fix sequence error in msg object deserializer
|
|
|
f656cf |
|
|
|
f656cf |
Corruption of disk queue (or disk part of DA queue) always happens if
|
|
|
f656cf |
the "json" property (message variables) is present and "structured-data"
|
|
|
f656cf |
property is also present. This causes rsyslog to serialize to the
|
|
|
f656cf |
queue in wrong property sequence, which will lead to error -2308 on
|
|
|
f656cf |
deserialization.
|
|
|
f656cf |
|
|
|
f656cf |
Seems to be a long-standing bug. Depending on version used, some or
|
|
|
f656cf |
all messages in disk queue may be lost.
|
|
|
f656cf |
|
|
|
f656cf |
closes https://github.com/rsyslog/rsyslog/issues/1404
|
|
|
f656cf |
---
|
|
|
f656cf |
runtime/msg.c | 14 ++++++++------
|
|
|
f656cf |
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
f656cf |
|
|
|
f656cf |
diff --git a/runtime/msg.c b/runtime/msg.c
|
|
|
f656cf |
index 7cfeca843..cfa95517e 100644
|
|
|
f656cf |
--- a/runtime/msg.c
|
|
|
f656cf |
+++ b/runtime/msg.c
|
|
|
f656cf |
@@ -1350,6 +1350,11 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
|
|
|
f656cf |
reinitVar(pVar);
|
|
|
f656cf |
CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
f656cf |
}
|
|
|
f656cf |
+ if(isProp("pszStrucData")) {
|
|
|
f656cf |
+ MsgSetStructuredData(pMsg, (char*) rsCStrGetSzStrNoNULL(pVar->val.pStr));
|
|
|
f656cf |
+ reinitVar(pVar);
|
|
|
f656cf |
+ CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
f656cf |
+ }
|
|
|
f656cf |
if(isProp("json")) {
|
|
|
f656cf |
tokener = json_tokener_new();
|
|
|
f656cf |
pMsg->json = json_tokener_parse_ex(tokener, (char*)rsCStrGetSzStrNoNULL(pVar->val.pStr),
|
|
|
f656cf |
@@ -1366,11 +1371,6 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
|
|
|
f656cf |
reinitVar(pVar);
|
|
|
f656cf |
CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
f656cf |
}
|
|
|
f656cf |
- if(isProp("pszStrucData")) {
|
|
|
f656cf |
- MsgSetStructuredData(pMsg, (char*) rsCStrGetSzStrNoNULL(pVar->val.pStr));
|
|
|
f656cf |
- reinitVar(pVar);
|
|
|
f656cf |
- CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
f656cf |
- }
|
|
|
f656cf |
if(isProp("pCSAPPNAME")) {
|
|
|
f656cf |
MsgSetAPPNAME(pMsg, (char*) rsCStrGetSzStrNoNULL(pVar->val.pStr));
|
|
|
f656cf |
reinitVar(pVar);
|
|
|
f656cf |
@@ -1401,8 +1401,10 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
|
|
|
f656cf |
* but on the other hand it works decently AND we will probably replace
|
|
|
f656cf |
* the whole persisted format soon in any case. -- rgerhards, 2012-11-06
|
|
|
f656cf |
*/
|
|
|
f656cf |
- if(!isProp("offMSG"))
|
|
|
f656cf |
+ if(!isProp("offMSG")) {
|
|
|
f656cf |
+ DBGPRINTF("error property: %s\n", rsCStrGetSzStrNoNULL(pVar->pcsName));
|
|
|
f656cf |
ABORT_FINALIZE(RS_RET_DS_PROP_SEQ_ERR);
|
|
|
f656cf |
+ }
|
|
|
f656cf |
MsgSetMSGoffs(pMsg, pVar->val.num);
|
|
|
f656cf |
finalize_it:
|
|
|
f656cf |
if(pVar != NULL)
|