Revert "pdbtool: If a test message has no program attribute, warn when verbose"

This reverts commit 827a492643ee5448af28e303a5cfdbdfcda6dbee.
pdbtool test: examples lacking $PROGRAM or $MESSAGE value are printed too

Previously examples that lack $PROGRAM or $MESSAGE value were not printed
to the test log at all. With this patch, the fact that these are ignored
is printed to stdout.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Revert "doc/Makefile.am: Always include the manpages in the tarball"

This reverts commit bd243255601131f810f185ac26f055761fb7cf8c.
Revert "doc: Allow disabling the manual page building"

This reverts commit e69c8856a178bf75d62150acd10093f1c36f4b87.
logmsg: Do not use NULL template_options parameter for log_macro_expand.

In case of time-related macros, it uses the members of the
LogTemplateOptions* structure, but it results in a NULL pointer
dereference. Instead of spraying the log_macro_expand code with NULL checks,
we pass an initialized options structure to the function, and wrap it
in the log_macro_expand_simple function.

Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
timeutils: Support Tzif3 format timezone files too

The latest tzdata release added a new tzif version, with some minor
changes. This patch adds support for the format to our zone info parser,
and fixes #86.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
json-parser: Fix cloning when no marker is set

When cloning a json-parser, only clone the marker if it is set in the
original, otherwise we may end up crashing trying to strlen(NULL).

Reported-by: Fabien Wernli <bugzilla.balabit@faxm0dem.org>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
tfgeoip: Handle the failed lookup case gracefully

When a GeoIP lookup fails, do not try to use the result, as trying to
append NULL to a GString results in a GLib warning, which is not nice.

Reported-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
system(): Don't use /dev/klog in a FreeBSD jail

When figuring out what to expand system() to, check whether we're in a
jail when running on FreeBSD, and don't include /dev/klog if we are.
This fixes #93.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
syslog-ng.pc.in: Add scldir and datarootdir

The former is primarily for syslog-ng-incubator, the latter is to
silence config.status and for correctness' sake.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Get rid of magic casting that breaks strict aliasing

We used to cast custom pointers to GTrashStack**, which broke strict
aliasing in certain scenarios, leading to pretty much unpredictable
behaviour. That behaviour manifested itself in a live-lock. With this
patch, the intent does not change, but strict aliasing is not broken
either.

Reported-by: Fabien Wernli <bugzilla.balabit@faxm0dem.org>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Revert "value-pairs: Get rid of magic casting that breaks strict aliasing"

This reverts commit 5ef27f5bc4c3b800f6f12ac3d37a1aa4c7578a40.
nvtable: fix an NV registry corruption in the unit tests

nv_registry_add_alias() used the passed in pointer to the alias verbatim,
without copying it.  However the unit test program generated alias names
dynamically, e.g.  editing the memory area that was used to store the hash
table key.

Since this wasn't intuitive at all, this patch changes the code so that the
key in the NV registry is now always duplicated before insertion.

Signed-off-by: Igor Ippolitov <iippolitov@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
parse-number: change return value to gint64 instead of glong

Using glong causes potential portability issues as somewhere it is 64bits,
on other platforms it is only 32 bits.

The lexer, which uses the parse-number functions, stores the return value in
gint64, that is always 64 bits, so use that always.

Reported-By: Tamayo, Andres <Andres.Tamayo@viasat.com>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
test_parse_number: add testcase for a real 64bit value

parse-number had an issue on 32 bit big endian platforms, make sure it is
actually working with 64 bit values, always by adding a testcase that
expects a 64 bit value.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng.pc.in: Move datarootdir higher up

For pkg-config to work correctly, we need to define datarootdir before
using it, so move it higher.

Reported-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afmongodb: Mark host() and port() obsolete

The host() and port() options should have been marked obsolete a while
ago, fix that now, and suggest using servers() instead. This fixes #92.

Reported-by: Andras Mitzki <micek@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
value-pairs: Handle SDATA enterprise IDs correctly

RFC5424 SDATA IDs are of the form "[win@18372.4 foo=bar]", which
translates to "sdata.win@18372.4.foo=bar" internally. In this case, we
should not split the "4" into a separate object, but treat it as part of
the sdata ID.

To do this, the name splitting was enhanced, and instead of splitting by
every dot, it will look for @ too, and only split a token off after
that, if a dot is followed by a non-number. A test case to verify the
behaviour is also included.

Signed-off-by: Tibor Benke <btibi@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Restructure vp_walker_name_split()

Instead of splitting tokens into an array of gchar*s, use a GPtrArray
instead, so that vp_walker_name_value_split() does not have to copy from
a pointer array to a string array.

Also introduce vp_walker_name_combine_prefix(), a short function to
replace the g_strjoinv() we used before.

The advantage of this is that it's much easier to extend later, for
example with array support. The code of vp_walker_name_split() becomes
easier to follow too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: replace trash stack with own stack implementation

Because of the g_trash_stack and its usage problems could arise when
the strict-aliasing compile option was set leading to bad value-pairs
expansion. With the own implementation the bogous usage of g_trash_stack
is supposed to be eliminated.

Signed-off-by: Daniel Gados <gdani@balabit.hu>