basicfuncs: Handle empty environment variables when using $(env)

When using the $(env) template function, if the environment variable is
empty or non-existent, don't try to add a NULL string to the result.
This fixes a Glib warning, which, under some cases, would turn into a
crash. (Fixes BugZilla#277)

Reported-by: Nick Alcock <nix@esperi.org.uk>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #114 from algernon/h/basicfuncs/empty-env-fix

basicfuncs: Handle empty environment variables when using $(env)
filter-expr-grammar: extract filter_fac rule

This patch extracts the bit-banging parts from the filter_fac_list rule
into a separate, new rule named filter_fac. This removes some code
duplication and prepares the scene for introducing facility range support.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
filter-expr-grammar: add support ranges in the facility() filter

This way one can easily grab facility(local0..local6). It can be used
for all the other facility codes, though it might make less sense,
as facilities are ordered by their numerical codes.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Merge pull request #116 from balabit/f/facility-range

F/facility range
dbparser: updated XML version to 4 in patternize output

The formats are upwards compatible so it shouldn't cause any issues.
Merge pull request #118 from gyp/master

dbparser: updated XML version to 4 in patternize output
plugin.c: Use G_MODULE_BIND_LAZY instead of G_MODULE_BIND_LOCAL

When we have a situation where we load a syslog-ng module, linked
against a certain library, and that module tries to load a plugin that
requires the library the module is linked against, but the plugin isn't,
using BIND_LOCAL will result in symbol lookup errors. Not using it will
correctly resolve the symbols previously loaded.

This is needed to be able to load Lua, Perl, etc modules.

On some exotic platforms (like AIX), where the linker tends to act
strangely, this may cause problems. If it does, we should likely use
BIND_LOCAL there.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #119 from algernon/f/plugin-bind-lazy

plugin.c: Use G_MODULE_BIND_LAZY instead of G_MODULE_BIND_LOCAL
basicfuncs: Fix a think-o

When parsing a number, during any of the numeric template functions, and
the parse fails, display the error message correctly. Previously, the
same error message was displayed for both the first and the second
argument, and both messages said "first argument".

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #122 from algernon/h/basicfuncs-thinko

basicfuncs: Fix a think-o
patterndb: Fix test_patterndb crash when testing outside-of-rule db lookups.

First test_patterndb_tags_outside_of_rule() nulls out the messages pointer,
then it calls clean_pattern_db(), which unconditionally dereferences it.

This will never work.

Guard the use of messages in clean_pattern_db() with a nullity check.

Signed-off-by: Nick Alcock <nix@esperi.org.uk>