From b0ac607caf0d55a3c32239ea1caf339179eec12d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 24 Jun 2013 09:30:49 +0200 Subject: [PATCH] Fix: missing check_command attribute results in sigsegv on check execution Fixes #4331 --- lib/icinga/icinga-type.conf | 4 +++- lib/icinga/service-check.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/icinga/icinga-type.conf b/lib/icinga/icinga-type.conf index 32d674979..37179d212 100644 --- a/lib/icinga/icinga-type.conf +++ b/lib/icinga/icinga-type.conf @@ -50,6 +50,8 @@ type Host { %attribute string "*" }, + %attribute name(CheckCommand) "check_command", + %attribute name(TimePeriod) "check_period", %attribute number "check_interval", %attribute number "retry_interval", @@ -331,4 +333,4 @@ type NotificationCommand inherits Command { type EventCommand inherits Command { -} \ No newline at end of file +} diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp index 71361c9db..ff787b827 100644 --- a/lib/icinga/service-check.cpp +++ b/lib/icinga/service-check.cpp @@ -582,7 +582,12 @@ void Service::ExecuteCheck(void) Dictionary::Ptr result; try { - result = GetCheckCommand()->Execute(GetSelf()); + CheckCommand::Ptr command = GetCheckCommand(); + + if (!command) + return; + + result = command->Execute(GetSelf()); } catch (const std::exception& ex) { std::ostringstream msgbuf; msgbuf << "Exception occured during check for service '"