Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
core: bail out early with config error if resource.cfg macros contain…
Browse files Browse the repository at this point in the history
… NULL values #2879

plus
core: fix logical bug on icinga.cfg detection on config read #2879
core: add hint on icinga.cfg package location, and tip to read
Changelog CHANGES on upgrades #2879

refs #2879
  • Loading branch information
Michael Friedrich committed Jul 31, 2012
1 parent 5b4e773 commit 2c5c54a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ENHANCEMENTS
** livestatus and other neb modules not using the icinga headers won't see those
* core: add a command to disable notifications program-wide with expire time as scheduled event #905 - MF
** DISABLE_NOTIFICATIONS_EXPIRE_TIME, works for global notifications
* core: add hint on icinga.cfg package location, and tip to read Changelog CHANGES on upgrades #2879 - MF

* classic ui: add support for disable notifications with expire time to extinfo.cgi, Process Info #905 - MF

Expand All @@ -30,6 +31,8 @@ FIXES
* core: revamp the detection of embedded perl usage directive "# icinga: +epn" (Andreas Ericsson) #2197
* core: fix whitespaces are not stripped using multiple templates ("use abc, def, ghi") #2701
* core: make delete_downtime_by_hostname_service_description_start_time_comment threadsafe (Andreas Ericsson) #2899
* core: bail out early with config error if resource.cfg macros contain NULL values #2879 - MF
* core: fix logical bug on icinga.cfg detection on config read #2879 - MF

CHANGES
* core: new command
Expand Down
6 changes: 5 additions & 1 deletion base/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ int read_main_config_file(char *main_config_file) {
mac->x[MACRO_RESOURCEFILE] = (char *)strdup(value);

/* process the resource file */
read_resource_file(value);
if(read_resource_file(value) == ERROR) {
dummy = asprintf(&error_message, "Resource file parsing failed");
error = TRUE;
break;
}
}

else if (!strcmp(variable, "log_file")) {
Expand Down
6 changes: 4 additions & 2 deletions base/icinga.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,13 @@ int main(int argc, char **argv, char **env) {
if (result != OK) {

/* if the config filename looks fishy, warn the user */
if (!strstr(config_file, "nagios.cfg") || !strstr(config_file, "icinga.cfg")) {
if (!strstr(config_file, "nagios.cfg") && !strstr(config_file, "icinga.cfg")) {
printf("\n***> The name of the main configuration file looks suspicious...\n");
printf("\n");
printf(" Make sure you are specifying the name of the MAIN configuration file on\n");
printf(" the command line and not the name of another configuration file. The\n");
printf(" main configuration file is typically '/usr/local/icinga/etc/icinga.cfg'\n");
printf(" or if using packages, most likely '/etc/icinga/icinga.cfg'\n");
}

printf("\n***> One or more problems was encountered while processing the config files...\n");
Expand All @@ -537,7 +538,8 @@ int main(int argc, char **argv, char **env) {
printf(" version of %s, you should be aware that some variables/definitions\n", PROGRAM_NAME);
printf(" may have been removed or modified in this version. Make sure to read\n");
printf(" the HTML documentation regarding the config files, as well as the\n");
printf(" 'Whats New' section to find out what has changed.\n\n");
printf(" 'Whats New' section and the Changelog CHANGES section as well to find\n");
printf(" out what has changed.\n\n");
}

/* the config files were okay, so run the pre-flight check */
Expand Down

0 comments on commit 2c5c54a

Please sign in to comment.