fixed segfault when sending passive service result

this was due to using return_code when registering the command but
using status_code when receiving the command.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
commands: Initialize raw_arguments member on copy

This patch fixes a bug (that is never triggered) where, if a command copied
with external_command_copy is later destroyed, the program will core
dump. The reason being that the raw_arguments member is never properly
initialized.

Signed-off-by: Anton Lofgren <alofgren@op5.com>
commands: Unbreak API, reintroduce process_external_command2

Unfortunately, my command processing overhaul caused some unforeseen API
breakage. Apparently, the Merlin module makes use of process_external_command2.

This patch reintroduces that function, but this time featuring argument
validation and error reporting. That is to say, the API is the same, but
the behaviour is likely changed (for the better, imo).

Since this function relies on the internal ordering of the command
registration, via the CMD_* macros, I've taken the liberty to mark this
function as deprecated in the header. Without knowing exactly what
Merlin uses the function for, I have a feeling that there's an easier
way to accomplish the same thing that doesn't leak as much state.

Reported-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Anton Lofgren <alofgren@op5.com>
Merge pull request #51 from catharsis/command-patches

Command patches
install resource.cfg with less open permissions

resource.cfg may contain sensitive information, so do not install it
world readable.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
core: Allow semi-colons in strings in the last argument to commands

This means user-supplied comments are, once again, free-form when
adding things like acknowledgements and downtime.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Revert "core: Allow semi-colons in last argument to commands"

The patch doesn't fix the actual problem, so we need something
else instead.

This reverts commit 4df082f8e7019766b17b130941795ad832b27cb1.

Signed-off-by: Andreas Ericsson <ae@op5.se>
core: Fortify the external command API

Careless usage of the API could previously cause coredumps, since
we never checked if we got NULL pointers as arguments to various
functions. This patch fixes it, making sure careless broker modules
can't crash us through lack of error checking.

Signed-off-by: Andreas Ericsson <ae@op5.se>
core: Allow semi-colons in last argument for commands

To do this sanely (well, somewhat sanely), we rewrite most of the
argument parsing code.

It's worth noting that the only place where semicolons are allowed
as part of the last argument is if the last argument is a string
(such as a host or service comment).

This restores the behaviour to the way things were before the
command refactoring patches.

Signed-off-by: Andreas Ericsson <ae@op5.se>
added missing service attribute for CHANGE_SVC_MODATTR cmd

the second argument for this command is the service name.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
added shadownaemon tool

shadownaemon uses livestatus to create a shadow copy if a remote site which
then can be used to run livestatus queries against the local shadow copy.
While running it will update runtime data periodically. It therefor removes
network latency when connection to slow remote sites and it also reduces
bandwith usage when having lots of client connections.
Logfiles and commands are not supported and have to be queried directly via
the remote site.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
updated NEWS file

Signed-off-by: Sven Nierlein <sven@nierlein.de>
Remove ancient copyright notice

Since we refer to the source code history for copyright ownership
anyway, we don't need explicit copyright messages too.

Signed-off-by: Andreas Ericsson <ae@op5.se>
added documentation make target

and use help2man to generate basic man pages
migrated dox documenation to the naemon website

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
moved manpage make targets into naemon folder

because this is the folder where the binarys are for which we
want to create man pages.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
travis: help2man is required for building the manpages

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
remove our manpages on uninstall

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
Updated news with Debian init script bug
Re-enable checks for initgroups() and unsetenv()

7b7c13c4420da1231bb300215630b03588766b2c accidentally removed
configure-time checks for initgroups() and unsetenv() availability,
essentially generating dead code due to HAVE_* checks and introducing
issues with dropping permissions. This patch simply restores those
checks.