summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2006-11-17 13:44:50 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2006-11-17 13:44:50 +0000
commitb3497a08c81a02e82685160b329761266b3b692c (patch)
tree3aad883298762d6370ed5423332173f521402271 /syslogd.c
parent42c47e4678f9cd49f0f095bb4a41f4c5e6bf57a2 (diff)
downloadrsyslog-b3497a08c81a02e82685160b329761266b3b692c.tar.gz
rsyslog-b3497a08c81a02e82685160b329761266b3b692c.tar.xz
rsyslog-b3497a08c81a02e82685160b329761266b3b692c.zip
property replacer options space-cc and drop-cc added
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/syslogd.c b/syslogd.c
index a2b78a54..d52edcaf 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -3318,9 +3318,29 @@ static char *MsgGetProp(struct msg *pMsg, struct templateEntry *pTpe,
}
/* now do control character dropping/escaping/replacement
+ * Only one of these can be used. If multiple options are given, the
+ * result is random (though currently there obviously is an order of
+ * preferrence, see code below. But this is NOT guaranteed.
* RGerhards, 2006-11-17
*/
- if(pTpe->data.field.options.bEscapeCC) {
+ if(pTpe->data.field.options.bDropCC) {
+ char *pSrc = pRes;
+ char *pDst = pRes;
+
+ while(*pSrc) {
+ if(!iscntrl(*pSrc))
+ *pDst++ = *pSrc;
+ ++pSrc;
+ }
+ *pDst = '\0';
+ } else if(pTpe->data.field.options.bSpaceCC) {
+ char *pBuf = pRes;
+ while(*pBuf) {
+ if(iscntrl(*pBuf))
+ *pBuf = ' ';
+ ++pBuf;
+ }
+ } else if(pTpe->data.field.options.bEscapeCC) {
/* we must first count how many control charactes are
* present, because we need this to compute the new string
* buffer length. While doing so, we also compute the string
@@ -3369,7 +3389,7 @@ static char *MsgGetProp(struct msg *pMsg, struct templateEntry *pTpe,
}
/* Now drop last LF if present (pls note that this must not be done
- * if bEscapeCC was set! - once that is implemented ;)).
+ * if bEscapeCC was set!
*/
if(pTpe->data.field.options.bDropLastLF && !pTpe->data.field.options.bEscapeCC) {
int iLen = strlen(pRes);