travis: Control file updates

Restrict branch building to a subset of branches that matter (master,
upstream mirrors and the sandbox), so that packaging branches and
similar don't end up using resources and failed builds all over the
place.

While there, also request IRC notifications.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
cfg-lexer: Handle no-magic includes better, without hiding errors

When the @include pragma was converted to use glob(3), a couple of
problematic cases stopped producing errors: if we had an @include
without any magic, it still went through glob(3), which was set up to
ignore errors (so that @include "/etc/syslog-ng/conf.d/" would work,
even when the directory didn't exist).

This hid errors, and made it possible even for explicit, glob-less
@includes to fail silently, making debugging next to impossible.

To fix this, glob() is now called with GLOB_NOMAGIC, so if the pattern
does not contain any magic, it is returned anyway, whether it exists
or not: and then, it will eventually be tried by the ordinary include
mechanism, and produce a failure there, as it is appropriate.

This way, @include "/foo/*" continues to work, and @include
"/nothing.conf" will fail, as it should: errors are only ignored for
inclusions that contain magic characters.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
cfg-lexer: During glob-based inclusion, only treat ENOENT specially

When including files with glob-magic, treat all errors but ENOENT as
fatal.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
travis: Significant Travis CI control file updates

To fix issues with uninstallable packages, and to follow the official
recommendation, run apt-get update as part of the testing
process. Also, to make testing more reliable, install into $HOME, so
that we do not need sudo for running the tests.

Furthermore, restrict the tested branches to a subset: master,
upstream mirrors, the sandbox and merge-queue branches. While there,
also enable IRC notifications.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
messages.h: check positive feedback loop for debug/trace messages too

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
NEWS: Merge the 3.3.7 RCs, and start finalising the release.

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

VERSION updated to 3.3.7.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
system(): Use follow-freq(1) on FreeBSD prior to 9.1

FreeBSD prior to 9.1 does not have a kqueue-pollable /dev/klog, so
syslog-ng would fall back to using timers, except that follow-freq()
is explicitly set to zero, also diabling timer-based polling. This has
the effect of making syslog-ng not read from /dev/klog at all.

To work around the issue, on FreeBSD prior to 9.1, use follow-freq(1)
for /dev/klog when using the system() source.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
logreader: Error out when follow-freq is 0, and fd is not pollable

In case an FD is not pollable, but follow-freq is 0, error out,
instead of silently not doing anything.

This is accomplished by breaking out the if (self->pollable_state ==
0) branch out of the big if/else chain, and making it a mandatory step
in the end.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
reader/writer start-watches code simplification

Rearrange and simplify the pollable_state logic, so that it is easier
to follow.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
fix a missing XML semantic check in PDBLoader

pattnerndb has failed to check if we are within a rule when trying to
add tags and values, so a patterndb xml containing these elements
outside of a rule element would cause syslog-ng (and pdbtool) to
segfault

Signed-off-by: Balint Kovacs <blint@blint.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
ivykis: updated to 0.30.5
syslog-ng.conf: bump version to 3.4
pdbtool: match with supplied message did not perform processing

Under some circumstances pdbtool match did not process the message
if it was provided on the command line due to a regression introduced
as part of a LogProto refactoring (2d0fb042)

Signed-off-by: Balint Kovacs <blint@blint.hu>
pdbtool: fix a double increment within a loop

When displaying debug-csv information, the loop variable was not
only incremented in the for statement, but also within the loop, which
caused an index mismatch when iterating over the dbg_info array

Signed-off-by: Balint Kovacs <blint@blint.hu>
resolve_sockaddr: fixed unsafe use of non-reentrant APIs to resolve IP addresses to names

As it seems the use of the DNS cache hid the fact that we're not thread
safe when resolving IPs to DNS names. This patch attempts to use
getnameinfo() API if available that is thread safe and protects
all other paths with a mutex.

Reported-By: Brian Kroth <bpkroth@gmail.com>
Tested-By: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Merge remote-tracking branch '3.3/master'

Conflicts:
	.travis.yml
	NEWS
	VERSION
	lib/logwriter.c
	lib/messages.h
	modules/dbparser/tests/test_patterndb.c
	scl/system/generate-system-source.sh
afsocket: fixed compilation error on FreeBSD with spoof-source enabled

Don't define libnet_t as a typedef as that clashes the definition from
libnet.h. Use a non-type reference and a forward struct declaration instead.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
preparations for 3.4.0beta1