[icinga-checkins] icinga.org: icinga2/master: Don' t allow config items to inherit from themselves.

git at icinga.org git at icinga.org
Tue May 7 09:14:44 CEST 2013


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue May  7 09:14:23 2013 +0200

Don't allow config items to inherit from themselves.

Fixes #4045

---

 lib/config/configitembuilder.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp
index 111f42b..cbe1b60 100644
--- a/lib/config/configitembuilder.cpp
+++ b/lib/config/configitembuilder.cpp
@@ -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);





More information about the icinga-checkins mailing list