The attached patch fixes a problem with parsing service dependency templates that specify "hostgroups" without "dependent_hostgroups" or vice versa.  The following config snippet triggers the bug:

define host {
        use generic-host
        host_name b
}

define hostgroup {
        hostgroup_name test-hg
        members a,b
}

define servicedependency {
        register 0
        name base-sd
        hostgroups test-hg
}

Since it's a template and not a full object, the servicedependency should be
valid, but Nagios reports "Could not expand dependent hostgroups and/or hosts 
specified in service dependency" instead.


*** nagios-2.5/xdata/xodtemplate.c.orig	Wed Oct 11 23:13:45 2006
--- nagios-2.5/xdata/xodtemplate.c	Wed Oct 11 23:17:23 2006
***************
*** 4060,4066 ****
  	for(temp_hostdependency=xodtemplate_hostdependency_list;temp_hostdependency!=NULL;temp_hostdependency=temp_hostdependency->next){
  		
  		/* skip host dependencies without enough data */
! 		if(temp_hostdependency->hostgroup_name==NULL && temp_hostdependency->dependent_hostgroup_name==NULL && temp_hostdependency->host_name==NULL && temp_hostdependency->dependent_host_name==NULL)
  			continue;
  
  		/* get list of master host names */
--- 4060,4066 ----
  	for(temp_hostdependency=xodtemplate_hostdependency_list;temp_hostdependency!=NULL;temp_hostdependency=temp_hostdependency->next){
  		
  		/* skip host dependencies without enough data */
! 		if((temp_hostdependency->hostgroup_name==NULL && temp_hostdependency->host_name==NULL) || (temp_hostdependency->dependent_hostgroup_name==NULL && temp_hostdependency->dependent_host_name==NULL))
  			continue;
  
  		/* get list of master host names */
***************
*** 4119,4125 ****
  	for(temp_servicedependency=xodtemplate_servicedependency_list;temp_servicedependency!=NULL;temp_servicedependency=temp_servicedependency->next){
  
  		/* skip service dependencies without enough data */
! 		if(temp_servicedependency->hostgroup_name==NULL && temp_servicedependency->dependent_hostgroup_name==NULL && temp_servicedependency->host_name==NULL && temp_servicedependency->dependent_host_name==NULL)
  			continue;
  
  		/* get list of master host names */
--- 4119,4125 ----
  	for(temp_servicedependency=xodtemplate_servicedependency_list;temp_servicedependency!=NULL;temp_servicedependency=temp_servicedependency->next){
  
  		/* skip service dependencies without enough data */
! 		if((temp_servicedependency->hostgroup_name==NULL && temp_servicedependency->host_name==NULL) || (temp_servicedependency->dependent_hostgroup_name==NULL && temp_servicedependency->dependent_host_name==NULL))
  			continue;
  
  		/* get list of master host names */
