systemd-journal: Prefer SYSLOG_IDENTIFIER over _COMM

In order to not break assumptions, prefer SYSLOG_IDENTIFIER over _COMM.
For example, postfix uses postfix/qmgr as SYSLOG_IDENTIFIER, but _COMM
is only "qmgr". The journal itself uses SYSLOG_IDENTIFIER when
reconstructing the syslog message, so we should not deviate from that
behaviour, either.

Similarly, rsyslog also prefers SYSLOG_IDENTIFIER, so for the sake of
compatibility, doing the same is preferable.

Reported-by: Alexander Görtz
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
afsocket: rename log_transport_unix_socket_new to _dgram_socket_new()

When doing the LogTransport refactor in early 3.6 days, one difference
between unix-dgram() and unix-stream() were not taken into consideration:
zero-length packets should only be ignored for SOCK_DGRAM transports and
not for SOCK_STREAM ones.

This is a preparatory patch to fix the issue this bug causes, it renames
the original constructor function to log_transport_unix_dgram_socket_new()
by adding the _dgram_ qualifier, otherwise it doesn't change functionality.

The fix is coming in a subsequent patch.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
afsocket: add log_transport_unix_stream_socket_new() function

This patch adds a SOCK_STREAM specific AF_UNIX socket transport
implementation.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
afsocket: fix spinning on EOF for unix-stream() sockets

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
afsocket: fix shift/reduce conflicts in grammar

Due to a stray colon, the grammar contained a conflict as both
source_systemd_syslog_option and its recursive parent
source_systemd_syslog_options permitted an empty evaluation.

By removing the extra colon, only the "options" rule allows the empty
match, which in turn removes the conflict.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
afsocket: fix indentation issues in the grammar file
logproto-regexp-multiline-server: fix compilation warnings about mismatching character signs

The types used for detecting the message boundaries were not consistently
used and some of the call-sites lacked type-casts. This patch fixes
that up by consistently using guchar * for detecting line endings,
and only casting it to a gchar * when passing it on to pcre.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
test_rewrite: always use the current config version in the tests

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
test_rewrite: fix compilation warning due to a pointer type mismatch

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
test_rewrite: rename local LogPipe API extension

The test program contained a function that was named like as it was part
of the LogPipe API, called log_pipe_queue_with_default_path_options().
call that invoke_rewrite_rule() instead, that reflects its purpose
much better. If we need the API extension, we should do that in the
core.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Makefile: remove explicit libsyslog-ng-crypto references

Instead of open-coding the optional libsyslog-ng-crypto as a dependency
use $(CRYPTO_LIBS) which conditionally contains the same if
libsyslog-ng-crypto is built.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Merge pull request #325 from algernon/h/systemd/journal-syslog-identifier

systemd-journal: Prefer SYSLOG_IDENTIFIER over _COMM
Merge pull request #335 from balabit/3.6/f/fix-warnings

3.6/f/fix warnings
Merge pull request #334 from balabit/3.6/f/fix-syslog-ng-crypto-build-errors

Makefile: remove explicit libsyslog-ng-crypto references
Merge pull request #332 from balabit/3.6/f/unix-stream-spinning-fix

3.6/f/unix stream spinning fix