diff -rup nagios-2.0b4/base/config.c nagios-2.0b4.new/base/config.c
--- nagios-2.0b4/base/config.c	2005-03-15 01:31:13.000000000 +0100
+++ nagios-2.0b4.new/base/config.c	2005-12-13 17:38:31.289925624 +0100
@@ -1843,6 +1843,12 @@ int pre_flight_check(void){
 			warnings++;
 			}
 
+		if (temp_host->community==NULL) {
+			snprintf(temp_buffer,sizeof(temp_buffer),"Warning: Host '%s' has no community defined!",temp_host->name);
+			temp_buffer[sizeof(temp_buffer)-1]='\x0';
+			write_to_logs_and_console(temp_buffer,NSLOG_VERIFICATION_WARNING,TRUE);
+			warnings++;
+		}
 		found=FALSE;
 
 #ifdef REMOVED_061303
Only in nagios-2.0b4.new/base: Makefile
diff -rup nagios-2.0b4/base/utils.c nagios-2.0b4.new/base/utils.c
--- nagios-2.0b4/base/utils.c	2005-06-12 01:30:38.000000000 +0200
+++ nagios-2.0b4.new/base/utils.c	2005-11-11 17:46:39.000000000 +0100
@@ -931,6 +931,10 @@ int grab_host_macros(host *hst){
 	if(temp_hostgroup!=NULL)
 		macro_x[MACRO_HOSTGROUPALIAS]=strdup(temp_hostgroup->alias);
 
+	if(macro_x[MACRO_SNMPCOMMUNITY]!=NULL)
+		free(macro_x[MACRO_SNMPCOMMUNITY]);
+	macro_x[MACRO_SNMPCOMMUNITY]=strdup(hst->community);
+
 	if((temp_hostextinfo=find_hostextinfo(hst->name))){
 
 		/* get the action url */
@@ -1266,6 +1270,8 @@ int grab_on_demand_host_macro(host *hst,
 			strip(macro_ondemand);
 		        }
 	        }
+	else if(!strcmp(macro,"SNMPCOMMUNITY"))
+		macro_ondemand=strdup(hst->community);
 
 	/* get the performance data */
 	else if(!strcmp(macro,"HOSTPERFDATA")){
@@ -2389,6 +2395,7 @@ int init_macrox_names(void){
 	add_macrox_name(MACRO_PROCESSSTARTTIME,"PROCESSSTARTTIME");
 	add_macrox_name(MACRO_HOSTCHECKTYPE,"HOSTCHECKTYPE");
 	add_macrox_name(MACRO_SERVICECHECKTYPE,"SERVICECHECKTYPE");
+	add_macrox_name(MACRO_SNMPCOMMUNITY,"SNMPCOMMUNITY");
 
 #ifdef DEBUG0
 	printf("init_macrox_names() end\n");
Only in nagios-2.0b4.new/cgi: Makefile
Only in nagios-2.0b4.new/common: Makefile
diff -rup nagios-2.0b4/common/objects.c nagios-2.0b4.new/common/objects.c
--- nagios-2.0b4/common/objects.c	2005-06-13 06:23:23.000000000 +0200
+++ nagios-2.0b4.new/common/objects.c	2005-12-13 17:33:42.868772304 +0100
@@ -923,7 +923,7 @@ timerange *add_timerange_to_timeperiod(t
 
 
 /* add a new host definition */
-host *add_host(char *name, char *alias, char *address, char *check_period, int check_interval, int max_attempts, int notify_up, int notify_down, int notify_unreachable, int notify_flapping, int notification_interval, char *notification_period, int notifications_enabled, char *check_command, int checks_enabled, int accept_passive_checks, char *event_handler, int event_handler_enabled, int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, int stalk_up, int stalk_down, int stalk_unreachable, int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int check_freshness, int freshness_threshold, int retain_status_information, int retain_nonstatus_information, int obsess_over_host){
+host *add_host(char *name, char *alias, char *address, char *check_period, int check_interval, int max_attempts, int notify_up, int notify_down, int notify_unreachable, int notify_flapping, int notification_interval, char *notification_period, int notifications_enabled, char *check_command, int checks_enabled, int accept_passive_checks, char *event_handler, int event_handler_enabled, int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, int stalk_up, int stalk_down, int stalk_unreachable, int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int check_freshness, int freshness_threshold, int retain_status_information, int retain_nonstatus_information, int obsess_over_host,char *community){
 	host *temp_host;
 	host *new_host;
 #ifdef NSCORE
@@ -951,6 +951,7 @@ host *add_host(char *name, char *alias, 
 	strip(check_command);
 	strip(event_handler);
 	strip(notification_period);
+	strip(community);
 
 	if(!strcmp(name,"") || !strcmp(alias,"") || !strcmp(address,"")){
 #ifdef NSCORE
@@ -1194,6 +1195,21 @@ host *add_host(char *name, char *alias, 
 		free(new_host);
 		return NULL;
 	        }
+	if (community==NULL) {	
+		new_host->community=NULL;
+	} else {
+		new_host->community=strdup(community);
+		if(new_host->community==NULL){
+#ifdef NSCORE
+			snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not allocate memory for host '%s' community\n",name);
+			temp_buffer[sizeof(temp_buffer)-1]='\x0';
+			write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE);
+#endif
+			free(new_host->community);
+			free(new_host);
+			return NULL;
+			}
+	}
 	new_host->address=strdup(address);
 	if(new_host->address==NULL){
 #ifdef NSCORE
Only in nagios-2.0b4.new/contrib: Makefile
Only in nagios-2.0b4.new: daemon-init
Only in nagios-2.0b4.new/html: index.html
Only in nagios-2.0b4.new/html: Makefile
Only in nagios-2.0b4.new/html: side.html
Only in nagios-2.0b4.new/include: cgiutils.h
Only in nagios-2.0b4.new/include: config.h
Only in nagios-2.0b4.new/include: locations.h
Only in nagios-2.0b4.new/include: Makefile
Only in nagios-2.0b4.new/include: nagios.h
diff -rup nagios-2.0b4/include/objects.h nagios-2.0b4.new/include/objects.h
--- nagios-2.0b4/include/objects.h	2004-11-06 06:44:13.000000000 +0100
+++ nagios-2.0b4.new/include/objects.h	2005-11-11 17:19:36.000000000 +0100
@@ -191,6 +191,7 @@ typedef struct host_struct{
 	unsigned long total_service_check_interval;
 	unsigned long modified_attributes;
 #endif
+	char	*community;
 	struct  host_struct *next;
 	struct  host_struct *nexthash;
         }host;
@@ -516,7 +517,7 @@ int read_object_config_data(char *,int,i
 contact *add_contact(char *,char *,char *,char *,char **,char *,char *,int,int,int,int,int,int,int,int,int);	/* adds a contact definition */
 commandsmember *add_service_notification_command_to_contact(contact *,char *);				/* adds a service notification command to a contact definition */
 commandsmember *add_host_notification_command_to_contact(contact *,char *);				/* adds a host notification command to a contact definition */
-host *add_host(char *,char *,char *,char *,int,int,int,int,int,int,int,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,char *,int,int,int,int,int);	/* adds a host definition */
+host *add_host(char *,char *,char *,char *,int,int,int,int,int,int,int,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,char *,int,int,int,int,int,char *);	/* adds a host definition */
 hostsmember *add_parent_host_to_host(host *,char *);							/* adds a parent host to a host definition */
 contactgroupsmember *add_contactgroup_to_host(host *,char *);					        /* adds a contactgroup to a host definition */
 timeperiod *add_timeperiod(char *,char *);								/* adds a timeperiod definition */
Only in nagios-2.0b4.new/include: snprintf.h
Only in nagios-2.0b4.new: Makefile
Only in nagios-2.0b4.new/module: Makefile
Only in nagios-2.0b4.new: pkginfo
Only in nagios-2.0b4.new/sample-config: cgi.cfg
Only in nagios-2.0b4.new/sample-config: httpd.conf
Only in nagios-2.0b4.new/sample-config: nagios.cfg
Only in nagios-2.0b4.new/sample-config: resource.cfg
Only in nagios-2.0b4.new/sample-config/template-object: bigger.cfg
Only in nagios-2.0b4.new/sample-config/template-object: checkcommands.cfg
Only in nagios-2.0b4.new/sample-config/template-object: minimal.cfg
Only in nagios-2.0b4.new/sample-config/template-object: misccommands.cfg
Only in nagios-2.0b4.new: subst
Only in nagios-2.0b4.new/xdata: Makefile
diff -rup nagios-2.0b4/xdata/xodtemplate.c nagios-2.0b4.new/xdata/xodtemplate.c
--- nagios-2.0b4/xdata/xodtemplate.c	2005-08-03 01:58:26.000000000 +0200
+++ nagios-2.0b4.new/xdata/xodtemplate.c	2005-11-11 17:46:39.000000000 +0100
@@ -1273,6 +1273,7 @@ int xodtemplate_begin_object_definition(
 		new_host->register_object=TRUE;
 		new_host->_config_file=config_file;
 		new_host->_start_line=start_line;
+		new_host->community=NULL;
 
 		/* add new host to head of list in memory */
 		new_host->next=xodtemplate_host_list;
@@ -2765,6 +2766,15 @@ int xodtemplate_add_object_property(char
 		        }
 		else if(!strcmp(variable,"register"))
 			temp_host->register_object=(atoi(value)>0)?TRUE:FALSE;
+		else if(!strcmp(variable,"community")){
+			temp_host->community=strdup(value);
+			if(temp_host->community==NULL){
+#ifdef DEBUG1
+				printf("Error: Could not allocate memory for community name.\n");
+#endif
+				return ERROR;
+			        }
+		        }
 		else{
 #ifdef NSCORE
 			snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Invalid host object directive '%s'.\n",variable);
@@ -7896,7 +7906,7 @@ int xodtemplate_register_host(xodtemplat
 		this_host->address=strdup(this_host->host_name);
 
 	/* add the host definition */
-	new_host=add_host(this_host->host_name,this_host->alias,(this_host->address==NULL)?this_host->host_name:this_host->address,this_host->check_period,this_host->check_interval,this_host->max_check_attempts,this_host->notify_on_recovery,this_host->notify_on_down,this_host->notify_on_unreachable,this_host->notify_on_flapping,this_host->notification_interval,this_host->notification_period,this_host->notifications_enabled,this_host->check_command,this_host->active_checks_enabled,this_host->passive_checks_enabled,this_host->event_handler,this_host->event_handler_enabled,this_host->flap_detection_enabled,this_host->low_flap_threshold,this_host->high_flap_threshold,this_host->stalk_on_up,this_host->stalk_on_down,this_host->stalk_on_unreachable,this_host->process_perf_data,this_host->failure_prediction_enabled,this_host->failure_prediction_options,this_host->check_freshness,this_host->freshness_threshold,this_host->retain_status_information,this_host->retain_nonstatus_information,this_host->obsess_over_host);
+	new_host=add_host(this_host->host_name,this_host->alias,(this_host->address==NULL)?this_host->host_name:this_host->address,this_host->check_period,this_host->check_interval,this_host->max_check_attempts,this_host->notify_on_recovery,this_host->notify_on_down,this_host->notify_on_unreachable,this_host->notify_on_flapping,this_host->notification_interval,this_host->notification_period,this_host->notifications_enabled,this_host->check_command,this_host->active_checks_enabled,this_host->passive_checks_enabled,this_host->event_handler,this_host->event_handler_enabled,this_host->flap_detection_enabled,this_host->low_flap_threshold,this_host->high_flap_threshold,this_host->stalk_on_up,this_host->stalk_on_down,this_host->stalk_on_unreachable,this_host->process_perf_data,this_host->failure_prediction_enabled,this_host->failure_prediction_options,this_host->check_freshness,this_host->freshness_threshold,this_host->retain_status_information,this_host->retain_nonstatus_information,this_host->obsess_over_host,this_host->community);
 
 	/* return with an error if we couldn't add the host */
 	if(new_host==NULL){
diff -rup nagios-2.0b4/xdata/xodtemplate.h nagios-2.0b4.new/xdata/xodtemplate.h
--- nagios-2.0b4/xdata/xodtemplate.h	2004-10-25 07:05:57.000000000 +0200
+++ nagios-2.0b4.new/xdata/xodtemplate.h	2005-11-11 16:24:19.000000000 +0100
@@ -207,6 +207,7 @@ typedef struct xodtemplate_host_struct{
 
 	int       has_been_resolved;
 	int       register_object;
+	char      *community;
 	struct xodtemplate_host_struct *next;
         }xodtemplate_host;
 
