]> granicus.if.org Git - icinga2/commitdiff
Fix validator for TimePeriod ranges
authorGunnar Beutner <gunnar@beutner.name>
Tue, 3 Mar 2015 08:56:38 +0000 (09:56 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 3 Mar 2015 08:56:38 +0000 (09:56 +0100)
fixes #8568

lib/icinga/timeperiod.cpp

index f3ee7ee9ac2a30ffb73787e57f82070f0b4481d4..825e52e7cf0be99b44acbe7db87985bbf450b46a 100644 (file)
@@ -314,16 +314,16 @@ void TimePeriod::ValidateRanges(const String& location, const TimePeriod::Ptr& o
                return;
 
        /* create a fake time environment to validate the definitions */
-       time_t begin = Utility::GetTime();
-       time_t end = begin + 24 * 60 * 60;
-       tm reference = Utility::LocalTime(end);
-       tm begin_tm, end_tm;
+       time_t refts = Utility::GetTime();
+       tm reference = Utility::LocalTime(refts);
        Array::Ptr segments = new Array();
 
        ObjectLock olock(ranges);
        BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
                try {
-                       LegacyTimePeriod::ParseTimeSpec(kv.first, &begin_tm, &end_tm, &reference);
+                       tm begin_tm, end_tm;
+                       int stride;
+                       LegacyTimePeriod::ParseTimeRange(kv.first, &begin_tm, &end_tm, &stride, &reference);
                } catch (std::exception&) {
                        BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
                            location + ": Invalid time specification.", object->GetDebugInfo()));