[syslog-ng] [Bug 235] String arguments to block parameters get mistreated

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Tue May 21 15:32:24 CEST 2013


https://bugzilla.balabit.com/show_bug.cgi?id=235


Balazs Scheidler <bazsi at balabit.hu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bazsi at balabit.hu




--- Comment #1 from Balazs Scheidler <bazsi at balabit.hu>  2013-05-21 15:32:23 ---
I have just pushed a "fix" for this in the 3.5 branch. The fix is quoted as it contains a largish refactoring in the area, so that unit testing becomes
possible.

The change itself is not very simple, as the change that broke this functionality allows the use of free-form text as block arguments, which means that
quoted strings are injected as a quoted string, e.g. together with the quotation marks.

The solution was to detect if the block argument is a single string literal, and if that's the case use the string's value if it is substituted within another
string literal.

e.g.

block destination fooblock foobar() {
  filename("/var/log/`foobar`");
};

fooblock(foobar("foobar_value"));

will result in 

filename("/var/log/foobar_value");

whereas if `foobar` is used outside a string literal, "foobar_value" (with the quotation marks) is inserted.

This is the best solution I could come up with, it complicates the grammar/lexer a lot and gets cheesy to explain, but that's the most intuitive.


-- 
Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the syslog-ng mailing list