configure.ac: readd missing test on "modern" utmp database

There was an incompatible change in struct utmp and the test to validate
if we are using the old or the new format has been removed in the
past decade somehow.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
lib/compat: move getutent/endutent implementation from utils.c

An ancient version of the compat library was present (and now rediscovered)
in utils.c, move it to its new home.

The inet_aton() implementation is coming in a separate patch.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afuser: factor utmp specific mess from the main body of the queue function()

Instead of doing a lot of ifdef trickery in the queue() function, use
separate static wrappers for that.

Also adds a locking around the use of the inherently non-thread-safe
utmp interface.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afuser: remove alarm workaround

The Linux kernel used to have a bug that caused the afuser driver
to block even if O_NONBLOCK is set in the open flags. It was fixed
a long time ago, and alarm() is incompatible with multithreaded programs,
thus get rid off the alarm() call to detect blocked ttys.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
compat: add strtok_r implementation for platforms that lack that
compat: add inet_aton() for compatibility with platforms that lack one

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-grammar: create CHECK_ERROR() variant without error message

In some cases CHECK_ERROR() macro is invoked without an error message,
which simply means it should simply return the grammar without producing
a verbose error message. This happens when a recursive grammar already
produced a meaningful error message.

Instead of overloading CHECK_ERROR() with a NULL errormsg in this case,
introduce a separate macro.

This also fixes a warning when compiling with clang.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logproto-regexp-multiline-server: avoid defining MultiLineRegexp multiple times

The typedef was already in the header, so no need to define it in the
implementation module too.

This fixes a warning when compiling with clang.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
serialize: use gssize for the result of I/O operations

fread/fwrite returns signed quantity and anything below 0 indicates
a failure. This code errorenously used gsize instead of gssize causing
the error handling never to be triggered.

Fortunately this code is only being used to upgrade a persist-state file
in the older format, and read() rarely if ever fails once the file could
successfully be opened.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
stats: fix format spec for an int variable

The code that formatted the per-facility/severity stats counters used
the guint16 format specifier for an int.

This patch also fixes caused a warning when compiling with clang.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: remove an extra parentheses in afsocket_dd_construct_writer_method()

This patch removes an extra set of parentheses as it was unneeded and
clang gave us a warning about that.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng-ctl: use gssize for sizes returned by read()

Read returns signed values and the simplistic syslog-ng-ctl interface
used an unsigned value for that, causing the error handling portion
of the slng_read_response() routine never to trigger.

This patch fixes that.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng-ctl: move into a separate subdirectory

Instead of sharing a home with the main syslog-ng binary, use a separate,
dedicated folder.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
.travis.yml: Test the merge/ prefixed branches on Travis CI too

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Bump the @version pragmas to 3.6

Since the default version was switched to 3.6 earlier, bump the @version
of the default config and the in the func-tests too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
README.md: add new file to describe syslog-ng

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
.travis.yml: Install sqlite3 and libdbd-sqlite3 too

In order to run the SQL func tests, install sqlite3 and libdbd-sqlite3
too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
README.md: Various improvements

Rearrange the README a little bit, putting the source installation docs
at the top, adding more links, and rewording a few things here and
there.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
csvparser: escape related flags are incorrectly processed

The problem is that escape related flags just simply overwrite
default flags and overwritten by non-escape flags.
This patch is do the following in order to avoid undesired owerwrites:

If new flag is an escape flag (and does not contain any other flags),
previously set flags, without escape flags, are appended to that new flag.

If new flag does not contain escape flags, escape flags from previously
set flags are appended to that new flag.

Otherwise new flag is overwrite previously set flags.

Please note, that this solution is not the best( adding a new escape-mode()
argument would be better than this workaround ).

Signed-off-by: Budai Laszlo <lbudai@balabit.hu>
Makefile.am: Use the -no-install libtool flag for tests

When building test programs (anything in ${check_PROGRAMS}) add
-no-install to the list of LDFLAGS, so that libtool stops generating a
useless wrapper for them. This makes debugging the check programs
easier, and also avoids a lot of shell launching for no good reason.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>