Skip to content

Commit

Permalink
Merge pull request #178 from greenbone/make-report-configs-optional
Browse files Browse the repository at this point in the history
Fix: Make report configs optional for new alerts
  • Loading branch information
a-h-abdelsalam authored Jul 17, 2024
2 parents 56e015b + 2ff0cab commit 43ad624
Showing 1 changed file with 40 additions and 36 deletions.
76 changes: 40 additions & 36 deletions src/gsad_gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4138,44 +4138,48 @@ new_alert (gvm_connection_t *connection, credentials_t *credentials,

/* Get Report Configs. */

ret = gmp (connection, credentials, &response, &entity, response_data,
"<get_report_configs filter=\"rows=-1\"/>");
switch (ret)
if (command_enabled (credentials, "GET_REPORT_CONFIGS"))
{
case 0:
case -1:
break;
case 1:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to send command to manager daemon.",
response_data);
case 2:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to receive response from manager daemon.",
response_data);
default:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. It is unclear whether"
" the alert has been saved or not. "
"Diagnostics: Internal Error.",
response_data);
ret = gmp (connection, credentials, &response, &entity, response_data,
"<get_report_configs filter=\"rows=-1\"/>");
switch (ret)
{
case 0:
case -1:
break;
case 1:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to send command to manager daemon.",
response_data);
case 2:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to receive response from manager daemon.",
response_data);
default:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. It is unclear whether"
" the alert has been saved or not. "
"Diagnostics: Internal Error.",
response_data);
}
g_string_append (xml, response);
g_free (response);
free_entity (entity);
}
g_string_append (xml, response);
g_free (response);
free_entity (entity);

/* Get Report Filters. */

Expand Down

0 comments on commit 43ad624

Please sign in to comment.