]> granicus.if.org Git - icinga2/commitdiff
Don't allow config items to inherit from themselves.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 7 May 2013 07:14:23 +0000 (09:14 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 7 May 2013 07:14:23 +0000 (09:14 +0200)
Fixes #4045

lib/config/configitembuilder.cpp

index 111f42b6a1f7510f38916c496665552d159cf30f..cbe1b6014557a7fb2f949d164242c455fac4ac75 100644 (file)
@@ -110,6 +110,11 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void)
                BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
        }
 
+       BOOST_FOREACH(const String& parent, m_Parents) {
+               if (parent == m_Name)
+                       BOOST_THROW_EXCEPTION(std::invalid_argument("Configuration item '" + m_Name + "' of type '" + m_Type + "' must not inherit from itself."));
+       }
+
        ExpressionList::Ptr exprl = boost::make_shared<ExpressionList>();
 
        Expression execExpr("", OperatorExecute, m_ExpressionList, m_DebugInfo);