[Nagios-devel] [PATCH] xodtemplate: Don't use space as a delimiter

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

[Nagios-devel] [PATCH] xodtemplate: Don't use space as a delimiter

Postby Guest » Wed May 08, 2013 3:38 pm

contact_names are allowed to have spaces in them, so using space as a
delimiter doesn't really work. Space is thus not a valid delimiter for
contacts anywhere, except in escalations, where it is only valid after
the first comma. So you could have one contact with a space in its name,
as long as you put it first - and no more than that!

This patch allows you to have as many contacts with as many spaces as
you want in your escalations.

Signed-off-by: Robin Sonefors
---
xdata/xodtemplate.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
index bb1e14d..f1fe86e 100644
--- a/xdata/xodtemplate.c
+++ b/xdata/xodtemplate.c
@@ -7358,7 +7358,7 @@ int xodtemplate_register_serviceescalation(xodtemplate_serviceescalation *this_s
/* add the contact groups */
if(this_serviceescalation->contact_groups != NULL) {

- for(contact_group = strtok(this_serviceescalation->contact_groups, ","); contact_group != NULL; contact_group = strtok(NULL, ", ")) {
+ for(contact_group = strtok(this_serviceescalation->contact_groups, ","); contact_group != NULL; contact_group = strtok(NULL, ",")) {

strip(contact_group);
new_contactgroupsmember = add_contactgroup_to_serviceescalation(new_serviceescalation, contact_group);
@@ -7372,7 +7372,7 @@ int xodtemplate_register_serviceescalation(xodtemplate_serviceescalation *this_s
/* add the contacts */
if(this_serviceescalation->contacts != NULL) {

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

strip(contact_name);
new_contactsmember = add_contact_to_serviceescalation(new_serviceescalation, contact_name);
@@ -7715,7 +7715,7 @@ int xodtemplate_register_hostescalation(xodtemplate_hostescalation *this_hostesc
/* add the contacts */
if(this_hostescalation->contacts != NULL) {

- for(contact_name = strtok(this_hostescalation->contacts, ","); contact_name != NULL; contact_name = strtok(NULL, ", ")) {
+ for(contact_name = strtok(this_hostescalation->contacts, ","); contact_name != NULL; contact_name = strtok(NULL, ",")) {

strip(contact_name);
new_contactsmember = add_contact_to_hostescalation(new_hostescalation, contact_name);
--
1.7.11.7






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: robin.sonefors@op5.com
Guest
 

Return to Community Support

Who is online

Users browsing this forum: No registered users and 13 guests