]> granicus.if.org Git - icinga2/commitdiff
Validate timeperiod segments
authorGunnar Beutner <gunnar@beutner.name>
Thu, 29 Jan 2015 13:14:56 +0000 (14:14 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 29 Jan 2015 13:14:56 +0000 (14:14 +0100)
fixes #8309

lib/config/configitem.cpp
lib/icinga/legacytimeperiod.cpp

index 17fe9da0368aa801ccb6e72d8a1624534cc6f8f5..fbb59eb1543b6688d107a57f07abe8694afc9dd8 100644 (file)
@@ -381,6 +381,7 @@ bool ConfigItem::ActivateItems(void)
        }
 
        upq.Join();
+       upq.ReportExceptions("ConfigItem");
 
 #ifdef I2_DEBUG
        BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
index 0ef7989911797725139c40b47c735c51876154f2..6e380ad8c3fad706e88465bf6c2b607691f30953 100644 (file)
@@ -379,6 +379,9 @@ void LegacyTimePeriod::ProcessTimeRanges(const String& timeranges, tm *reference
 
        BOOST_FOREACH(const String& range, ranges) {
                Dictionary::Ptr segment = ProcessTimeRange(range, reference);
+               if (segment->Get("begin") >= segment->Get("end"))
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Time period segment ends before it begins"));
+
                result->Add(segment);
        }
 }