lib/nspath: Fix nspath_mkdir_p()

The "no-testing-but-committed anyways" strategy wasn't all that
stellar, it seems, and especially not for a function hacked up in
under three minutes while trying to put on a jacket at the same
time.

With some testing and another two minutes of hacking we fix it up
to good working order.

While at it, we mention in the doxygen comments that this function
will *always* taint errno with ENOENT if one path component doesn't
exist and document the behaviour when a trailing slash is present
and NSPATH_MKDIR_SKIP_LAST is used (ie, the full path is created
just as if NSPATH_MKDIR_SKIP_LAST wasn't passed in the options flag).

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2585 5f96b256-904b-4d8d-8c98-d829582c6739
Added very basic, stand-alone core 4 worker

This commit adds a bare-bones, stand-alone core 4 worker which handles
ping checks. It is primarily meant as a template for other workers. 

It still lacks the ability to drop privileges or to daemonize itself,
both of which are intended to be aded shortly.


git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2586 5f96b256-904b-4d8d-8c98-d829582c6739
core: Never free() global_macro.x[MACRO_LOGFILE]

We only assign it from log_file nowadays, so we really shouldn't
ever free it.

We also remove the second pass of test_configured_paths() from
the verification step, as it's completely unnecessary.

Reported-by: Robin Sonefors <rsonefors@op5.com>
Reported-by: Mark Frost <mark.frost1@pepsico.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2587 5f96b256-904b-4d8d-8c98-d829582c6739
core: Make running Nagios from the path work properly

If nagios is executed as simply 'nagios', we previously used to
fail to locate the executed binary. This patch adds a "search path
for proper program" thing and runs that to locate our own executable
in case we can't find it by normalizing the path used to start it.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2588 5f96b256-904b-4d8d-8c98-d829582c6739
Added dropping privileges to core 4 ping worker template

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2589 5f96b256-904b-4d8d-8c98-d829582c6739
Added daemonizing to core 4 ping worker template

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2590 5f96b256-904b-4d8d-8c98-d829582c6739
core: typofix: Set TEMPPATH macro properly

We used to set TEMPFILE twice instead.
For the record: Typos are silly.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2591 5f96b256-904b-4d8d-8c98-d829582c6739
core: Run test_configured_paths() when running properly too

Otherwise we never set the LOGFILE macro, which is kinda bad.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2592 5f96b256-904b-4d8d-8c98-d829582c6739
lib/lnag-utils.h: Fix compile error in non-gnu compatibility code

We need the lnag_clz() function, which gcc is kind enough to provide
a builtin for but Solaris cc (and a bunch of others, I'm sure) needs
help with.

Reported-by: Gaspar Carson <Carson.Gaspar@gs.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2593 5f96b256-904b-4d8d-8c98-d829582c6739
lib/Makefile: Stop hardcoding gcc as our compiler

We get @CC@ substituted for us, which includes the users choice
of compiler.

This means also removing -Wall, which not all compilers understand.

Reported-by: Gaspar Carson <Carson.Gaspar@gs.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2594 5f96b256-904b-4d8d-8c98-d829582c6739
xsddefault: Stop trying to parse 'temp_file' more than once

Instead we reuse the variable we've already parsed in the main
config parsing routine, which takes temp_path into account in a
somewhat clever manner, ensuring that we always have a tempfile
which we most likely can write to.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2595 5f96b256-904b-4d8d-8c98-d829582c6739
xodtemplate: Clear the children map when creating servicedependencies

Otherwise we can't have more than one dependency from a single
service, or one that's been excluded from another servicedependency.

This went unnoticed in the wild for a long time and most likely would
have remained that way, as people generally tend to have each service
depend on only one other. With this patch the code seems to do what
it's supposed to though, which is block multiple service dependencies
from being created from the same object to the same object from a
single config object statement.

Objects galore there. Good thing at least I know what I mean...

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2596 5f96b256-904b-4d8d-8c98-d829582c6739
core: Only get max user processes if we have RLIMIT_NPROC

Solaris doesn't, for instance, so this is one step closer to
building our stuff on Solaris.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2597 5f96b256-904b-4d8d-8c98-d829582c6739
xsddefault: Only assign xsddefault_temp_file #ifdef NSCORE

This makes the cgi's build properly again.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2598 5f96b256-904b-4d8d-8c98-d829582c6739
base/utils.c: Remove code handling escape characters

This patches moves the responsibility for handling escape characters
from the core to worker processes. The exclamation mark is excepted as
it is used as the argument delimiter. Note that any code using the
runcmd functions from libnagios get escape handling for free.

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

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