diff -aur nagios-3.2.1/cgi/cgiutils.c nagios-3.2.1+MU/cgi/cgiutils.c
--- nagios-3.2.1/cgi/cgiutils.c 2009-07-31 18:54:20.000000000 +0200
+++ nagios-3.2.1+MU/cgi/cgiutils.c 2010-06-10 10:58:29.000000000 +0200
@@ -1751,7 +1751,7 @@
if(refresh==TRUE)
printf("Updated every %d seconds
\n",refresh_rate);
- printf("Nagios® Core™ %s - www.nagios.org
\n",PROGRAM_VERSION);
+ printf("Nagios® Core™ %s%s - www.nagios.org
\n",PROGRAM_VERSION,MU_PATCH_ID);
if(current_authdata!=NULL)
printf("Logged in as %s
\n",(!strcmp(current_authdata->username,""))?"?":current_authdata->username);
diff -aur nagios-3.2.1/cgi/extinfo.c nagios-3.2.1+MU/cgi/extinfo.c
--- nagios-3.2.1/cgi/extinfo.c 2010-01-07 02:03:01.000000000 +0100
+++ nagios-3.2.1+MU/cgi/extinfo.c 2010-06-10 11:35:01.000000000 +0200
@@ -434,25 +434,29 @@
if(display_type==DISPLAY_HOST_INFO && temp_host!=NULL){
printf("
Program Version: | %s |
Program Version: | %s%s | ",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_status->host_name),url_images_path,SCHEDULED_DOWNTIME_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT); } if(temp_host->notes_url!=NULL){ + process_macros(temp_host->notes_url,&processed_string,0); + BEGIN_MULTIURL_LOOP printf(" | "); printf("",(notes_url_target==NULL)?"_blank":notes_url_target); - printf("",url_images_path,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); + printf("",url_images_path,MU_iconstr,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); printf(""); printf(" | \n"); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->action_url!=NULL){ + process_macros(temp_host->action_url,&processed_string,0); + BEGIN_MULTIURL_LOOP printf(""); printf("",(action_url_target==NULL)?"_blank":action_url_target); - printf("",url_images_path,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); + printf("",url_images_path,MU_iconstr,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); printf(""); printf(" | \n"); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->icon_image!=NULL){ printf(""); @@ -1716,26 +1720,30 @@ printf("&service=%s'> | ",url_encode(temp_status->description),url_images_path,SCHEDULED_DOWNTIME_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT); } if(temp_service->notes_url!=NULL){ + process_macros(temp_service->notes_url,&processed_string,0); + BEGIN_MULTIURL_LOOP printf(""); printf("",(notes_url_target==NULL)?"_blank":notes_url_target); - printf("",url_images_path,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Service Notes","View Extra Service Notes"); + printf("",url_images_path,MU_iconstr,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Service Notes","View Extra Service Notes"); printf(""); printf(" | \n"); + END_MULTIURL_LOOP + free(processed_string); } if(temp_service->action_url!=NULL){ + process_macros(temp_service->action_url,&processed_string,0); + BEGIN_MULTIURL_LOOP printf(""); printf("",(action_url_target==NULL)?"_blank":action_url_target); - printf("",url_images_path,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Service Actions","Perform Extra Service Actions"); + printf("",url_images_path,MU_iconstr,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Service Actions","Perform Extra Service Actions"); printf(""); printf(" | \n"); + END_MULTIURL_LOOP + free(processed_string); } if(temp_service->icon_image!=NULL){ printf(""); @@ -2115,26 +2123,30 @@ printf(" | ",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(temp_status->host_name),url_images_path,SCHEDULED_DOWNTIME_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT); } if(temp_host->notes_url!=NULL){ + process_macros(temp_host->notes_url,&processed_string,0); + BEGIN_MULTIURL_LOOP printf(" | "); printf("",(notes_url_target==NULL)?"_blank":notes_url_target); - printf("",url_images_path,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); + printf("",url_images_path,MU_iconstr,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); printf(""); printf(" | \n"); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->action_url!=NULL){ + process_macros(temp_host->action_url,&processed_string,0); + BEGIN_MULTIURL_LOOP printf(""); printf("",(action_url_target==NULL)?"_blank":action_url_target); - printf("",url_images_path,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); + printf("",url_images_path,MU_iconstr,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); printf(""); printf(" | \n"); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->icon_image!=NULL){ printf(""); @@ -3242,22 +3254,26 @@ printf(""); if(temp_host->notes_url!=NULL){ - printf("",(notes_url_target==NULL)?"_blank":notes_url_target); - printf("",url_images_path,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); + printf("",url_images_path,MU_iconstr,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); printf(""); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->action_url!=NULL){ - printf("",(action_url_target==NULL)?"blank":action_url_target); - printf("",url_images_path,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); + printf("",url_images_path,MU_iconstr,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); printf(""); + END_MULTIURL_LOOP + free(processed_string); } printf("\n",STATUS_CGI,url_encode(temp_host->name),url_images_path,STATUS_DETAIL_ICON); @@ -3546,22 +3562,26 @@ printf(" | ",status_bg_class); printf("\n",EXTINFO_CGI,DISPLAY_HOST_INFO,url_encode(hststatus->host_name),url_images_path,DETAIL_ICON); if(temp_host->notes_url!=NULL){ - printf("",(notes_url_target==NULL)?"_blank":notes_url_target); - printf("",url_images_path,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); + printf("",url_images_path,MU_iconstr,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); printf(""); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->action_url!=NULL){ - printf("",(action_url_target==NULL)?"_blank":action_url_target); - printf("",url_images_path,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); + printf("",url_images_path,MU_iconstr,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); printf(""); + END_MULTIURL_LOOP + free(processed_string); } printf("\n",STATUS_CGI,url_encode(hststatus->host_name),url_images_path,STATUS_DETAIL_ICON); #ifdef USE_STATUSMAP @@ -4471,22 +4491,26 @@ printf(""); if(temp_host->notes_url!=NULL){ - printf("",(notes_url_target==NULL)?"_blank":notes_url_target); - printf("",url_images_path,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); + printf("",url_images_path,MU_iconstr,NOTES_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"View Extra Host Notes","View Extra Host Notes"); printf(""); + END_MULTIURL_LOOP + free(processed_string); } if(temp_host->action_url!=NULL){ - printf("",(action_url_target==NULL)?"_blank":action_url_target); - printf("",url_images_path,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); + printf("",url_images_path,MU_iconstr,ACTION_ICON,STATUS_ICON_WIDTH,STATUS_ICON_HEIGHT,"Perform Extra Host Actions","Perform Extra Host Actions"); printf(""); + END_MULTIURL_LOOP + free(processed_string); } printf("\n",STATUS_CGI,url_encode(temp_host->name),url_images_path,STATUS_DETAIL_ICON); diff -aur nagios-3.2.1/include/cgiutils.h.in nagios-3.2.1+MU/include/cgiutils.h.in --- nagios-3.2.1/include/cgiutils.h.in 2008-11-30 18:22:59.000000000 +0100 +++ nagios-3.2.1+MU/include/cgiutils.h.in 2010-06-10 11:38:10.000000000 +0200 @@ -523,6 +523,49 @@ char *mmap_fgets(mmapfile *); char *mmap_fgets_multiline(mmapfile *); +/******************************** MULTIURL PATCH *******************************/ + +#ifndef DISABLE_MULTIURL + +#define MU_PATCH_ID "+MU" + +int MU_lasturl, MU_thisurl; +char MU_iconstr[16], *MU_origstr, *MU_ptr; + +/* Have process_macros() generate processed_string *BEFORE* starting the loop */ + +#define BEGIN_MULTIURL_LOOP \ + /* Init counters */ MU_lasturl=0; MU_iconstr[0]='\0'; \ + /* MAIN LOOP */ for (MU_origstr=MU_ptr=processed_string; (*MU_ptr)!='\0'; ) { \ + /* Internal init */ MU_thisurl=MU_lasturl; \ + /* Skip whitespace */ for (;isspace(*MU_ptr);MU_ptr++) ; \ + /* Detect+skip ap. */ for (;(*MU_ptr)=='\'';MU_ptr++) MU_thisurl=MU_lasturl+1; \ + /* Ap. found? */ if (MU_thisurl>MU_lasturl) { \ + /* yes->split str */ sprintf(MU_iconstr,"%u-",MU_thisurl); \ + processed_string=MU_ptr; \ + for (;((*MU_ptr)!='\0')&&((*MU_ptr)!='\'');MU_ptr++) ; \ + if ((*MU_ptr)=='\'') { (*MU_ptr)='\0'; MU_ptr++; \ + for (;isspace(*MU_ptr);MU_ptr++) ; } \ + } else { \ + /* no->end loop */ MU_iconstr[0]='\0'; MU_ptr=""; \ + } + +/* Do the original printf()s, additionally inserting MU_iconstr between icon path and icon (file)name */ + +#define END_MULTIURL_LOOP \ + /* Int -> ext ctr */ MU_lasturl=MU_thisurl; processed_string=MU_ptr; \ + /* MAIN LOOP */ } \ + /* Hide evidence */ processed_string=MU_origstr; + +/* Do the free(processed_string) *AFTER* ending the loop */ + +#else /* ndef DISABLE_MULTIURL */ + +#define MU_PATCH_ID "" +char *MU_iconstr=""; + +#endif /* ndef DISABLE_MULTIURL */ + #ifdef __cplusplus } #endif |