docs: Flesh out the config changes page a bit

There are config management tools aplenty, and this way their authors
can get all the information they need to make it work on Nagios 4 as
well as it did on Nagios 3.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Makefile: Add 'test' to '.PHONY'

Otherwise tests won't run now that we have a directory named
'test' as well.

While at it, make sure the 'test' target runs the libnagios tests.
Not very much will work if libnagios is broken, so we do those
first.

Signed-off-by: Andreas Ericsson <ae@op5.se>
lib: .gitignore test-runcmd

Signed-off-by: Andreas Ericsson <ae@op5.se>
core: Stop leaking the string to default logfile

Signed-off-by: Andreas Ericsson <ae@op5.se>
xodtemplate: Fix same-host service dependencies with inexact master

Weird subject, but here's the thing. In Nagios 3 we supported
same-host servicedependencies where the host was defined by having
exact settings for the dependent services (such as a servicegroup
or a combination of dependent_hostgroup_name/dependent_host_name
AND dependent_service_description). With Nagios 4-ish, that test
slipped through the testing net, even though we actually have a
test configuration just like that checked in alongside the code.

With this patch, we no longer bomb out when given servicedependencies
such as this:
  define servicedependency {
     service_description           some-service
     dependent_servicegroup        some-service-group
     notification_failure_criteria w,c
  }

Signed-off-by: Andreas Ericsson <ae@op5.se>
common/objects: Make qsort() comparison functions a lot faster

Since host and service objects are sorted lexicographically and
carry an unsigned int as id, which is incremental based on the
sort order, we can just compare integers rather than run full
string comparisons when sorting host and service dependencies.

I'm unsure how much impact this has on config reload times, but
it will surely make it slightly faster. The fact that we remove
more code than we add makes that a double win.

Signed-off-by: Andreas Ericsson <ae@op5.se>
common/objects: post-process dependencies for cgi's too

They don't need the sorting phase though, as objects are always
sorted when we print them to the object cache.

This should prevent the cgi's from dumping core when trying to
handle host or servicedependencies.

Reported-by: Mark Frost <mark.frost1@pepsico.com>
Reported-by: Jeff <iamirix@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>
core: Sort escalations in post_process_object_config()

We used to do that in Nagios 3, so doing it now too means a bunch
of tests will pass by default, and everything that handles Nagios'
internal data and expects it to be sorted will keep on working
mostly the same way it always has.

Signed-off-by: Andreas Ericsson <ae@op5.se>
test: Update objects.precache.expected

This makes t/900-configtest.t work as intended again. Now that the
last code discrepancies between Nagios 3 and Nagios 4 have been
ironed out, we may as well update the tests to reflect the real
world.

Signed-off-by: Andreas Ericsson <ae@op5.se>