lib/nspath: Add leading slash when relative paths go to the root

When traversing backwards to or beyond the filesystem root, we used
to discard any and all slashes, which isn't very good. This patch
adds them back again, but only for backwards-traversing paths that
go to or beyond the filesystem root.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2558 5f96b256-904b-4d8d-8c98-d829582c6739
core: Try harder to make sense of the temp_path and temp_file

Since temp_path and temp_file are sort of cooperative, one can
override the other and it rarely makes sense to put tempfiles
in the same directory where one keeps the nagios.cfg file, we
special-case temp_file so it's relative to temp_path instead.

The change looks larger than it is, since we have to revamp the
ordering a bit in order to be able to use the temp_path directive
last seen in the config file and thus have to duplicate a bit of
error handling as well, but now a configuration such as

  temp_path=/usr/local/nagios/var
  temp_file=nagios.tmp

will cause temp_file to actually become
   temp_file=/usr/local/nagios/var/nagios.tmp

which makes sense and is less surprising than the alternative.

Also, since we do rely pretty hard on being able to generate temp
files, we make sure to have sensible fallbacks in case it's not
configured, with "nagios.tmp" being the standard base template for
the filename, and the environment variables TMPDIR and TMP setting
defaults for the temp directory, with "/tmp" as the ultimate
fallback.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2559 5f96b256-904b-4d8d-8c98-d829582c6739
cgis: Use nagios.cfg-relative path when reading objects.cache

Patched-by: Ton Voon <tonvoon@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2560 5f96b256-904b-4d8d-8c98-d829582c6739
tests: Config fixups

Since we now support nagios.cfg-relative paths rather than paths
relative to our current working directory, we must also show the
tests some love so they can find their configuration files.

Patched-by: Ton Voon <tonvoon@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2561 5f96b256-904b-4d8d-8c98-d829582c6739
Move timing_point() to common/shared.c

It isn't really, but it lets us remove the dummy function from
cgiutils.c and, when debugging cgi's, it's nifty to hardcode the
value to something else so one can see what's going on with the
config parsing, and this lets us do just that.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2562 5f96b256-904b-4d8d-8c98-d829582c6739
t/615cgierror: Stop running tests we know are broken

They clutter up the screen and distract from real errors (which
are plentiful at the moment).

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2563 5f96b256-904b-4d8d-8c98-d829582c6739
nagiostats: Read status.dat location as a nagios.cfg-relative path

Everything else does, so we should too.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2564 5f96b256-904b-4d8d-8c98-d829582c6739
cgi tests: Fix paths for all nagios.cfg files

Now that they're pointing to the right data a whole lot more tests
just started passing. Yay.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2565 5f96b256-904b-4d8d-8c98-d829582c6739
tests: Remove tests for failure prediction

It no longer exists in Nagios, and there's no command for it either,
so we might as well stop testing what isn't there.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2566 5f96b256-904b-4d8d-8c98-d829582c6739
t/705nagiostats.t: Fix path regex for config file tests

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2567 5f96b256-904b-4d8d-8c98-d829582c6739
t/610cgi-status.t

Add tests to check for contactgroup expansion for cgi's.

This is currently broken. The fix is pending.

Patched-by: Ton Voon <tonvoon@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

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