[Nagios-checkins] nagios/xdata xodtemplate.c,1.71,1.72
Nagios network monitoring software is enterprise server monitoring
Brought to you by:
egalstad,
sawolf-nagios
From: Ethan G. <ega...@us...> - 2004-03-25 01:14:39
|
Update of /cvsroot/nagios/nagios/xdata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22477/xdata Modified Files: xodtemplate.c Log Message: Bug fixes Index: xodtemplate.c =================================================================== RCS file: /cvsroot/nagios/nagios/xdata/xodtemplate.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** xodtemplate.c 24 Mar 2004 05:22:03 -0000 1.71 --- xodtemplate.c 25 Mar 2004 01:03:56 -0000 1.72 *************** *** 4,8 **** * * Copyright (c) 2001-2004 Ethan Galstad (na...@na...) ! * Last Modified: 03-23-2004 * * Description: --- 4,8 ---- * * Copyright (c) 2001-2004 Ethan Galstad (na...@na...) ! * Last Modified: 03-24-2004 * * Description: *************** *** 6494,6497 **** --- 6494,6499 ---- #endif free(member_names); + free(host_name); + free(service_description); return ERROR; } *************** *** 6528,6538 **** service_description=NULL; } - - /* in case there isn't a matching service description... */ - free(host_name); - host_name=NULL; } free(member_names); } --- 6530,6547 ---- service_description=NULL; } } free(member_names); + + /* error if there were an odd number of items specified (unmatched host/service pair) */ + if(host_name!=NULL){ + #ifdef NSCORE + snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Servicegroup members must be specified in <host_name>,<service_description> pairs (config file '%s', starting on line %d)\n",xodtemplate_config_file_name(temp_service->_config_file),temp_service->_start_line); + temp_buffer[sizeof(temp_buffer)-1]='\x0'; + write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE); + #endif + free(host_name); + return ERROR; + } } *************** *** 9335,9352 **** else{ ! /* this hostgroup should be excluded (rejected) */ ! if(temp_ptr[0]=='!'){ ! reject_item=TRUE; ! temp_ptr++; } ! /* find the hostgroup */ ! temp_hostgroup=xodtemplate_find_real_hostgroup(temp_ptr); ! if(temp_hostgroup!=NULL){ ! found_match=TRUE; ! /* add hostgroup members to proper list */ ! xodtemplate_add_hostgroup_members_to_hostlist((reject_item==TRUE)?reject_list:list,temp_hostgroup); } } --- 9344,9377 ---- else{ ! /* return a list of all hostgroups */ ! if(!strcmp(temp_ptr,"*")){ ! ! found_match=TRUE; ! ! for(temp_hostgroup=xodtemplate_hostgroup_list;temp_hostgroup!=NULL;temp_hostgroup=temp_hostgroup->next){ ! ! /* add hostgroup to list */ ! xodtemplate_add_hostgroup_members_to_hostlist(list,temp_hostgroup); ! } } ! /* else this is just a single hostgroup... */ ! else{ ! ! /* this hostgroup should be excluded (rejected) */ ! if(temp_ptr[0]=='!'){ ! reject_item=TRUE; ! temp_ptr++; ! } ! /* find the hostgroup */ ! temp_hostgroup=xodtemplate_find_real_hostgroup(temp_ptr); ! if(temp_hostgroup!=NULL){ ! found_match=TRUE; ! ! /* add hostgroup members to proper list */ ! xodtemplate_add_hostgroup_members_to_hostlist((reject_item==TRUE)?reject_list:list,temp_hostgroup); ! } } } *************** *** 9718,9735 **** else{ ! /* this servicegroup should be excluded (rejected) */ ! if(temp_ptr[0]=='!'){ ! reject_item=TRUE; ! temp_ptr++; ! } ! ! /* find the servicegroup */ ! temp_servicegroup=xodtemplate_find_real_servicegroup(temp_ptr); ! if(temp_servicegroup!=NULL){ found_match=TRUE; ! /* add servicegroup members to list */ ! xodtemplate_add_servicegroup_members_to_servicelist((reject_item==TRUE)?reject_list:list,temp_servicegroup); } } --- 9743,9776 ---- else{ ! /* return a list of all servicegroups */ ! if(!strcmp(temp_ptr,"*")){ found_match=TRUE; ! for(temp_servicegroup=xodtemplate_servicegroup_list;temp_servicegroup!=NULL;temp_servicegroup=temp_servicegroup->next){ ! ! /* add servicegroup to list */ ! xodtemplate_add_servicegroup_members_to_servicelist(list,temp_servicegroup); ! } ! } ! ! /* else this is just a single servicegroup... */ ! else{ ! ! /* this servicegroup should be excluded (rejected) */ ! if(temp_ptr[0]=='!'){ ! reject_item=TRUE; ! temp_ptr++; ! } ! ! /* find the servicegroup */ ! temp_servicegroup=xodtemplate_find_real_servicegroup(temp_ptr); ! if(temp_servicegroup!=NULL){ ! ! found_match=TRUE; ! ! /* add servicegroup members to list */ ! xodtemplate_add_servicegroup_members_to_servicelist((reject_item==TRUE)?reject_list:list,temp_servicegroup); ! } } } |