Blame SOURCES/rsyslog-7.4.7-rhbz743890-imjournal-sanitize-msgs.patch

fffb44
From 177a4863f016fae5640fffd6b6ff8f86b5ffee3a Mon Sep 17 00:00:00 2001
fffb44
From: Tomas Heinrich <theinric@redhat.com>
fffb44
Date: Mon, 28 Jul 2014 18:39:06 +0200
fffb44
Subject: [PATCH] imjournal: sanitize messages as imuxsock does it
fffb44
fffb44
This change makes these directives available for imjournal:
fffb44
  $ControlCharacterEscapePrefix
fffb44
  $DropTrailingLFOnReception
fffb44
  $Escape8bitCharactersOnReceive
fffb44
  $EscapeControlCharacterTab
fffb44
  $EscapeControlCharactersOnReceive
fffb44
  $SpaceNLOnReceive
fffb44
---
fffb44
 plugins/imjournal/imjournal.c | 10 +++++++++-
fffb44
 1 file changed, 9 insertions(+), 1 deletion(-)
fffb44
fffb44
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
fffb44
index 7d42b84..b0b034c 100755
fffb44
--- a/plugins/imjournal/imjournal.c
fffb44
+++ b/plugins/imjournal/imjournal.c
fffb44
@@ -44,6 +44,7 @@
fffb44
 #include "imjournal.h"
fffb44
 #include "net.h"
fffb44
 #include "glbl.h"
fffb44
+#include "parser.h"
fffb44
 #include "prop.h"
fffb44
 #include "errmsg.h"
fffb44
 #include "srUtils.h"
fffb44
@@ -58,6 +59,7 @@ MODULE_CNFNAME("imjournal")
fffb44
 DEF_IMOD_STATIC_DATA
fffb44
 DEFobjCurrIf(datetime)
fffb44
 DEFobjCurrIf(glbl)
fffb44
+DEFobjCurrIf(parser)
fffb44
 DEFobjCurrIf(prop)
fffb44
 DEFobjCurrIf(net)
fffb44
 DEFobjCurrIf(errmsg)
fffb44
@@ -142,6 +144,7 @@ enqMsg(uchar *msg, uchar *pszTag, int iFacility, int iSeverity, struct timeval *
fffb44
 {
fffb44
 	struct syslogTime st;
fffb44
 	msg_t *pMsg;
fffb44
+	size_t len;
fffb44
 	DEFiRet;
fffb44
 
fffb44
 	assert(msg != NULL);
fffb44
@@ -155,7 +158,10 @@ enqMsg(uchar *msg, uchar *pszTag, int iFacility, int iSeverity, struct timeval *
fffb44
 	}
fffb44
 	MsgSetFlowControlType(pMsg, eFLOWCTL_LIGHT_DELAY);
fffb44
 	MsgSetInputName(pMsg, pInputName);
fffb44
-	MsgSetRawMsgWOSize(pMsg, (char*)msg);
fffb44
+	len = strlen((char*)msg);
fffb44
+	MsgSetRawMsg(pMsg, (char*)msg, len);
fffb44
+	if(len > 0)
fffb44
+		parser.SanitizeMsg(pMsg);
fffb44
 	MsgSetMSGoffs(pMsg, 0);	/* we do not have a header... */
fffb44
 	MsgSetRcvFrom(pMsg, glbl.GetLocalHostNameProp());
fffb44
 	MsgSetRcvFromIP(pMsg, pLocalHostIP);
fffb44
@@ -670,6 +676,7 @@ CODESTARTmodExit
fffb44
 	objRelease(glbl, CORE_COMPONENT);
fffb44
 	objRelease(net, CORE_COMPONENT);
fffb44
 	objRelease(datetime, CORE_COMPONENT);
fffb44
+	objRelease(parser, CORE_COMPONENT);
fffb44
 	objRelease(prop, CORE_COMPONENT);
fffb44
 	objRelease(errmsg, CORE_COMPONENT);
fffb44
 ENDmodExit
fffb44
@@ -750,6 +757,7 @@ CODESTARTmodInit
fffb44
 CODEmodInit_QueryRegCFSLineHdlr
fffb44
 	CHKiRet(objUse(datetime, CORE_COMPONENT));
fffb44
 	CHKiRet(objUse(glbl, CORE_COMPONENT));
fffb44
+	CHKiRet(objUse(parser, CORE_COMPONENT));
fffb44
 	CHKiRet(objUse(prop, CORE_COMPONENT));
fffb44
 	CHKiRet(objUse(net, CORE_COMPONENT));
fffb44
 	CHKiRet(objUse(errmsg, CORE_COMPONENT));
fffb44
-- 
fffb44
1.9.3
fffb44