[icinga-checkins] icinga.org: icinga-core/next: core: do not export host/ servicegroupmembers as environment macros in large installations

git at icinga.org git at icinga.org
Fri Apr 26 18:54:10 CEST 2013


Module: icinga-core
Branch: next
Commit: 6b1392a9aa12f23bae268ac040931f0cb812d1f4
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=6b1392a9aa12f23bae268ac040931f0cb812d1f4

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Fri Apr 26 18:15:38 2013 +0200

core: do not export host/servicegroupmembers as environment macros in large installations

this is only true when environment macros are enabled (not the default),
as well as large installation tweaks must be set too. it's likely that
large installations will expose too heavy member strings for the env,
breaking it all - this is just a workaround for the real problem, which
cannot be fixed by icinga itsself, as we wouldn't know on putenv how big
the environment can be once exexcve calls the envp arguments, altogether
with the command line params and existing environment. for details,
check the issue itsself.

refs #3859

---

 Changelog       |    1 +
 common/macros.c |   24 ++++++++++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/Changelog b/Changelog
index 3084dd2..3bf938f 100644
--- a/Changelog
+++ b/Changelog
@@ -64,6 +64,7 @@ FIXES
 * core: revamp USE_LTDL definitions in nebmods (Andreas Ericsson, op5 Team) #3817 - MF
 * core: fix unable to exclude hostgroups when using nested hostgroups (Alexander Sulfrian) #2619 - MF
 * core: fix checkresult reaper cleanup fails due to relative file path #3937 - MaF
+* core: do not export host/servicegroupmembers as environment macros in large installations #3859 - MF
 
 * idoutils: fix many memory leaks in ido2db on dbi_result_free and others (thx Klaus Wagner) #3406 - MF
 * idoutils: fix ido2db crashes when Oracle queries fail #3324 - GB
diff --git a/common/macros.c b/common/macros.c
index dfe8eb6..a01dc2c 100644
--- a/common/macros.c
+++ b/common/macros.c
@@ -3383,24 +3383,32 @@ int set_all_macro_environment_vars(int set) {
 int set_macrox_environment_vars_r(icinga_macros *mac, int set) {
 	register int x = 0;
 	int free_macro = FALSE;
-	int generate_macro = TRUE;
 
 	/* set each of the macrox environment variables */
 	for (x = 0; x < MACRO_X_COUNT; x++) {
 
 		free_macro = FALSE;
 
+		if (use_large_installation_tweaks == TRUE) {
+
+			/* skip summary macro generation if large installation tweaks are enabled */
+			if (x >= MACRO_TOTALHOSTSUP && x <= MACRO_TOTALSERVICEPROBLEMSUNHANDLED)
+				continue;
+
+			/* skip groupmembers macro generation
+			 * if large installation tweaks are enabled
+			 * they may break environment macros, check
+			 * https://dev.icinga.org/issues/3859
+			 */
+			if (x == MACRO_HOSTGROUPMEMBERS || x == MACRO_SERVICEGROUPMEMBERS)
+				continue;
+		}
+
 		/* generate the macro value if it hasn't already been done */
 		/* THIS IS EXPENSIVE */
 		if (set == TRUE) {
 
-			generate_macro = TRUE;
-
-			/* skip summary macro generation if lage installation tweaks are enabled */
-			if ((x >= MACRO_TOTALHOSTSUP && x <= MACRO_TOTALSERVICEPROBLEMSUNHANDLED) && use_large_installation_tweaks == TRUE)
-				generate_macro = FALSE;
-
-			if (mac->x[x] == NULL && generate_macro == TRUE)
+			if (mac->x[x] == NULL)
 				grab_macrox_value_r(mac, x, NULL, NULL, &mac->x[x], &free_macro);
 		}
 





More information about the icinga-checkins mailing list