diff -ur nagios-2.9.original/html/docs/xodtemplate.html nagios-2.9/html/docs/xodtemplate.html --- nagios-2.9.original/html/docs/xodtemplate.html 2007-06-15 13:37:50.000000000 +0100 +++ nagios-2.9/html/docs/xodtemplate.html 2007-06-15 13:40:15.000000000 +0100 @@ -949,7 +949,7 @@ contactgroup_namecontactgroup_name aliasalias -membersmembers +membersmembers    } diff -ur nagios-2.9.original/xdata/xodtemplate.c nagios-2.9/xdata/xodtemplate.c --- nagios-2.9.original/xdata/xodtemplate.c 2007-06-15 13:37:51.000000000 +0100 +++ nagios-2.9/xdata/xodtemplate.c 2007-06-15 13:41:31.000000000 +0100 @@ -7721,7 +7721,7 @@ return ERROR; } - /* add all members to the contact group */ + /* Altinity patch: Disable this error as members can be added from hosts or services definitions if(this_contactgroup->members==NULL){ #ifdef NSCORE snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Contactgroup has no members (config file '%s', starting on line %d)\n",xodtemplate_config_file_name(this_contactgroup->_config_file),this_contactgroup->_start_line); @@ -7730,18 +7730,21 @@ #endif return ERROR; } - for(contact_name=strtok(this_contactgroup->members,",");contact_name!=NULL;contact_name=strtok(NULL,",")){ - strip(contact_name); - new_contactgroupmember=add_contact_to_contactgroup(new_contactgroup,contact_name); - if(new_contactgroupmember==NULL){ + */ + /* add all members to the contact group */ + if(this_contactgroup->members!=NULL) + for(contact_name=strtok(this_contactgroup->members,",");contact_name!=NULL;contact_name=strtok(NULL,",")){ + strip(contact_name); + new_contactgroupmember=add_contact_to_contactgroup(new_contactgroup,contact_name); + if(new_contactgroupmember==NULL){ #ifdef NSCORE - snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not add contact '%s' to contactgroup (config file '%s', starting on line %d)\n",contact_name,xodtemplate_config_file_name(this_contactgroup->_config_file),this_contactgroup->_start_line); - temp_buffer[sizeof(temp_buffer)-1]='\x0'; - write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE); + snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not add contact '%s' to contactgroup (config file '%s', starting on line %d)\n",contact_name,xodtemplate_config_file_name(this_contactgroup->_config_file),this_contactgroup->_start_line); + temp_buffer[sizeof(temp_buffer)-1]='\x0'; + write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE); #endif - return ERROR; - } - } + return ERROR; + } + } #ifdef DEBUG0 printf("xodtemplate_register_contactgroup() end\n"); @@ -10978,9 +10981,17 @@ return ERROR; } - /* add new item to head of list */ - new_item->next=*list; - *list=new_item; + /* Altinity patch: adding to end of list preserves order for testing */ + /* add new item to end of list */ + new_item->next=NULL; + temp_item = *list; + if (temp_item == NULL) + *list = new_item; + else { + while (temp_item->next) + temp_item = temp_item->next; + temp_item->next = new_item; + } return OK; }