cache: added a new module that encapsulates generic caching of values

This module adds a generic caching implementation that resolves values
on-demand and stores values in a GHashTable. No expiration and size
limits are possible as of now, these can be added later on.

The hash is indexed by a simple string key.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
reloc: new module that implements autoconf path expansion

In autoconf the installation layout is controlled by shell variables that
are expanded recursively.

For instance, we have a prefix variable and then this gets referenced in
sysconfdir by having the value '${prefix}/etc'

Earlier, the configure script did the expansion prior to putting these
values in config.h, now this is being pushed to the syslog-ng binary
so it can be relocated after compilation.

The new reloc module implements the shell-like substitution and
a PathResolver class which can be used with a Cache instance to resolve
autoconf-style directory layouts.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Tamas Pal <folti@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
reloc: implement relocatable syslog-ng binaries

This patch changes the configure script not to expand the directory
layout variables before pushing them to the C code. Rather,
they will contain ${prefix} style variable references that get
resolved at runtime.

In addition to the configure changes, this patch also changes syslog-ng to
invoke get_installation_path() at the proper places so at runtime
these really get resolved.

With this patch, it is now possible to define SYSLOGNG_PREFIX environment
variable and syslog-ng will look for all its installed parts under
that directory in the layout set by the configure script.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Tamas Pal <folti@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
filter-cmp: use scratch buffers for template evaluation

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogRewrite: publish log_rewrite_init_method()

To make it available in descendant classes.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logmatcher: added error quark

This patch adds the boilerplate to generate LogMatcher specific GError
values, which I intend to use in subsequent patches.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
filter-expr-grammar: use CHECK_ERROR_GERROR() in comparison

This makes this code somewhat easier to read.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logmatcher: added LogMatcherOptions struct and related cfg-grammar rules

Whenever a LogMatcher instance was to be created (most notably in filter and
rewrite rules) we had a chicken and egg problem. The flags to be used by
the LogMatcher instance was stored within the LogMatcher instance, however
the kind of LogMatcher instance (posix, pcre, etc) was also parsed together
with flags.

This meant that parsing code had to create a default LogMatcher, which
was replaced when the actual type was parsed. This replacement
was not straightforward though, we had to keep the flags value in case
it had been parsed previously.

This patch delegates LogMatcher parsing to the core cfg-grammar, users
only need to invoke the matcher_option rule and set last_matcher_options
in vein similar to other *Options stuff.

The patch also improves error handling, as flags/regexp compile
errors are propagated back to the grammar, so we get a nice error page. This
required an API change to return a GError in case of failure.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
versioning.h: add 3.6 specific version code, switch default version to 3.6

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
configure.ac: make pcre a hard dependency

This patch removes the ENABLE_PCRE conditional, as well as making the
pcre dependency a requirement.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logmatcher: added store-matches warning to PCRE LogMatcher

As we are changing the default matcher implementation the warning on the
'store-matches' flag should be triggered by the PCRE matcher too. This
patch does exactly that.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logmatcher: change the default matcher to PCRE instead of POSIX

This patch changes the default LogMatcher implementation starting
with syslog-ng 3.6. If the configuration indicates an earlier version
using the @version pragma, it still uses the POSIX implementation and
issues a warning to the user to update her config.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogProtoREMultiLineServer: use pcre instead of posix regexps

Now as PCRE is a hard dependency, we can prefer using that in our
multi-line implementation. It is faster anyway. The patch also
refactors multi-line regexps to a separate object.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
logmatcher: enable PCRE just-in-time compiler if possible

This patch adds PCRE_STUDY_JIT_COMPILE to the pcre_study() flags in order
to enable the JIT compiler in PCRE.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
apphook: remove unused unregister_application_hook

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
crypto: don't cast locking callbacks explicitly

In order to get type safety from the compiler, avoid an explicit cast and
fix the function prototype to match the OpenSSL expectations.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng.h: remove DMALLOC macros

dmalloc has not been support for a long time, its configure.ac counterpart
has already been removed, remove the stuff from syslog-ng.h too.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
configure.ac: break up AC_CHECK_HEADERS to one header per line

To make it easier to extend the list and cause less conflicts.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
configure.ac: break up AC_CHECK_FUNCS to one function per line

To make it easier to extend the list and cause less conflicts.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Makefile.am: change library ordering in TEST_LDADD

Since libsyslog-ng-test.a uses symbols from libsyslog-ng.so, the .a file
should come first. The only reason this didn't cause issues is that so
far all test programs directly referenced the .so file too. If that
doesn't happen, linking errors ensue.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>