[icinga-checkins] icinga.org: icinga2/master: Fix: missing check_command attribute results in sigsegv on check execution

git at icinga.org git at icinga.org
Mon Jun 24 09:30:57 CEST 2013


Module: icinga2
Branch: master
Commit: b0ac607caf0d55a3c32239ea1caf339179eec12d
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=b0ac607caf0d55a3c32239ea1caf339179eec12d

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Jun 24 09:30:49 2013 +0200

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 32d6749..37179d2 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 71361c9..ff787b8 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 '"





More information about the icinga-checkins mailing list