summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--doc/imkmsg.html6
-rw-r--r--template.c18
3 files changed, 21 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d3f90b8..22387dcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -65,6 +65,10 @@ Version 7.2.2 [v7-stable] 2012-10-??
- bugfix: potential abort of imtcp on rsyslogd shutdown
- bugfix: imzmq3 segfault with PULL subscription
Thanks to Martin Nilsson for the patch.
+- bugfix: improper handling of backslash in string-type template()s
+- bugfix: leading quote (") in string-type template() lead to thight loop
+ on startup
+- bugfix: no error msg on invalid field option in legacy/string template
----------------------------------------------------------------------------
Version 7.2.1 [v7-stable] 2012-10-29
- bugfix: ruleset()-object did only support a single statement
@@ -226,6 +230,7 @@ Version 6.6.1 [v6-stable] 2012-10-??
- fix API "glitch" in some plugins
This did not affect users, but could have caused trouble in the future
for developers.
+- bugfix: no error msg on invalid field option in legacy/string template
---------------------------------------------------------------------------
Version 6.6.0 [v6-stable] 2012-10-22
This starts a new stable branch, based on the 6.5.x series, plus:
diff --git a/doc/imkmsg.html b/doc/imkmsg.html
index 61068d09..23b96147 100644
--- a/doc/imkmsg.html
+++ b/doc/imkmsg.html
@@ -25,9 +25,11 @@ Log messages are parsed as necessary into rsyslog msg_t structure. Continuation
as json key/value pairs and added into rsyslog's message json representation.
</p>
<p><b>Configuration Directives</b>:</p>
-This module has no configuration directives.
+<p>This module has no configuration directives.</p>
<b>Caveats/Known Bugs:</b>
-<p>This is Linux specific module and requires /dev/kmsg device with structured kernel logs.
+<p>This module can't be used together with imklog module. When using one of them, make sure the other
+one is not enabled.</p>
+<p>This is Linux specific module and requires /dev/kmsg device with structured kernel logs.</p>
<p><b>Sample:</b></p>
<p>The following sample pulls messages from the /dev/kmsg log device. All
parameters are left by default, which is usually a good idea. Please
diff --git a/template.c b/template.c
index 986dbfd6..6ee4ccd1 100644
--- a/template.c
+++ b/template.c
@@ -584,9 +584,14 @@ tplConstruct(rsconf_t *conf)
/* helper to tplAddLine. Parses a constant and generates
* the necessary structure.
+ * Paramter "bDoEscapes" is to support legacy vs. v6+ config system. In
+ * legacy, we must do escapes ourselves, whereas v6+ passes in already
+ * escaped strings (which we are NOT permitted to further escape, this would
+ * cause invalid result strings!). Note: if escapes are not permitted,
+ * quotes (") are just a regular character and do NOT terminate the constant!
* returns: 0 - ok, 1 - failure
*/
-static int do_Constant(unsigned char **pp, struct template *pTpl)
+static int do_Constant(unsigned char **pp, struct template *pTpl, int bDoEscapes)
{
register unsigned char *p;
cstr_t *pStrB;
@@ -604,8 +609,8 @@ static int do_Constant(unsigned char **pp, struct template *pTpl)
/* process the message and expand escapes
* (additional escapes can be added here if needed)
*/
- while(*p && *p != '%' && *p != '\"') {
- if(*p == '\\') {
+ while(*p && *p != '%' && !(bDoEscapes && *p == '\"')) {
+ if(bDoEscapes && *p == '\\') {
switch(*++p) {
case '\0':
/* the best we can do - it's invalid anyhow... */
@@ -763,7 +768,8 @@ static void doOptions(unsigned char **pp, struct templateEntry *pTpe)
} else if(!strcmp((char*)Buf, "mandatory-field")) {
pTpe->data.field.options.bMandatory = 1;
} else {
- dbgprintf("Invalid field option '%s' specified - ignored.\n", Buf);
+ errmsg.LogError(0, NO_ERRCODE, "template error: invalid field option '%s' "
+ "specified - ignored", Buf);
}
}
@@ -1271,7 +1277,7 @@ struct template *tplAddLine(rsconf_t *conf, char* pName, uchar** ppRestOfConfLin
do_Parameter(&p, pTpl);
break;
default: /* constant */
- do_Constant(&p, pTpl);
+ do_Constant(&p, pTpl, 1);
break;
}
if(*p == '"') {/* end of template string? */
@@ -1868,7 +1874,7 @@ tplProcessCnf(struct cnfobj *o)
do_Parameter(&p, pTpl);
break;
default: /* constant */
- do_Constant(&p, pTpl);
+ do_Constant(&p, pTpl, 0);
break;
}
}