--- config.c.HEAD 2010-09-01 14:57:33.000000000 +0200
+++ config.c 2010-08-31 15:40:37.000000000 +0200
@@ -94,7 +94,6 @@
int display_type=DISPLAY_NONE;
char to_expand[MAX_COMMAND_BUFFER];
-char *command_args[MAX_COMMAND_ARGUMENTS];
char hashed_color[8];
int embedded=FALSE;
@@ -530,9 +529,9 @@
printf("
\n",bg_class);
printf("%s | \n",bg_class,
- url_encode(temp_host->name),CONFIG_CGI,url_encode(temp_host->name),temp_host->name);
- printf("%s | \n",bg_class,temp_host->alias);
- printf("%s | \n",bg_class,temp_host->address);
+ url_encode(temp_host->name),CONFIG_CGI,url_encode(temp_host->name),html_encode(temp_host->name,FALSE));
+ printf("%s | \n",bg_class,html_encode(temp_host->alias,FALSE));
+ printf("%s | \n",bg_class,html_encode(temp_host->address,FALSE));
printf("",bg_class);
for(temp_hostsmember=temp_host->parent_hosts;temp_hostsmember!=NULL;temp_hostsmember=temp_hostsmember->next){
@@ -540,7 +539,7 @@
if(temp_hostsmember!=temp_host->parent_hosts)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_hostsmember->host_name),temp_hostsmember->host_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_hostsmember->host_name),html_encode(temp_hostsmember->host_name,FALSE));
}
if(temp_host->parent_hosts==NULL)
printf(" ");
@@ -566,7 +565,7 @@
if(temp_host->check_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_host->check_period),temp_host->check_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_host->check_period),html_encode(temp_host->check_period,FALSE));
printf(" | \n");
printf("%s | \n",bg_class,(temp_host->obsess_over_host==TRUE)?"Yes":"No");
@@ -593,20 +592,20 @@
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),temp_contactsmember->contact_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),html_encode(temp_contactsmember->contact_name,FALSE));
}
for(temp_contactgroupsmember=temp_host->contact_groups;temp_contactgroupsmember!=NULL;temp_contactgroupsmember=temp_contactgroupsmember->next){
contact++;
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),temp_contactgroupsmember->group_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),html_encode(temp_contactgroupsmember->group_name,FALSE));
}
if(contact==0)
printf(" ");
printf("\n");
get_interval_time_string(temp_host->notification_interval,time_string,sizeof(time_string));
- printf("%s | \n",bg_class,(temp_host->notification_interval==0)?"No Re-notification":time_string);
+ printf("%s | \n",bg_class,(temp_host->notification_interval==0)?"No Re-notification":html_encode(time_string,FALSE));
get_interval_time_string(temp_host->first_notification_delay,time_string,sizeof(time_string));
printf("%s | \n",bg_class,time_string);
@@ -641,15 +640,15 @@
if(temp_host->notification_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_host->notification_period),temp_host->notification_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_host->notification_period),html_encode(temp_host->notification_period,FALSE));
printf("\n");
printf("",bg_class);
if(temp_host->event_handler==NULL)
printf(" ");
else
- /* printf("%s | \n",CONFIG_CGI,url_encode(strtok(temp_host->event_handler,"!")),temp_host->event_handler); */
- printf("%s\n",CONFIG_CGI,url_encode(temp_host->event_handler),temp_host->event_handler);
+ /* printf("%s\n",CONFIG_CGI,url_encode(strtok(temp_host->event_handler,"!")),html_encode(temp_host->event_handler,FALSE)); */
+ printf("%s\n",CONFIG_CGI,url_encode(temp_host->event_handler),html_encode(temp_host->event_handler,FALSE));
printf("\n");
printf("",bg_class);
@@ -718,13 +717,13 @@
printf("%s\n",(temp_host->failure_prediction_enabled==TRUE)?"Yes":"No");
printf(" | \n");
- printf("%s | \n",bg_class,(temp_host->failure_prediction_options==NULL)?" ":temp_host->failure_prediction_options);
+ printf("%s | \n",bg_class,(temp_host->failure_prediction_options==NULL)?" ":html_encode(temp_host->failure_prediction_options,FALSE));
- printf("%s | ",bg_class,(temp_host->notes==NULL)?" ":temp_host->notes);
+ printf("%s | ",bg_class,(temp_host->notes==NULL)?" ":html_encode(temp_host->notes,FALSE));
- printf("%s | ",bg_class,(temp_host->notes_url==NULL)?" ":temp_host->notes_url);
+ printf("%s | ",bg_class,(temp_host->notes_url==NULL)?" ":html_encode(temp_host->notes_url,FALSE));
- printf("%s | ",bg_class,(temp_host->action_url==NULL)?" ":temp_host->action_url);
+ printf("%s | ",bg_class,(temp_host->action_url==NULL)?" ":html_encode(temp_host->action_url,FALSE));
if(temp_host->have_2d_coords==FALSE)
printf(" | ",bg_class);
@@ -739,22 +738,22 @@
if(temp_host->statusmap_image==NULL)
printf(" | ",bg_class);
else
- printf(" %s | ",bg_class,url_logo_images_path,temp_host->statusmap_image,temp_host->statusmap_image);
+ printf(" %s | ",bg_class,url_logo_images_path,temp_host->statusmap_image,html_encode(temp_host->statusmap_image,FALSE));
if(temp_host->vrml_image==NULL)
printf(" | ",bg_class);
else
- printf(" %s | ",bg_class,url_logo_images_path,temp_host->vrml_image,temp_host->vrml_image);
+ printf(" %s | ",bg_class,url_logo_images_path,temp_host->vrml_image,html_encode(temp_host->vrml_image,FALSE));
if(temp_host->icon_image==NULL)
printf(" | ",bg_class);
else{
process_macros(temp_host->icon_image,&processed_string,0);
- printf(" %s | ",bg_class,url_logo_images_path,processed_string,temp_host->icon_image);
+ printf(" %s | ",bg_class,url_logo_images_path,processed_string,html_encode(temp_host->icon_image,FALSE));
free(processed_string);
}
- printf("%s | ",bg_class,(temp_host->icon_image_alt==NULL)?" ":temp_host->icon_image_alt);
+ printf("%s | ",bg_class,(temp_host->icon_image_alt==NULL)?" ":html_encode(temp_host->icon_image_alt,FALSE));
printf("",bg_class);
options=0;
@@ -824,9 +823,9 @@
printf(" |
\n",bg_class);
- printf("%s | ",bg_class,temp_hostgroup->group_name);
+ printf("%s | ",bg_class,html_encode(temp_hostgroup->group_name,FALSE));
- printf("%s | \n",bg_class,temp_hostgroup->alias);
+ printf("%s | \n",bg_class,html_encode(temp_hostgroup->alias,FALSE));
printf("",bg_class);
@@ -835,15 +834,15 @@
if(temp_hostsmember!=temp_hostgroup->members)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_hostsmember->host_name),temp_hostsmember->host_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_hostsmember->host_name),html_encode(temp_hostsmember->host_name,FALSE));
}
printf(" | \n");
- printf("%s | ",bg_class,(temp_hostgroup->notes==NULL)?" ":temp_hostgroup->notes);
+ printf("%s | ",bg_class,(temp_hostgroup->notes==NULL)?" ":html_encode(temp_hostgroup->notes,FALSE));
- printf("%s | ",bg_class,(temp_hostgroup->notes_url==NULL)?" ":temp_hostgroup->notes_url);
+ printf("%s | ",bg_class,(temp_hostgroup->notes_url==NULL)?" ":html_encode(temp_hostgroup->notes_url,FALSE));
- printf("%s | ",bg_class,(temp_hostgroup->action_url==NULL)?" ":temp_hostgroup->action_url);
+ printf("%s | ",bg_class,(temp_hostgroup->action_url==NULL)?" ":html_encode(temp_hostgroup->action_url,FALSE));
printf("
\n");
}
@@ -899,28 +898,28 @@
printf("\n",bg_class);
- printf("%s | ",bg_class,temp_servicegroup->group_name);
+ printf("%s | ",bg_class,html_encode(temp_servicegroup->group_name,FALSE));
- printf("%s | \n",bg_class,temp_servicegroup->alias);
+ printf("%s | \n",bg_class,html_encode(temp_servicegroup->alias,FALSE));
printf("",bg_class);
/* find all the services that are members of this servicegroup... */
for(temp_servicesmember=temp_servicegroup->members;temp_servicesmember!=NULL;temp_servicesmember=temp_servicesmember->next){
- printf("%s%s / ",(temp_servicesmember==temp_servicegroup->members)?"":", ",CONFIG_CGI,url_encode(temp_servicesmember->host_name),temp_servicesmember->host_name);
+ printf("%s%s / ",(temp_servicesmember==temp_servicegroup->members)?"":", ",CONFIG_CGI,url_encode(temp_servicesmember->host_name),html_encode(temp_servicesmember->host_name,FALSE));
printf("%s\n",url_encode(temp_servicesmember->service_description),temp_servicesmember->service_description);
+ printf("%s'>%s\n",url_encode(temp_servicesmember->service_description),html_encode(temp_servicesmember->service_description,FALSE));
}
printf(" | \n");
- printf("%s | ",bg_class,(temp_servicegroup->notes==NULL)?" ":temp_servicegroup->notes);
+ printf("%s | ",bg_class,(temp_servicegroup->notes==NULL)?" ":html_encode(temp_servicegroup->notes,FALSE));
- printf("%s | ",bg_class,(temp_servicegroup->notes_url==NULL)?" ":temp_servicegroup->notes_url);
+ printf("%s | ",bg_class,(temp_servicegroup->notes_url==NULL)?" ":html_encode(temp_servicegroup->notes_url,FALSE));
- printf("%s | ",bg_class,(temp_servicegroup->action_url==NULL)?" ":temp_servicegroup->action_url);
+ printf("%s | ",bg_class,(temp_servicegroup->action_url==NULL)?" ":html_encode(temp_servicegroup->action_url,FALSE));
printf("
\n");
}
@@ -984,10 +983,10 @@
printf("\n",bg_class);
- printf("%s | \n",bg_class,url_encode(temp_contact->name),temp_contact->name);
- printf("%s | \n",bg_class,temp_contact->alias);
- printf("%s | \n",bg_class,(temp_contact->email==NULL)?" ":temp_contact->email,(temp_contact->email==NULL)?" ":temp_contact->email);
- printf("%s | \n",bg_class,(temp_contact->pager==NULL)?" ":temp_contact->pager);
+ printf("%s | \n",bg_class,url_encode(temp_contact->name),html_encode(temp_contact->name,FALSE));
+ printf("%s | \n",bg_class,html_encode(temp_contact->alias,FALSE));
+ printf("%s | \n",bg_class,(temp_contact->email==NULL)?" ":url_encode(temp_contact->email),(temp_contact->email==NULL)?" ":html_encode(temp_contact->email,FALSE));
+ printf("%s | \n",bg_class,(temp_contact->pager==NULL)?" ":html_encode(temp_contact->pager,FALSE));
printf("",bg_class);
options=0;
@@ -1049,14 +1048,14 @@
if(temp_contact->service_notification_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_contact->service_notification_period),temp_contact->service_notification_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_contact->service_notification_period),html_encode(temp_contact->service_notification_period,FALSE));
printf(" | \n");
printf("\n",bg_class);
if(temp_contact->host_notification_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_contact->host_notification_period),temp_contact->host_notification_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_contact->host_notification_period),html_encode(temp_contact->host_notification_period,FALSE));
printf(" | \n");
printf("",bg_class);
@@ -1066,8 +1065,8 @@
if(temp_commandsmember!=temp_contact->service_notification_commands)
printf(", ");
- /* printf("%s",CONFIG_CGI,url_encode(strtok(temp_commandsmember->command,"!")),temp_commandsmember->command); */
- printf("%s",CONFIG_CGI,url_encode(temp_commandsmember->command),temp_commandsmember->command);
+ /* printf("%s",CONFIG_CGI,url_encode(strtok(temp_commandsmember->command,"!")),html_encode(temp_commandsmember->command,FALSE)); */
+ printf("%s",CONFIG_CGI,url_encode(temp_commandsmember->command),html_encode(temp_commandsmember->command,FALSE));
found=TRUE;
}
@@ -1082,8 +1081,8 @@
if(temp_commandsmember!=temp_contact->host_notification_commands)
printf(", ");
- /* printf("%s",CONFIG_CGI,url_encode(strtok(temp_commandsmember->command,"!")),temp_commandsmember->command); */
- printf("%s",CONFIG_CGI,url_encode(temp_commandsmember->command),temp_commandsmember->command);
+ /* printf("%s",CONFIG_CGI,url_encode(strtok(temp_commandsmember->command,"!")),html_encode(temp_commandsmember->command,FALSE)); */
+ printf("%s",CONFIG_CGI,url_encode(temp_commandsmember->command),html_encode(temp_commandsmember->command,FALSE));
found=TRUE;
}
@@ -1158,8 +1157,8 @@
printf(" |
\n",bg_class);
- printf("%s | \n",bg_class,url_encode(temp_contactgroup->group_name),temp_contactgroup->group_name);
- printf("%s | \n",bg_class,temp_contactgroup->alias);
+ printf("%s | \n",bg_class,url_encode(temp_contactgroup->group_name),html_encode(temp_contactgroup->group_name,FALSE));
+ printf("%s | \n",bg_class,html_encode(temp_contactgroup->alias,FALSE));
/* find all the contact who are members of this contact group... */
printf("",bg_class);
@@ -1168,7 +1167,7 @@
if(temp_contactsmember!=temp_contactgroup->members)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),temp_contactsmember->contact_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),html_encode(temp_contactsmember->contact_name,FALSE));
}
printf(" | \n");
@@ -1273,9 +1272,9 @@
printf("",url_encode(temp_service->description));
- printf("%s | \n",CONFIG_CGI,url_encode(temp_service->host_name),temp_service->host_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_service->host_name),html_encode(temp_service->host_name,FALSE));
- printf("%s | \n",bg_class,temp_service->description);
+ printf("%s | \n",bg_class,html_encode(temp_service->description,FALSE));
printf("%d | \n",bg_class,temp_service->max_attempts);
@@ -1286,15 +1285,16 @@
strncpy(command_line,temp_service->service_check_command,sizeof(command_line));
command_line[sizeof(command_line)-1]='\x0';
- command_name=strtok(command_line,"!");
+ command_name=strtok(strdup(command_line),"!");
- /* printf("%s | \n",bg_class,CONFIG_CGI,url_encode(command_name),html_encode(temp_service->service_check_command,FALSE)); */
- printf("%s | \n",bg_class,CONFIG_CGI,url_encode(temp_service->service_check_command),html_encode(temp_service->service_check_command,FALSE));
+ /* printf("%s | \n",bg_class,CONFIG_CGI,url_encode(command_name),html_encode(command_line,FALSE)); */
+ printf("%s | \n",bg_class,CONFIG_CGI,url_encode(command_line),html_encode(command_line,FALSE));
+ free(command_name);
printf("",bg_class);
if(temp_service->check_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_service->check_period),temp_service->check_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_service->check_period),html_encode(temp_service->check_period,FALSE));
printf(" | \n");
printf("%s | \n",bg_class,(temp_service->parallelize==TRUE)?"Yes":"No");
@@ -1322,13 +1322,13 @@
contact++;
if(contact>1)
printf(", ");
- printf("%s",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),temp_contactsmember->contact_name);
+ printf("%s",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),html_encode(temp_contactsmember->contact_name,FALSE));
}
for(temp_contactgroupsmember=temp_service->contact_groups;temp_contactgroupsmember!=NULL;temp_contactgroupsmember=temp_contactgroupsmember->next){
contact++;
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),temp_contactgroupsmember->group_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),html_encode(temp_contactgroupsmember->group_name,FALSE));
}
if(contact==0)
printf(" ");
@@ -1339,7 +1339,7 @@
printf("\n");
get_interval_time_string(temp_service->notification_interval,time_string,sizeof(time_string));
- printf("%s | \n",bg_class,(temp_service->notification_interval==0)?"No Re-notification":time_string);
+ printf("%s | \n",bg_class,(temp_service->notification_interval==0)?"No Re-notification":html_encode(time_string,FALSE));
get_interval_time_string(temp_service->first_notification_delay,time_string,sizeof(time_string));
printf("%s | \n",bg_class,time_string);
@@ -1377,14 +1377,14 @@
if(temp_service->notification_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_service->notification_period),temp_service->notification_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_service->notification_period),html_encode(temp_service->notification_period,FALSE));
printf("\n");
printf("",bg_class);
if(temp_service->event_handler==NULL)
printf(" ");
else
- /* printf("%s",CONFIG_CGI,url_encode(strtok(temp_service->event_handler,"!")),temp_service->event_handler); */
- printf("%s",CONFIG_CGI,url_encode(temp_service->event_handler),temp_service->event_handler);
+ /* printf("%s",CONFIG_CGI,url_encode(strtok(temp_service->event_handler,"!")),html_encode(temp_service->event_handler,FALSE)); */
+ printf("%s",CONFIG_CGI,url_encode(temp_service->event_handler),html_encode(temp_service->event_handler,FALSE));
printf(" | \n");
printf("",bg_class);
@@ -1461,23 +1461,23 @@
printf("%s\n",(temp_service->failure_prediction_enabled==TRUE)?"Yes":"No");
printf(" | \n");
- printf("%s | \n",bg_class,(temp_service->failure_prediction_options==NULL)?" ":temp_service->failure_prediction_options);
+ printf("%s | \n",bg_class,(temp_service->failure_prediction_options==NULL)?" ":html_encode(temp_service->failure_prediction_options,FALSE));
- printf("%s | ",bg_class,(temp_service->notes==NULL)?" ":temp_service->notes);
+ printf("%s | ",bg_class,(temp_service->notes==NULL)?" ":html_encode(temp_service->notes,FALSE));
- printf("%s | ",bg_class,(temp_service->notes_url==NULL)?" ":temp_service->notes_url);
+ printf("%s | ",bg_class,(temp_service->notes_url==NULL)?" ":html_encode(temp_service->notes_url,FALSE));
- printf("%s | ",bg_class,(temp_service->action_url==NULL)?" ":temp_service->action_url);
+ printf("%s | ",bg_class,(temp_service->action_url==NULL)?" ":html_encode(temp_service->action_url,FALSE));
if(temp_service->icon_image==NULL)
printf(" | ",bg_class);
else{
process_macros(temp_service->icon_image,&processed_string,0);
- printf(" %s | ",bg_class,url_logo_images_path,processed_string,temp_service->icon_image);
+ printf(" %s | ",bg_class,url_logo_images_path,processed_string,html_encode(temp_service->icon_image,FALSE));
free(processed_string);
}
- printf("%s | ",bg_class,(temp_service->icon_image_alt==NULL)?" ":temp_service->icon_image_alt);
+ printf("%s | ",bg_class,(temp_service->icon_image_alt==NULL)?" ":html_encode(temp_service->icon_image_alt,FALSE));
printf("",bg_class);
options=0;
@@ -1558,14 +1558,14 @@
printf(" |
\n",bg_class);
- printf("%s | \n",bg_class,url_encode(temp_timeperiod->name),temp_timeperiod->name);
- printf("%s | \n",bg_class,temp_timeperiod->alias);
+ printf("%s | \n",bg_class,url_encode(temp_timeperiod->name),html_encode(temp_timeperiod->name,FALSE));
+ printf("%s | \n",bg_class,html_encode(temp_timeperiod->alias,FALSE));
printf("",bg_class);
item=0;
for(temp_timeperiodexclusion=temp_timeperiod->exclusions;temp_timeperiodexclusion!=NULL;temp_timeperiodexclusion=temp_timeperiodexclusion->next){
item++;
- printf("%s%s",(item==1)?"":", ",url_encode(temp_timeperiodexclusion->timeperiod_name),temp_timeperiodexclusion->timeperiod_name);
+ printf("%s%s",(item==1)?"":", ",url_encode(temp_timeperiodexclusion->timeperiod_name),html_encode(temp_timeperiodexclusion->timeperiod_name,FALSE));
}
printf(" | ");
@@ -1735,7 +1735,7 @@
printf("
\n",bg_class);
- printf("%s | \n",bg_class,url_encode(temp_command->name),temp_command->name);
+ printf("%s | \n",bg_class,url_encode(temp_command->name),html_encode(temp_command->name,FALSE));
printf("%s | \n",bg_class,html_encode(temp_command->command_line,FALSE));
printf("
\n");
@@ -1797,15 +1797,15 @@
printf("\n",bg_class);
- printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_sd->dependent_host_name),temp_sd->dependent_host_name);
+ printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_sd->dependent_host_name),html_encode(temp_sd->dependent_host_name,FALSE));
printf("%s | \n",url_encode(temp_sd->dependent_service_description),temp_sd->dependent_service_description);
+ printf("%s'>%s\n",url_encode(temp_sd->dependent_service_description),html_encode(temp_sd->dependent_service_description,FALSE));
- printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_sd->host_name),temp_sd->host_name);
+ printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_sd->host_name),html_encode(temp_sd->host_name,FALSE));
printf("%s | \n",url_encode(temp_sd->service_description),temp_sd->service_description);
+ printf("%s'>%s\n",url_encode(temp_sd->service_description),html_encode(temp_sd->service_description,FALSE));
printf("%s | ",bg_class,(temp_sd->dependency_type==NOTIFICATION_DEPENDENCY)?"Notification":"Check Execution");
@@ -1813,7 +1813,7 @@
if(temp_sd->dependency_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_sd->dependency_period),temp_sd->dependency_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_sd->dependency_period),html_encode(temp_sd->dependency_period,FALSE));
printf("\n");
printf("",bg_class);
@@ -1903,10 +1903,10 @@
printf(" |
\n",bg_class);
- printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_se->host_name),temp_se->host_name);
+ printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_se->host_name),html_encode(temp_se->host_name,FALSE));
printf("%s | \n",url_encode(temp_se->description),temp_se->description);
+ printf("%s'>%s\n",url_encode(temp_se->description),html_encode(temp_se->description,FALSE));
printf("",bg_class);
contact=0;
@@ -1914,13 +1914,13 @@
contact++;
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),temp_contactsmember->contact_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),html_encode(temp_contactsmember->contact_name,FALSE));
}
for(temp_contactgroupsmember=temp_se->contact_groups;temp_contactgroupsmember!=NULL;temp_contactgroupsmember=temp_contactgroupsmember->next){
contact++;
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),temp_contactgroupsmember->group_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),html_encode(temp_contactgroupsmember->group_name,FALSE));
}
if(contact==0)
printf(" ");
@@ -1947,7 +1947,7 @@
if(temp_se->escalation_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_se->escalation_period),temp_se->escalation_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_se->escalation_period),html_encode(temp_se->escalation_period,FALSE));
printf(" | \n");
printf("",bg_class);
@@ -2026,9 +2026,9 @@
printf(" |
\n",bg_class);
- printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_hd->dependent_host_name),temp_hd->dependent_host_name);
+ printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_hd->dependent_host_name),html_encode(temp_hd->dependent_host_name,FALSE));
- printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_hd->host_name),temp_hd->host_name);
+ printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_hd->host_name),html_encode(temp_hd->host_name,FALSE));
printf("%s | ",bg_class,(temp_hd->dependency_type==NOTIFICATION_DEPENDENCY)?"Notification":"Check Execution");
@@ -2036,7 +2036,7 @@
if(temp_hd->dependency_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_hd->dependency_period),temp_hd->dependency_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_hd->dependency_period),html_encode(temp_hd->dependency_period,FALSE));
printf("\n");
printf("",bg_class);
@@ -2118,7 +2118,7 @@
printf(" |
\n",bg_class);
- printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_he->host_name),temp_he->host_name);
+ printf("%s | ",bg_class,CONFIG_CGI,url_encode(temp_he->host_name),html_encode(temp_he->host_name,FALSE));
printf("",bg_class);
contact=0;
@@ -2126,13 +2126,13 @@
contact++;
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),temp_contactsmember->contact_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactsmember->contact_name),html_encode(temp_contactsmember->contact_name,FALSE));
}
for(temp_contactgroupsmember=temp_he->contact_groups;temp_contactgroupsmember!=NULL;temp_contactgroupsmember=temp_contactgroupsmember->next){
contact++;
if(contact>1)
printf(", ");
- printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),temp_contactgroupsmember->group_name);
+ printf("%s\n",CONFIG_CGI,url_encode(temp_contactgroupsmember->group_name),html_encode(temp_contactgroupsmember->group_name,FALSE));
}
if(contact==0)
printf(" ");
@@ -2159,7 +2159,7 @@
if(temp_he->escalation_period==NULL)
printf(" ");
else
- printf("%s",CONFIG_CGI,url_encode(temp_he->escalation_period),temp_he->escalation_period);
+ printf("%s",CONFIG_CGI,url_encode(temp_he->escalation_period),html_encode(temp_he->escalation_period,FALSE));
printf(" | \n");
printf("",bg_class);
@@ -2233,10 +2233,13 @@
command *temp_command;
int odd=0;
char *bg_class="";
- int i;
+ int i, j;
char *c, *cc;
char commandline[MAX_COMMAND_BUFFER];
- int arg_count[MAX_COMMAND_ARGUMENTS];
+ char *command_args[MAX_COMMAND_ARGUMENTS];
+ int arg_count[MAX_COMMAND_ARGUMENTS],
+ lead_space[MAX_COMMAND_ARGUMENTS],
+ trail_space[MAX_COMMAND_ARGUMENTS];
/* see if user is authorized to view command information... */
if(is_authorized_for_configuration_information(¤t_authdata)==FALSE){
@@ -2247,7 +2250,23 @@
printf(" Command Expansion \n");
/* Parse to_expand into parts */
- for (i=0,c=strdup(to_expand);i\n");
printf(" \n");
@@ -2279,7 +2298,7 @@
printf("\n",bg_class);
- printf("%s | \n",bg_class,url_encode(temp_command->name),temp_command->name);
+ printf("%s | \n",bg_class,url_encode(temp_command->name),html_encode(temp_command->name,FALSE));
printf("%s | \n",bg_class,html_encode(temp_command->command_line,FALSE));
printf(" \n\n",bg_class);
@@ -2313,8 +2332,13 @@
i=atoi(cc);
if ((i>0)&&(i<=MAX_COMMAND_ARGUMENTS)){
arg_count[i]++;
- if (command_args[i]) printf("%s",hash_color(i),html_encode(command_args[i],FALSE));
- else printf("(undefined/empty)");
+ if (command_args[i]){
+ if (*(command_args[i])!='\0') printf("%s%s%s",
+ hash_color(i),((lead_space[i]>0)||(trail_space[i]>0)?"":""),
+ html_encode(command_args[i],FALSE),((lead_space[i]>0)||(trail_space[i]>0)?"":""));
+ else printf("(empty)");
+ }
+ else printf("(undefined)");
}
else printf("(not a valid $ARGn$ index: %u)",i);
if ((*c)!='\0') c++;
@@ -2332,15 +2356,50 @@
printf(" \n");
- for (i=1;(iunused: | \n",bg_class,bg_class);
- printf("$ARG%u$=%s | \n",bg_class,i,hash_color(i),html_encode(command_args[i],FALSE));
+ printf("$ARG%u$=%s%s%s | \n",bg_class,i,hash_color(i),
+ ((lead_space[i]>0)||(trail_space[i]>0)?"":""),html_encode(command_args[i],FALSE),
+ ((lead_space[i]>0)||(trail_space[i]>0)?"":""));
}
else if (arg_count[i]>1){
printf("used %u x: | \n",bg_class,bg_class,i);
- printf("$ARG%u$=%s | \n",bg_class,i,hash_color(i),html_encode(command_args[i],FALSE));
+ printf("$ARG%u$=%s%s%s | \n",bg_class,i,hash_color(i),
+ ((lead_space[i]>0)||(trail_space[i]>0)?"":""),html_encode(command_args[i],FALSE),
+ ((lead_space[i]>0)||(trail_space[i]>0)?"":""));
}
+ if ((lead_space[i]>0)||(trail_space[i]>0)){
+ printf("dangling whitespace: | \n",bg_class,bg_class);
+ printf("$ARG%u$=",bg_class,i);
+ for (c=command_args[i],j=0;c&&isspace(*c);c++,j++)
+ /* TODO: As long as the hyperlinks change all whitespace into actual spaces,
+ we'll output "[WS]" (whitespace) instead of "[SP]"(ace). */
+ /* if ((*c)==' ') printf("[SP]"); */
+ if ((*c)==' ') printf("[WS]");
+ else if ((*c)=='\f') printf("[FF]");
+ else if ((*c)=='\n') printf("[LF]");
+ else if ((*c)=='\r') printf("[CR]");
+ else if ((*c)=='\t') printf("[HT]");
+ else if ((*c)=='\v') printf("[VT]");
+ else printf("[0x%x]",*c);
+ printf("",hash_color(i));
+ for (;c&&((*c)!='\0')&&(j");
+ for (;c&&((*c)!='\0');c++)
+ /* TODO: As long as the hyperlinks change all whitespace into actual spaces,
+ we'll output "[WS]" (whitespace) instead of "[SP]"(ace). */
+ /* if ((*c)==' ') printf("[SP]"); */
+ if ((*c)==' ') printf("[WS]");
+ else if ((*c)=='\f') printf("[FF]");
+ else if ((*c)=='\n') printf("[LF]");
+ else if ((*c)=='\r') printf("[CR]");
+ else if ((*c)=='\t') printf("[HT]");
+ else if ((*c)=='\v') printf("[VT]");
+ else printf("[0x%x]",*c);
+ printf(" | \n");
+ }
+ }
}
}
|