filters: Support unicode characters in regexes

This patch adds support for unicode characters in regular expressions
used in filters. This fixes a bug that disallowed case sensitive
matching on characters outside of the ASCII range.

This fixes op5#8203.

Change-Id: Id12c46f9c50ef3e2a088ebf931882e782cb009bd
Signed-off-by: Anton Lofgren <alofgren@op5.com>
gitignore: Ignore *.lo

Change-Id: Ia5df34a7b517cef16b5c236105660f61e44d5eb7
Signed-off-by: Anton Lofgren <alofgren@op5.com>
building: Rework build system

Since the previous so-called build system was anything but, I've taken
the liberty to rework the entire thing. Now we build proper dlopenables,
using more modern tools.

This also includes:
* putting things where they belong
* respecting prefix
* not doing things completely wrong

Change-Id: Ifd4c01ec8ab76ab41c5d53414badd44769f618a5
Signed-off-by: Anton Lofgren <alofgren@op5.com>
build: Add plumbing for running cppunit tests

This patch adds support for running CPPUnit test cases on `make check'.

It also adds some (basic) test cases for all supported string column
filter operations.

Change-Id: I6bde61753d76e16a644c2a997ed709f1c7aa0168
Signed-off-by: Anton Lofgren <alofgren@op5.com>
tests: Test regex filters with unicode characters

This verifies op5#8203.

Change-Id: I5ef4ead5deb9853a7bb824596f04698cf23f1b6f
Signed-off-by: Anton Lofgren <alofgren@op5.com>
tests: Trigger insane regex find bug

This patch triggers (in a test case) a bug in the unicode  regex filter
implementation that causes filtering to work rather peculiarly. In
essence, because of how C++ treats anonymous objects, the current
implementation causes an internal pointer in the ICU library to point at
garbage (often some offset into the filter string), which results in
very unintuitive "matches".

Change-Id: I6fb6a2b7a1e1d63a5512c6a96fadc57ba31a92a2
Signed-off-by: Anton Lofgren <alofgren@op5.com>
tests: Free memory in tests

This way, we can run valgrind and verify that the columnfilters don't
leak without a lot of noise.

Change-Id: I6298fb5ac081dbe4bf192322ec713ce827451c07
Signed-off-by: Anton Lofgren <alofgren@op5.com>
filters: Don't pass anonymous objects around

Anonymous objects are implicitly destroyed if not bound. This leads to
the RegexMatcher's string being different than the one we attempt to
match against (by an offset of 2 bytes, it seems).

My original test cases did not catch this since they mostly differ in
the end of the string.

This fixes a bug where the regular expression filters behaved _really_
unintuitively.

Change-Id: I20e8da885c4d8fbbf9441b7b372ccc14515e64a5
Signed-off-by: Anton Lofgren <alofgren@op5.com>
configure: Fallback for ICU if no .pc found

If we don't find a .pc for libicu, we now print a warning and use some
flags that should work (provided that libicu actually is installed).
This is _not_ the right way to do it, but at least it'll get the thing
built.

This also includes being particular about the version of libicu we
accept, since we can only cope with >= 4.2.

Change-Id: Ifb24852e12b6986a777724f67836cfafa1a6f26a
Signed-off-by: Anton Lofgren <alofgren@op5.com>
Merge pull request #1 from catharsis/livestatus-patches

Livestatus patches
build: Run tests only if CPPUnit is installed

This patch demotes a missing CPPUnit from an error to a warning, and
runs tests only if CPPUnit is installed on the system. For those who
don't have it installed, 0 tests are run if make check is invoked,
and no error is triggered.

Change-Id: I0414958cb26bd91762046934f27cde862608f95f
Signed-off-by: Anton Lofgren <alofgren@op5.com>
Merge pull request #3 from catharsis/warn-on-missing-cppunit

build: Run tests only if CPPUnit is installed
build: Fix up a merge error

In merging a44772c4894 from my work branch I accidentally removed the
part we're we build the module as a module instead of the thing we
previously did. No wonder it didn't build. Apologies.

Change-Id: I207e1f961cd1f1128528cf5121b27bd0b63a2d59
Signed-off-by: Anton Lofgren <alofgren@op5.com>
fix racecondition when starting threads

it may happen that the g_should_terminate is still false when client threads
starts which leads to a immediate shutdown of the client threads which then
leads to hanging unix sockets, because no client thread is left to answer the
query. We therefor reset the terminate flag befor starting the main thread
instead of in the main thread.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
require at least libicu version 4.2 where fromUTF8 has been introduced

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
only use unicode if we found libicu

older versions don't have fromUTF8

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
unicode/regex.h is part of libicu

so only load it if configured with libicu support

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
more ifs for none-libicu builds

needed some more exceptions when building without/or old libicu.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
updated gitignore

added some more autogenerated files

Signed-off-by: Sven Nierlein <sven@nierlein.de>
autoconf libicu fix

seconf pkg check did set icu libs when pkg check failed. Instead we have
to set have_icu false and set the libs when have_icu is true.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>