Bug in 3.0.1 config (host dependency) parsing
Ethan Galstad
nagios at nagios.org
Sun Apr 13 20:00:58 CEST 2008
Andreas Ericsson wrote:
> Ralph Rößner wrote:
>> 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.
>>
>
> Good eyes. The attached patch looks obviously correct.
>
>> 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);
>>
>>
>
Good eyes indeed! I'll get this into CVS momentarily. Thanks.
Ethan Galstad
Nagios Developer
___
Email: nagios at nagios.org
Web: www.nagios.org
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
More information about the Developers
mailing list