[Nagios-checkins] SF.net SVN: nagios:[2124] nagioscore/trunk/xdata/xodtemplate.c

ageric at users.sourceforge.net ageric at users.sourceforge.net
Wed Aug 29 15:20:04 UTC 2012


Revision: 2124
          http://nagios.svn.sourceforge.net/nagios/?rev=2124&view=rev
Author:   ageric
Date:     2012-08-29 15:20:04 +0000 (Wed, 29 Aug 2012)
Log Message:
-----------
xdata/xodtemplate: Fix host and service dependency counting

Previously we would allocate too little space for dependencies if
they were assigned to groups, since we failed to take into account
the duplicated dependencies. This patch fixes that, avoiding the
invalid writes we issued earlier that lead to (very) undefined
behaviour when we tried to handle whatever data we accidentally
overwrote.

Many thanks to Mark Frost for helping me locate this bug.

Signed-off-by: Andreas Ericsson <ae at op5.se>

Modified Paths:
--------------
    nagioscore/trunk/xdata/xodtemplate.c

Modified: nagioscore/trunk/xdata/xodtemplate.c
===================================================================
--- nagioscore/trunk/xdata/xodtemplate.c	2012-08-28 20:57:36 UTC (rev 2123)
+++ nagioscore/trunk/xdata/xodtemplate.c	2012-08-29 15:20:04 UTC (rev 2124)
@@ -5491,6 +5491,8 @@
 	/* add new hostdependency to head of list in memory */
 	new_hostdependency->next = xodtemplate_hostdependency_list;
 	xodtemplate_hostdependency_list = new_hostdependency;
+	host_deps += new_hostdependency->have_notification_dependency_options;
+	host_deps += new_hostdependency->have_execution_dependency_options;
 
 	return OK;
 	}
@@ -5586,6 +5588,8 @@
 	/* add new servicedependency to head of list in memory */
 	new_servicedependency->next = xodtemplate_servicedependency_list;
 	xodtemplate_servicedependency_list = new_servicedependency;
+	service_deps += new_servicedependency->have_notification_dependency_options;
+	service_deps += new_servicedependency->have_execution_dependency_options;
 
 	return OK;
 	}

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Nagios-commits mailing list