Re: [Nagios-devel] [Nagios-users] Bug in 3.0.2 with service

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

Re: [Nagios-devel] [Nagios-users] Bug in 3.0.2 with service

Post by Guest »

Hi Mathieu,

Thanks so much for this patch - I'll apply it tonight and see what
happens. I'm only a beginner in C (wrote my first full program in it
yesterday!) so I can sort of understand this code. It took me a while
to see where the problem lay, but now I can - it seems to be splitting
by either a comma or a space in service escalations, but not in host
escalations.

It would be good if somebody could clear up the "intended" practice -
whether Nagios should, or should not, accept spaces in name fields as
there does seem to be some confusion! Which other directives use a
space as their field separators? Other fields such as
notification_options use commas, which was why I thought it was OK to
use spaces in names.

Thanks again,

Andy

Mathieu Gagné wrote:
> 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é





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