[Nagios-users] Bug in 3.0.2 with service escalation contact groups

Mathieu Gagné mgagne at iweb.com
Tue May 27 18:03:51 CEST 2008


Hi Andy,

Andy Shellam wrote:
> 
> I'm more inclined to think that the service escalation is wrong in its
> behaviour, but then I could be wrong?
> 

HostEscalation differs from ServiceEscalation as you can see in the 
source code:

File: xdata/xodtemplate.c

For ServiceEscalation

Line: 10251 (for contactgroups)
for(contact_group=strtok(this_serviceescalation->contact_groups,", 
");contact_group!=NULL;contact_group=strtok(NULL,", ")){

Line: 10265 (for contacts)
for(contact_name=strtok(this_serviceescalation->contacts,", 
");contact_name!=NULL;contact_name=strtok(NULL,", ")){


For HostEscalation

Line: 10397 (for contactgroups)
for(contact_group=strtok(this_host->contact_groups,",");contact_group!=NULL;contact_group=strtok(NULL,",")){

Line: 10413 (for contacts)
for(contact_name=strtok(this_host->contacts,",");contact_name!=NULL;contact_name=strtok(NULL,",")){


The white-space is considered a field separator for "contact_groups" in 
ServiceEscalation but not HostEscalation.

As an attachment is a patch which fixes this bug.

And for the records, somebody should cleanup the source code regarding 
this field separator glitch. The white-space is considered a field 
separator in a lot of places.

I'm not a C guru so I'm not sure if it's here on purpose or not and if 
"fixing" it breaks backward-compatibility.

--
Mathie Gagné
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: contactgroups-with-white-spaces.patch
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20080527/40eed282/attachment.ksh>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list