cgi's: Fix group resolution for cgi programs

This should make cgi's usable out of the box again.

Changes from Ton's patch includes:
 - Make global variables into macros inside #ifdef NSCGI
 - Also macro away test_scheduling and get rid of a ton of #ifdef's

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@2582 5f96b256-904b-4d8d-8c98-d829582c6739
core: Avoid opening log_file before dropping privileges

Doing so means we can potentially create the logfile as root,
and then never be able to write to it as the user we're
supposed to run as.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2583 5f96b256-904b-4d8d-8c98-d829582c6739
lib/nspath: Add nspath_mkdir_p()

This is in preparation for letting Nagios set up directories and
whatnot as required, without requiring too much user intervention
beyond setting the proper permissions.

This is currently untested code, but since it's also unused, I'm
not too fuzzed atm.

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

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