Xymon Mailing List Archive search

[patch] cgi: checking if all needed environment variables are set (Was: Re: [hobbit] [bug?] Crash of hobbitsvc.cgi on trends column display)

list Gildas le Nadan
Wed, 29 Nov 2006 17:54:38 +0000
Message-Id: <user-2502efe805aa@xymon.invalid>

Ok, I went thru the /web directory and edited the cgi to add the crude environment checking I've been talking on earlier. Compiled cgis have been tested individually without parameters and in line as drop-in replacements for the existing cgi, "it works for me".

This patch applies to a hobbit-4.2.0 with the all-in-one patch applied using "patch -p1 <sanity_check.patch".

As always, feedback are welcome

Cheers
Gildas

Charles Goyard wrote:
Hi again,

As an extra info, I found the reason why the program crashes :

in loadhosts.c, when there :

if (result || !host->defaulthost || (strcasecmp(host->bbhostname, ".default.") == 0))
	return result;
else
	return bbh_find_item(host->defaulthost, item);

I get in the "else". At that point, host->defaulthost is not null, but
points to garbage. I dont't get what the default host should be.

(btw, thanks for the patch Gildas)