[Nagios-devel] Bug in 3.0.1 config (host dependency) parsing

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Bug in 3.0.1 config (host dependency) parsing

Post by Guest »

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
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





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked