diff -c cgi/auth.c newcgi/auth.c *** cgi/auth.c Sat Apr 27 01:44:07 2002 --- newcgi/auth.c Wed Sep 18 11:11:22 2002 *************** *** 107,113 **** } /* read in authorization override vars from config file... */ ! fp=fopen(DEFAULT_CGI_CONFIG_FILE,"r"); if(fp!=NULL){ while(read_line(input_buffer,MAX_INPUT_BUFFER,fp)){ --- 107,113 ---- } /* read in authorization override vars from config file... */ ! fp=fopen(get_cgi_config_location(),"r"); if(fp!=NULL){ while(read_line(input_buffer,MAX_INPUT_BUFFER,fp)){ diff -c cgi/avail.c newcgi/avail.c *** cgi/avail.c Tue Aug 20 20:53:21 2002 --- newcgi/avail.c Wed Sep 18 11:14:16 2002 *************** *** 256,265 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 256,265 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 283,289 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); --- 283,289 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); diff -c cgi/cgiutils.c newcgi/cgiutils.c *** cgi/cgiutils.c Tue Aug 20 00:11:27 2002 --- newcgi/cgiutils.c Wed Sep 18 11:41:20 2002 *************** *** 233,238 **** --- 233,249 ---- *************** CONFIG FILE FUNCTIONS ******************** **********************************************************/ + /* read the CGI config file location from an environment variable */ + char * get_cgi_config_location() { + static char *cgiloc = NULL; + if (!cgiloc) { + cgiloc = getenv("NAGIOS_CGI_CONFIG"); + if (!cgiloc) { + cgiloc = DEFAULT_CGI_CONFIG_FILE; + } + } + return cgiloc; + } /* read the CGI configuration file */ int read_cgi_config_file(char *filename){ *************** *** 1438,1444 **** int result; /* read program status */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_PROGRAM_STATUS); printf("\n"); printf("
\n"); --- 1449,1455 ---- int result; /* read program status */ ! result=read_all_status_data(get_cgi_config_location(),READ_PROGRAM_STATUS); printf("\n"); printf("\n"); /* read in all comments */ ! read_comment_data(DEFAULT_CGI_CONFIG_FILE); /* check all the comments to see if they apply to this host or service */ for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){ --- 1891,1897 ---- printf("\n"); /* read in all comments */ ! read_comment_data(get_cgi_config_location()); /* check all the comments to see if they apply to this host or service */ for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){ *************** *** 1955,1961 **** /* read in all downtime */ ! read_downtime_data(DEFAULT_CGI_CONFIG_FILE); printf("

\n"); printf("

\n"); --- 1955,1961 ---- /* read in all downtime */ ! read_downtime_data(get_cgi_config_location()); printf("

\n"); printf("

\n"); diff -c cgi/histogram.c newcgi/histogram.c *** cgi/histogram.c Mon Jul 29 00:50:53 2002 --- newcgi/histogram.c Wed Sep 18 11:20:52 2002 *************** *** 258,268 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); } return ERROR; --- 258,268 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); } return ERROR; *************** *** 291,297 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); --- 291,297 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); diff -c cgi/history.c newcgi/history.c *** cgi/history.c Mon Jul 29 00:50:53 2002 --- newcgi/history.c Wed Sep 18 11:21:03 2002 *************** *** 97,106 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 97,106 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } diff -c cgi/notifications.c newcgi/notifications.c *** cgi/notifications.c Mon Aug 12 21:31:16 2002 --- newcgi/notifications.c Wed Sep 18 11:21:18 2002 *************** *** 91,100 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 91,100 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } diff -c cgi/outages.c newcgi/outages.c *** cgi/outages.c Mon Jul 29 00:50:53 2002 --- newcgi/outages.c Wed Sep 18 11:21:33 2002 *************** *** 114,123 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 114,123 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 141,147 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); --- 141,147 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); *************** *** 153,159 **** document_header(TRUE); /* read in all host and service comments */ ! read_comment_data(DEFAULT_CGI_CONFIG_FILE); /* get authentication information */ get_authentication_information(¤t_authdata); --- 153,159 ---- document_header(TRUE); /* read in all host and service comments */ ! read_comment_data(get_cgi_config_location()); /* get authentication information */ get_authentication_information(¤t_authdata); diff -c cgi/showlog.c newcgi/showlog.c *** cgi/showlog.c Mon Jul 29 00:50:53 2002 --- newcgi/showlog.c Wed Sep 18 11:24:03 2002 *************** *** 71,80 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 71,80 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } diff -c cgi/status.c newcgi/status.c *** cgi/status.c Tue Jul 30 23:51:26 2002 --- newcgi/status.c Wed Sep 18 11:24:30 2002 *************** *** 176,185 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 176,185 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 203,209 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); --- 203,209 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); *************** *** 215,224 **** document_header(TRUE); /* read in all host and service comments */ ! read_comment_data(DEFAULT_CGI_CONFIG_FILE); /* read in extended host information */ ! read_extended_object_config_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_EXTENDED_DATA); /* get authentication information */ get_authentication_information(¤t_authdata); --- 215,224 ---- document_header(TRUE); /* read in all host and service comments */ ! read_comment_data(get_cgi_config_location()); /* read in extended host information */ ! read_extended_object_config_data(get_cgi_config_location(),READ_ALL_EXTENDED_DATA); /* get authentication information */ get_authentication_information(¤t_authdata); diff -c cgi/statusmap.c newcgi/statusmap.c *** cgi/statusmap.c Mon Jul 29 00:50:53 2002 --- newcgi/statusmap.c Wed Sep 18 11:25:08 2002 *************** *** 233,243 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); if(create_type==CREATE_HTML) ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 233,243 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); if(create_type==CREATE_HTML) ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 269,275 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); if(create_type==CREATE_HTML) --- 269,275 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); if(create_type==CREATE_HTML) *************** *** 286,292 **** get_authentication_information(¤t_authdata); /* read in extended host information */ ! read_extended_object_config_data(DEFAULT_CGI_CONFIG_FILE,READ_EXTENDED_HOST_INFO); /* display the network map... */ display_map(); --- 286,292 ---- get_authentication_information(¤t_authdata); /* read in extended host information */ ! read_extended_object_config_data(get_cgi_config_location(),READ_EXTENDED_HOST_INFO); /* display the network map... */ display_map(); diff -c cgi/statuswml.c newcgi/statuswml.c *** cgi/statuswml.c Mon Jul 29 00:50:53 2002 --- newcgi/statuswml.c Wed Sep 18 11:25:34 2002 *************** *** 110,118 **** document_header(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ ! printf("

Error: Could not open CGI configuration file '%s' for reading!

\n",DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 110,118 ---- document_header(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ ! printf("

Error: Could not open CGI configuration file '%s' for reading!

\n",get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 134,140 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ printf("

Error: Could not read host and service status information!

\n"); document_footer(); --- 134,140 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ printf("

Error: Could not read host and service status information!

\n"); document_footer(); diff -c cgi/statuswrl.c newcgi/statuswrl.c *** cgi/statuswrl.c Sun Sep 15 22:25:36 2002 --- newcgi/statuswrl.c Wed Sep 18 11:25:58 2002 *************** *** 143,149 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(); return ERROR; --- 143,149 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(); return ERROR; *************** *** 168,174 **** return ERROR; /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ free_memory(); return ERROR; --- 168,174 ---- return ERROR; /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ free_memory(); return ERROR; *************** *** 178,184 **** get_authentication_information(¤t_authdata); /* read in extended host information */ ! read_extended_object_config_data(DEFAULT_CGI_CONFIG_FILE,READ_EXTENDED_HOST_INFO); /* display the 3-D VRML world... */ display_world(); --- 178,184 ---- get_authentication_information(¤t_authdata); /* read in extended host information */ ! read_extended_object_config_data(get_cgi_config_location(),READ_EXTENDED_HOST_INFO); /* display the 3-D VRML world... */ display_world(); diff -c cgi/summary.c newcgi/summary.c *** cgi/summary.c Mon Jul 29 00:50:53 2002 --- newcgi/summary.c Wed Sep 18 11:26:07 2002 *************** *** 219,228 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 219,228 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } diff -c cgi/tac.c newcgi/tac.c *** cgi/tac.c Thu Aug 8 01:00:51 2002 --- newcgi/tac.c Wed Sep 18 11:26:20 2002 *************** *** 190,199 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 190,199 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 217,223 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); --- 217,223 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); diff -c cgi/trends.c newcgi/trends.c *** cgi/trends.c Thu Aug 8 01:00:51 2002 --- newcgi/trends.c Wed Sep 18 11:26:33 2002 *************** *** 260,270 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); } return ERROR; --- 260,270 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); } return ERROR; *************** *** 322,328 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE); --- 322,328 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ if(mode==CREATE_HTML){ document_header(FALSE);
\n"); diff -c cgi/cgiutils.h newcgi/cgiutils.h *** cgi/cgiutils.h Tue Sep 17 22:43:56 2002 --- newcgi/cgiutils.h Wed Sep 18 11:41:29 2002 *************** *** 388,393 **** --- 388,395 ---- void free_cgi_vars(void); void free_memory(void); + char * get_cgi_config_location(void); + int read_cgi_config_file(char *); int read_main_config_file(char *); int read_all_object_configuration_data(char *,int); diff -c cgi/cmd.c newcgi/cmd.c *** cgi/cmd.c Mon Jul 29 00:50:53 2002 --- newcgi/cmd.c Wed Sep 18 11:19:32 2002 *************** *** 115,127 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); if(content_type==WML_CONTENT) printf("

Error: Could not open CGI config file!

\n"); else ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 115,127 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); if(content_type==WML_CONTENT) printf("

Error: Could not open CGI config file!

\n"); else ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } *************** *** 1170,1176 **** error=TRUE; /* read comments */ ! read_comment_data(DEFAULT_CGI_CONFIG_FILE); /* find the comment */ if(cmd==CMD_DEL_HOST_COMMENT) --- 1170,1176 ---- error=TRUE; /* read comments */ ! read_comment_data(get_cgi_config_location()); /* find the comment */ if(cmd==CMD_DEL_HOST_COMMENT) *************** *** 1203,1209 **** error=TRUE; /* read scheduled downtime */ ! read_downtime_data(DEFAULT_CGI_CONFIG_FILE); /* find the downtime entry */ if(cmd==CMD_DEL_HOST_DOWNTIME) --- 1203,1209 ---- error=TRUE; /* read scheduled downtime */ ! read_downtime_data(get_cgi_config_location()); /* find the downtime entry */ if(cmd==CMD_DEL_HOST_DOWNTIME) diff -c cgi/config.c newcgi/config.c *** cgi/config.c Tue Aug 20 20:53:21 2002 --- newcgi/config.c Wed Sep 18 11:19:47 2002 *************** *** 105,114 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(DEFAULT_CGI_CONFIG_FILE); document_footer(); return ERROR; } --- 105,114 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); ! cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } diff -c cgi/extinfo.c newcgi/extinfo.c *** cgi/extinfo.c Tue Aug 27 23:46:26 2002 --- newcgi/extinfo.c Wed Sep 18 11:20:28 2002 *************** *** 131,137 **** reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(DEFAULT_CGI_CONFIG_FILE); if(result==ERROR){ document_header(FALSE); cgi_config_file_error(main_config_file); --- 131,137 ---- reset_cgi_vars(); /* read the CGI configuration file */ ! result=read_cgi_config_file(get_cgi_config_location()); if(result==ERROR){ document_header(FALSE); cgi_config_file_error(main_config_file); *************** *** 158,164 **** } /* read all status data */ ! result=read_all_status_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); --- 158,164 ---- } /* read all status data */ ! result=read_all_status_data(get_cgi_config_location(),READ_ALL_STATUS_DATA); if(result==ERROR){ document_header(FALSE); status_data_error(); *************** *** 170,176 **** document_header(TRUE); /* read in extended host information */ ! read_extended_object_config_data(DEFAULT_CGI_CONFIG_FILE,READ_ALL_EXTENDED_DATA); /* get authentication information */ get_authentication_information(¤t_authdata); --- 170,176 ---- document_header(TRUE); /* read in extended host information */ ! read_extended_object_config_data(get_cgi_config_location(),READ_ALL_EXTENDED_DATA); /* get authentication information */ get_authentication_information(¤t_authdata); *************** *** 1488,1494 **** /* read in all comments */ ! read_comment_data(DEFAULT_CGI_CONFIG_FILE); printf("

\n"); printf("

\n"); --- 1488,1494 ---- /* read in all comments */ ! read_comment_data(get_cgi_config_location()); printf("

\n"); printf("

\n"); *************** *** 1891,1897 **** printf("
Entry TimeAuthorCommentComment IDPersistentActions
Entry TimeAuthorCommentComment IDPersistentActions