[icinga-checkins] icinga.org: icinga2/master: Fix crash in CompatUtility:: GetCheckableCommandArgs

git at icinga.org git at icinga.org
Fri Nov 7 09:54:08 CET 2014


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

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Fri Nov  7 09:26:44 2014 +0100

Fix crash in CompatUtility::GetCheckableCommandArgs

refs #7599

---

 lib/icinga/compatutility.cpp |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp
index 2a69989..19a951d 100644
--- a/lib/icinga/compatutility.cpp
+++ b/lib/icinga/compatutility.cpp
@@ -126,6 +126,7 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
 		Dictionary::Ptr command_vars = command->GetVars();
 
 		if (command_vars) {
+			ObjectLock olock(command_vars);
 			BOOST_FOREACH(const Dictionary::Pair& kv, command_vars) {
 				String macro = "$" + kv.first + "$"; // this is too simple
 				if (command_line.Contains(macro))
@@ -137,6 +138,7 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
 		Dictionary::Ptr host_vars = host->GetVars();
 
 		if (host_vars) {
+			ObjectLock olock(host_vars);
 			BOOST_FOREACH(const Dictionary::Pair& kv, host_vars) {
 				String macro = "$" + kv.first + "$"; // this is too simple
 				if (command_line.Contains(macro))
@@ -151,6 +153,7 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
 			Dictionary::Ptr service_vars = service->GetVars();
 
 			if (service_vars) {
+				ObjectLock olock(service_vars);
 				BOOST_FOREACH(const Dictionary::Pair& kv, service_vars) {
 					String macro = "$" + kv.first + "$"; // this is too simple
 					if (command_line.Contains(macro))
@@ -163,6 +166,7 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
 		}
 
 		String arg_string;
+		ObjectLock olock(args);
 		BOOST_FOREACH(const Dictionary::Pair& kv, args) {
 			arg_string += Convert::ToString(kv.first) + "=" + Convert::ToString(kv.second) + "!";
 		}



More information about the icinga-checkins mailing list