[syslog-ng] [PATCH] confgen: backticks weren't processed in generated configuration part

Juhász Viktor jviktor at balabit.hu
Wed Dec 4 17:14:06 CET 2013


confgen: backticks weren't processed in generated configuration part

produced by confgen module. The reason of this problem was,
that the cfg_lexer_subst_args was called only for read lines
from configuration files (YY_INPUT) and for the processed blocks.

If process the backticks for a cfg input buffer is a must,
the cfg_lexer_subst_args has to be called explicit.
Now the confgen module call the it before set the include buffer to the lexer

Signed-off-by: Juhász Viktor <jviktor at balabit.hu>
---
 modules/confgen/confgen-plugin.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/confgen/confgen-plugin.c b/modules/confgen/confgen-plugin.c
index 519a660..9831962 100644
--- a/modules/confgen/confgen-plugin.c
+++ b/modules/confgen/confgen-plugin.c
@@ -40,6 +40,7 @@ confgen_generate(CfgLexer *lexer, gint type, const gchar *name, CfgArgs *args, g
   gchar *exec = (gchar *) user_data;
   gsize res;
   gchar buf[256];
+  gchar *old_value;
 
   g_snprintf(buf, sizeof(buf), "%s confgen %s", cfg_lexer_lookup_context_name_by_type(type), name);
   if (!cfg_args_validate(args, NULL, buf))
@@ -79,6 +80,10 @@ confgen_generate(CfgLexer *lexer, gint type, const gchar *name, CfgArgs *args, g
       g_free(value);
       return FALSE;
     }
+
+  old_value=value;
+  value = cfg_lexer_subst_args(lexer->globals, NULL, NULL, value, &value_len);
+  g_free(old_value);
   if (!cfg_lexer_include_buffer(lexer, buf, value, value_len))
     {
       g_free(value);
-- 
1.8.3.2




More information about the syslog-ng mailing list