Bug in 3.0.1 config (host dependency) parsing

Ralph Rößner roessner at capcom.de
Thu Apr 3 16:05:30 CEST 2008


Hi list,

while upgrading to Nagios v3 I have run into phantom circular host
dependencies (i.e. host A depends on host C, host B depends on host C,
nagios reports a circular dependency). Tracing the unexpected behaviour
has lead to this code in base/config.c (ll 2493-2501 in HEAD):


                /* find the dependent host */
                temp_host=find_host(temp_hd->dependent_host_name);
                if(temp_host==NULL){
                        logit(NSLOG_VERIFICATION_ERROR,TRUE,"Error: Dependent host specified in host dependency for host '%s' is not defined anywhere!",temp_hd->dependent_host_name);
                        errors++;
                        }

                /* save pointer for later */
                temp_hd->dependent_host_ptr=temp_host2;


You see that the looked up host is assigned to "temp_host" but saved for
later use in the dependency detection code is "temp_host2", which has
more or less random content at this time.

Applying the following patch has restored the expected behaviour for me:


--- nagios-cvs/base/config.c.orig	2008-04-03 15:35:31.000000000 +0200
+++ nagios-cvs/base/config.c	2008-04-03 15:35:34.000000000 +0200
@@ -2498,7 +2498,7 @@
 		        }
 
 		/* save pointer for later */
-		temp_hd->dependent_host_ptr=temp_host2;
+		temp_hd->dependent_host_ptr=temp_host;
 
 		/* find the host we're depending on */
 		temp_host2=find_host(temp_hd->host_name);


Sincerely,
   Ralph Rößner


-- 
Ralph Rößner
CAPCom AG < http://www.capcom.de >
Rundeturmstr. 10, 64283 Darmstadt, Germany
Phone +49 6151 155 900, Fax +49 6151 155 909

Vorstand: Luc Neumann (Vorsitzender)
Vorsitzender des Aufsichtsrats: Prof. Dr.-Ing. José L. Encarnação
Sitz der Gesellschaft: Darmstadt, Registergericht: Darmstadt HRB 8090

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace




More information about the Developers mailing list