Bug in 3.0.1 config (host dependency) parsing
Andreas Ericsson
ae at op5.se
Fri Apr 4 11:31:33 CEST 2008
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);
>
>
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
-------------------------------------------------------------------------
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