[icinga-checkins] icinga.org: icinga-core/r1.3: Fixing tooltip's in status.cgi, not showing messages with carriage return #1244

git at icinga.org git at icinga.org
Wed Mar 30 13:29:38 CEST 2011


Module: icinga-core
Branch: r1.3
Commit: a4ba4f00aabb5de63c98c3efa1c358eb85b9212e
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=a4ba4f00aabb5de63c98c3efa1c358eb85b9212e

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Fri Feb 25 13:34:22 2011 +0100

Fixing tooltip's in status.cgi, not showing messages with carriage return #1244

fixes: #1244

---

 Changelog    |    1 +
 cgi/status.c |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index 9f86011..3ed9dc7 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ FIXES
 
 * classic ui: fixed csv export link to make it XSS save (IE) #1275
 * classic ui: statusmap.cgi: fixed XSS vulnerability #1281
+* classic ui: Fixing tooltip's in status.cgi, not showing messages with carriage return #1244
 
 
 1.3.0 - 16/02/2011
diff --git a/cgi/status.c b/cgi/status.c
index 4f67c9d..447d604 100644
--- a/cgi/status.c
+++ b/cgi/status.c
@@ -5493,6 +5493,7 @@ void print_comment_icon(char *host_name, char *svc_description) {
 	comment *temp_comment=NULL;
 	char *comment_entry_type="";
 	char comment_data[MAX_INPUT_BUFFER]="";
+	char entry_time[MAX_DATETIME_LENGTH];
 	int len,output_len;
 	int x,y;
 	char *escaped_output_string=NULL;
@@ -5507,8 +5508,8 @@ void print_comment_icon(char *host_name, char *svc_description) {
 	/* possible to implement a config option to show and hide comments tooltip in status.cgi */
 	/* but who wouldn't like to have these fancy tooltips ;-) */
 	if(TRUE){
-		printf(" onMouseOver=\"return tooltip('<table border=0 width=100%% height=100%%>");
-		printf("<tr style=font-weight:bold;><td width=10%% nowrap>Type         </td><td>Comment</td></tr>");
+		printf(" onMouseOver=\"return tooltip('<table border=0 width=100%% height=100%% cellpadding=3>");
+		printf("<tr style=font-weight:bold;><td width=10%% nowrap>Type         </td><td width=12%%>Time</td><td>Comment</td></tr>");
 		for(temp_comment=get_first_comment_by_host(host_name);temp_comment!=NULL;temp_comment=get_next_comment_by_host(host_name,temp_comment)){
 			if((svc_description==NULL && temp_comment->comment_type==HOST_COMMENT) || \
 			   (svc_description!=NULL && temp_comment->comment_type==SERVICE_COMMENT && !strcmp(temp_comment->service_description,svc_description))) {
@@ -5541,6 +5542,8 @@ void print_comment_icon(char *host_name, char *svc_description) {
 						if((char)comment_data[x]==(char)'\x0'){
 							escaped_output_string[y]='\x0';
 							break;
+						} else if((char)comment_data[x]==(char)'\n' || (char)comment_data[x]==(char)'\r') {
+							escaped_output_string[y]=' ';
 						} else if((char)comment_data[x]==(char)'\'') {
 							escaped_output_string[y]='\x0';
 							if((int)strlen(escaped_output_string)<(output_len-2)){
@@ -5568,11 +5571,14 @@ void print_comment_icon(char *host_name, char *svc_description) {
 					strcpy(escaped_output_string,comment_data);
 				}
 
+				/* get entry time */
+				get_time_string(&temp_comment->entry_time,entry_time,(int)sizeof(entry_time),SHORT_DATE_TIME);
+
 				/* in the tooltips we have to escape all characters */
 				saved_escape_html_tags_var=escape_html_tags;
 				escape_html_tags=TRUE;
 
-				printf("<tr><td nowrap>%s</td><td>%s</td></tr>",comment_entry_type,html_encode(escaped_output_string,TRUE));
+				printf("<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td></tr>",comment_entry_type,entry_time,html_encode(escaped_output_string,TRUE));
 
 				escape_html_tags=saved_escape_html_tags_var;
 





More information about the icinga-checkins mailing list