Skip to content

Commit

Permalink
fix parsing bool values
Browse files Browse the repository at this point in the history
for some attributes the parser set a flag. This has to be done before returning
from the bool parser.
  • Loading branch information
sni committed Sep 29, 2024
1 parent 53e2c84 commit f604af1
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/naemon/xodtemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -6991,8 +6991,8 @@ static int xodtemplate_add_object_property(char *input)
}
temp_servicedependency->have_dependency_period = TRUE;
} else if (!strcmp(variable, "inherits_parent")) {
return xod_parse_bool(temp_servicedependency, inherits_parent, value);
temp_servicedependency->have_inherits_parent = TRUE;
return xod_parse_bool(temp_servicedependency, inherits_parent, value);
} else if (!strcmp(variable, "execution_failure_options") || !strcmp(variable, "execution_failure_criteria")) {
temp_servicedependency->have_execution_failure_options = TRUE;
for (temp_ptr = strtok(value, ", "); temp_ptr; temp_ptr = strtok(NULL, ", ")) {
Expand Down Expand Up @@ -7259,20 +7259,20 @@ static int xodtemplate_add_object_property(char *input)
}
temp_contact->have_service_notification_options = TRUE;
} else if (!strcmp(variable, "host_notifications_enabled")) {
return xod_parse_bool(temp_contact, host_notifications_enabled, value);
temp_contact->have_host_notifications_enabled = TRUE;
return xod_parse_bool(temp_contact, host_notifications_enabled, value);
} else if (!strcmp(variable, "service_notifications_enabled")) {
return xod_parse_bool(temp_contact, service_notifications_enabled, value);
temp_contact->have_service_notifications_enabled = TRUE;
return xod_parse_bool(temp_contact, service_notifications_enabled, value);
} else if (!strcmp(variable, "can_submit_commands")) {
return xod_parse_bool(temp_contact, can_submit_commands, value);
temp_contact->have_can_submit_commands = TRUE;
return xod_parse_bool(temp_contact, can_submit_commands, value);
} else if (!strcmp(variable, "retain_status_information")) {
return xod_parse_bool(temp_contact, retain_status_information, value);
temp_contact->have_retain_status_information = TRUE;
return xod_parse_bool(temp_contact, retain_status_information, value);
} else if (!strcmp(variable, "retain_nonstatus_information")) {
return xod_parse_bool(temp_contact, retain_nonstatus_information, value);
temp_contact->have_retain_nonstatus_information = TRUE;
return xod_parse_bool(temp_contact, retain_nonstatus_information, value);
} else if (!strcmp(variable, "minimum_value")) {
temp_contact->minimum_value = strtoul(value, NULL, 10);
temp_contact->have_minimum_value = TRUE;
Expand Down Expand Up @@ -7452,17 +7452,17 @@ static int xodtemplate_add_object_property(char *input)
temp_host->max_check_attempts = atoi(value);
temp_host->have_max_check_attempts = TRUE;
} else if (!strcmp(variable, "checks_enabled") || !strcmp(variable, "active_checks_enabled")) {
return xod_parse_bool(temp_host, active_checks_enabled, value);
temp_host->have_active_checks_enabled = TRUE;
return xod_parse_bool(temp_host, active_checks_enabled, value);
} else if (!strcmp(variable, "passive_checks_enabled")) {
return xod_parse_bool(temp_host, passive_checks_enabled, value);
temp_host->have_passive_checks_enabled = TRUE;
return xod_parse_bool(temp_host, passive_checks_enabled, value);
} else if (!strcmp(variable, "event_handler_enabled")) {
return xod_parse_bool(temp_host, event_handler_enabled, value);
temp_host->have_event_handler_enabled = TRUE;
return xod_parse_bool(temp_host, event_handler_enabled, value);
} else if (!strcmp(variable, "check_freshness")) {
return xod_parse_bool(temp_host, check_freshness, value);
temp_host->have_check_freshness = TRUE;
return xod_parse_bool(temp_host, check_freshness, value);
} else if (!strcmp(variable, "freshness_threshold")) {
temp_host->freshness_threshold = atoi(value);
temp_host->have_freshness_threshold = TRUE;
Expand All @@ -7473,8 +7473,8 @@ static int xodtemplate_add_object_property(char *input)
temp_host->high_flap_threshold = strtod(value, NULL);
temp_host->have_high_flap_threshold = TRUE;
} else if (!strcmp(variable, "flap_detection_enabled")) {
return xod_parse_bool(temp_host, flap_detection_enabled, value);
temp_host->have_flap_detection_enabled = TRUE;
return xod_parse_bool(temp_host, flap_detection_enabled, value);
} else if (!strcmp(variable, "flap_detection_options")) {

/* user is specifying something, so discard defaults... */
Expand Down Expand Up @@ -7520,8 +7520,8 @@ static int xodtemplate_add_object_property(char *input)
}
temp_host->have_notification_options = TRUE;
} else if (!strcmp(variable, "notifications_enabled")) {
return xod_parse_bool(temp_host, notifications_enabled, value);
temp_host->have_notifications_enabled = TRUE;
return xod_parse_bool(temp_host, notifications_enabled, value);
} else if (!strcmp(variable, "notification_interval")) {
temp_host->notification_interval = strtod(value, NULL);
temp_host->have_notification_interval = TRUE;
Expand All @@ -7547,8 +7547,8 @@ static int xodtemplate_add_object_property(char *input)
}
temp_host->have_stalking_options = TRUE;
} else if (!strcmp(variable, "process_perf_data")) {
return xod_parse_bool(temp_host, process_perf_data, value);
temp_host->have_process_perf_data = TRUE;
return xod_parse_bool(temp_host, process_perf_data, value);
} else if (!strcmp(variable, "failure_prediction_enabled")) {
xodtemplate_obsoleted(variable, temp_host->_start_line);
} else if (!strcmp(variable, "2d_coords")) {
Expand Down Expand Up @@ -7581,14 +7581,14 @@ static int xodtemplate_add_object_property(char *input)
temp_host->z_3d = strtod(temp_ptr, NULL);
temp_host->have_3d_coords = TRUE;
} else if (!strcmp(variable, "obsess_over_host") || !strcmp(variable, "obsess")) {
return xod_parse_bool(temp_host, obsess, value);
temp_host->have_obsess = TRUE;
return xod_parse_bool(temp_host, obsess, value);
} else if (!strcmp(variable, "retain_status_information")) {
return xod_parse_bool(temp_host, retain_status_information, value);
temp_host->have_retain_status_information = TRUE;
return xod_parse_bool(temp_host, retain_status_information, value);
} else if (!strcmp(variable, "retain_nonstatus_information")) {
return xod_parse_bool(temp_host, retain_nonstatus_information, value);
temp_host->have_retain_nonstatus_information = TRUE;
return xod_parse_bool(temp_host, retain_nonstatus_information, value);
} else if (!strcmp(variable, "register"))
return xod_parse_bool(temp_host, register_object, value);
else if (variable[0] == '_') {
Expand Down Expand Up @@ -7783,29 +7783,29 @@ static int xodtemplate_add_object_property(char *input)
temp_service->retry_interval = strtod(value, NULL);
temp_service->have_retry_interval = TRUE;
} else if (!strcmp(variable, "active_checks_enabled")) {
return xod_parse_bool(temp_service, active_checks_enabled, value);
temp_service->have_active_checks_enabled = TRUE;
return xod_parse_bool(temp_service, active_checks_enabled, value);
} else if (!strcmp(variable, "passive_checks_enabled")) {
return xod_parse_bool(temp_service, passive_checks_enabled, value);
temp_service->have_passive_checks_enabled = TRUE;
return xod_parse_bool(temp_service, passive_checks_enabled, value);
} else if (!strcmp(variable, "parallelize_check")) {
/* deprecated and was never implemented
* removing it here would result in lots of
* Invalid service object directive errors
* for existing configs
*/
} else if (!strcmp(variable, "is_volatile")) {
return xod_parse_bool(temp_service, is_volatile, value);
temp_service->have_is_volatile = TRUE;
return xod_parse_bool(temp_service, is_volatile, value);
} else if (!strcmp(variable, "obsess_over_service") || !strcmp(variable, "obsess")) {
return xod_parse_bool(temp_service, obsess, value);
temp_service->have_obsess = TRUE;
return xod_parse_bool(temp_service, obsess, value);
} else if (!strcmp(variable, "event_handler_enabled")) {
return xod_parse_bool(temp_service, event_handler_enabled, value);
temp_service->have_event_handler_enabled = TRUE;
return xod_parse_bool(temp_service, event_handler_enabled, value);
} else if (!strcmp(variable, "check_freshness")) {
return xod_parse_bool(temp_service, check_freshness, value);
temp_service->have_check_freshness = TRUE;
return xod_parse_bool(temp_service, check_freshness, value);
} else if (!strcmp(variable, "freshness_threshold")) {
temp_service->freshness_threshold = atoi(value);
temp_service->have_freshness_threshold = TRUE;
Expand All @@ -7816,8 +7816,8 @@ static int xodtemplate_add_object_property(char *input)
temp_service->high_flap_threshold = strtod(value, NULL);
temp_service->have_high_flap_threshold = TRUE;
} else if (!strcmp(variable, "flap_detection_enabled")) {
return xod_parse_bool(temp_service, flap_detection_enabled, value);
temp_service->have_flap_detection_enabled = TRUE;
return xod_parse_bool(temp_service, flap_detection_enabled, value);
} else if (!strcmp(variable, "flap_detection_options")) {

/* user is specifying something, so discard defaults... */
Expand Down Expand Up @@ -7867,8 +7867,8 @@ static int xodtemplate_add_object_property(char *input)
}
temp_service->have_notification_options = TRUE;
} else if (!strcmp(variable, "notifications_enabled")) {
return xod_parse_bool(temp_service, notifications_enabled, value);
temp_service->have_notifications_enabled = TRUE;
return xod_parse_bool(temp_service, notifications_enabled, value);
} else if (!strcmp(variable, "notification_interval")) {
temp_service->notification_interval = strtod(value, NULL);
temp_service->have_notification_interval = TRUE;
Expand Down Expand Up @@ -7896,16 +7896,16 @@ static int xodtemplate_add_object_property(char *input)
}
temp_service->have_stalking_options = TRUE;
} else if (!strcmp(variable, "process_perf_data")) {
return xod_parse_bool(temp_service, process_perf_data, value);
temp_service->have_process_perf_data = TRUE;
return xod_parse_bool(temp_service, process_perf_data, value);
} else if (!strcmp(variable, "failure_prediction_enabled")) {
xodtemplate_obsoleted(variable, temp_service->_start_line);
} else if (!strcmp(variable, "retain_status_information")) {
return xod_parse_bool(temp_service, retain_status_information, value);
temp_service->have_retain_status_information = TRUE;
return xod_parse_bool(temp_service, retain_status_information, value);
} else if (!strcmp(variable, "retain_nonstatus_information")) {
return xod_parse_bool(temp_service, retain_nonstatus_information, value);
temp_service->have_retain_nonstatus_information = TRUE;
return xod_parse_bool(temp_service, retain_nonstatus_information, value);
} else if (!strcmp(variable, "register"))
return xod_parse_bool(temp_service, register_object, value);
else if (variable[0] == '_') {
Expand Down Expand Up @@ -7984,8 +7984,8 @@ static int xodtemplate_add_object_property(char *input)
}
temp_hostdependency->have_dependency_period = TRUE;
} else if (!strcmp(variable, "inherits_parent")) {
return xod_parse_bool(temp_hostdependency, inherits_parent, value);
temp_hostdependency->have_inherits_parent = TRUE;
return xod_parse_bool(temp_hostdependency, inherits_parent, value);
} else if (!strcmp(variable, "notification_failure_options") || !strcmp(variable, "notification_failure_criteria")) {
temp_hostdependency->have_notification_failure_options = TRUE;
for (temp_ptr = strtok(value, ", "); temp_ptr; temp_ptr = strtok(NULL, ", ")) {
Expand Down

0 comments on commit f604af1

Please sign in to comment.