modules: Do not build or install disabled modules

The afmongodb and afsmtp modules had a subtle bug in their
Makefile.ams: even if they were disabled, the Makefile still built and
installed an empty module.

This patch corrects that, by moving the module_LTLIBRARIES inside the
if block.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
configure: Fix --with-json=json-c/json-glib handling and add --disable-json.

The tests that decide whether the user wanted to select json-c or
json-glib were a little bit off, which resulted in anything other than
--with-json=auto failing. This has now been corrected. This patch also adds
--disable-json for consistency with other enable/disable options.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-lexer: Split cfg_lexer_include_file() into two functions

To be able to keep the code simple in the future, split
cfg_lexer_include_file() into two: the intent is that we'll check if
the file exists, and if not, try the same thing as a glob, otherwise
continue as we did before.

This would nest too deep, so split out the current bulk into a
separate function.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-lexer: Implement glob-based @include.

Both for distributions and otherwise, the ability to limit what kind
of files are included, especially when doing a directory include is
very important.

This patch implements just that, by extending cfg_lexer_include_file()
to try and resolve globs, if it can't find a file otherwise. Files
included this way still respect the global include-path setting, so
@include "foo.d/*.conf" will still work.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
dummy: Remove this module.

The dummy module does nothing, yet, is installed by default. It's not
a terribly great example of a simple module, either. For these reasons
and more, lets bid it a tearful farewell.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
json-parser: Change the way arrays are formatted

Instead of parsing an array into key-value pairs where the key has a
suffix of a dot, followed by the array index, make the key resemble
the javascript array syntax: array[index].

This makes it more intuitive to reach into arrays, and also makes it
easier to discover arrays when formatting back to JSON.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afmongodb: Restore compatibility with syslog-ng 3.3

In syslog-ng 3.3, we had the host() and port() options for the mongodb
driver, these were removed in 3.4 in favour of servers(). This patch
re-adds this two.

Using host() and port() will now prepend the specified combination to
the server list.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
NVTable: allow huge LogMessage data

This patch converts NVTable to use 32 bit offsets/sizes in order to allow
maximum 4GB log records, each value holding maximum 4GB data. The NVTable
structure is still artificially limited to 256MB in size.

Signed-off-by: Peter Eisenlohr <peter.eisenlohr@inform-software.com>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog() source: make buffer dynamically allocated

This patch changes self->buffer to be dynamically allocated.

Signed-off-by: Peter Eisenlohr <peter.eisenlohr@inform-software.com>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>