]> granicus.if.org Git - icinga2/commitdiff
Fix: missing check_command attribute results in sigsegv on check execution
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 24 Jun 2013 07:30:49 +0000 (09:30 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 24 Jun 2013 07:30:49 +0000 (09:30 +0200)
Fixes #4331

lib/icinga/icinga-type.conf
lib/icinga/service-check.cpp

index 32d674979928e0f9a011d01a4e919bcad51afecf..37179d2129d9b532cddfdfe28613105b57de0056 100644 (file)
@@ -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
+}
index 71361c9dbeea2cb9e01976346ead8745c7670fc4..ff787b827cacd94bef92f17511214a309ca6cd34 100644 (file)
@@ -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 '"