nerd: Add opathchecks channel

The output from a subscription here can be piped to gource to draw
a real-time fly-around whizzbang graph of how checkresults come in
from various sources. It's pretty damn cool, even if I do say so
myself.

We still don't support state-based colors, but adding it is a very
quick hack indeed, so it won't be long.

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

Conflicts:
	base/nerd.c

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2275 5f96b256-904b-4d8d-8c98-d829582c6739
query-handler: Initialize qh_listen_sock to -1

Otherwise we'll try to remove socket 0 from the iobroker set,
which might well be registered if we're daemonizing.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2276 5f96b256-904b-4d8d-8c98-d829582c6739
query-handler: Be noisier when failing

This goes both for adding handlers and when we're initializing.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2277 5f96b256-904b-4d8d-8c98-d829582c6739
query-handler: actually implement the deinit function

Even though we don't call it yet, it's a good idea to build one to
see where leaks are, and right now we're leaking 16k for every
connected person that doesn't disconnect (in some way).

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2278 5f96b256-904b-4d8d-8c98-d829582c6739
nebmods: Avoid free()'ing core modules

If they want to be free()'d, they'll have to do it themselves.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2279 5f96b256-904b-4d8d-8c98-d829582c6739
nerd: Use .bss-allocated nebmodule pointer

It makes no sense to allocate it when we can just use a static
one instead.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2280 5f96b256-904b-4d8d-8c98-d829582c6739
core: Fix hostdependency checking

Previously we tried to use a NULL pointer to check if we should
add hosts to the check-list when using predictive dependency
checking. The compiler failed to warn us about that, since we
explicitly initialized the temp_hostdependency pointer to NULL
and therefore didn't use it as an unassigned value.

We fix it long-term by moving the declaration to the usage
point and making sure we initialize it.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2281 5f96b256-904b-4d8d-8c98-d829582c6739
query-handler: Plug a leak in the error path

If we fail to register the socket with the iobroker, we must destroy
the iocache we previously used to handle input.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2282 5f96b256-904b-4d8d-8c98-d829582c6739
query-handler: Avoid coredumps on incomplete queries

If we get no data from iocache_use_delim(), we must return early
(without errors) so we don't try to dereference a NULL pointer.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2283 5f96b256-904b-4d8d-8c98-d829582c6739
Undo bulk-allocation of objects

If we do bulk-allocation, adding objects during runtime becomes a
herculean task. We want things to be simple, so we keep the *_list
lists (err...) as arrays of pointers and the addresses of individual
objects immutable.

On the downside, this is a huge change. On the upside, this makes
post-processing object config simpler.

Suggested-by: Daniel Wittenberg <dwittenberg2008@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2284 5f96b256-904b-4d8d-8c98-d829582c6739
Fix object cache malformation

Several lines in the objects.cache were missing linefeeds. This
patch adds them, making a bunch of addons work like they're
supposed to again.

Patched-by: Armin Wolfermann <aw@osn.de>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2285 5f96b256-904b-4d8d-8c98-d829582c6739
lib/.gitignore snprintf.h

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2286 5f96b256-904b-4d8d-8c98-d829582c6739
Aid and assist the user when query-handler initialization fails

Because friendliness is what I'm all about...

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2287 5f96b256-904b-4d8d-8c98-d829582c6739
Avoid dereferencing NULL, at all costs

This is probably the fugliest commit I've ever made, but apparently
it has to be done to avoid crashing horribly on configs with no
servicegroups, hostgroups, services, escalations, dependencies or
contactgroups.

Since sed did it, we get host and service null-ness safety for
free. Yay...

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2288 5f96b256-904b-4d8d-8c98-d829582c6739
Undo the null dereference list-to-pointer-array craziness

Coding while drunk is apparently not always such a stellar idea.

Instead, we add *_ary pointer-to-pointer arrays for all objects
so we have some means of getting hold of the objects that lack
'next' pointers (which will be all of them in Nagios 5).

This makes porting modules from Nagios 4 to Nagios 5 a lot more
pleasant, avoids the null pointer dereference and removes the
hugely ugly and unwieldy ternary statements that protected us
against coredumps caused by some object type not being present.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2289 5f96b256-904b-4d8d-8c98-d829582c6739
Force-install headers in $includedir/nagios

This way our addon projects know to always #include <nagios/foo.h>,
which makes perfect sense and means addons can have headers sharing
names with those of Nagios without causing conflicts or confusion.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2290 5f96b256-904b-4d8d-8c98-d829582c6739
Fix typo: s/hostescalation_list/hostescalation_ary/

This avoids a coredump when freeing memory for a configuration
that has hostescalations.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2291 5f96b256-904b-4d8d-8c98-d829582c6739
core: Resolve contacts and contactgroups for services

Livestatus crashes pretty hard when it gets service requests
without this patch.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2292 5f96b256-904b-4d8d-8c98-d829582c6739
Stop verifying contacts and contactgroups twice

Since we already do it once when we register the objects, we might
as well set the group_ptr there and avoid iterating over all contact
and contactgroup members everywhere else.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2293 5f96b256-904b-4d8d-8c98-d829582c6739
Merge remote-tracking branch 'upstream/master'

Conflicts:
	common/objects.c