Skip to content

Commit

Permalink
Merge pull request #1413 from greenbone/mergify/bp/master/pr-1395
Browse files Browse the repository at this point in the history
Improve "Failed to find..." messages (20.08) (bp #1395)
  • Loading branch information
timopollmeier authored Feb 8, 2021
2 parents 9915fbc + 08758be commit c02001b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Allow config to sync even if NVT family is not available [#1366](https://github.com/greenbone/gvmd/pull/1366)
- Delete report format dirs last when deleting a user [#1368](https://github.com/greenbone/gvmd/pull/1368)
- Fix sorting in get_aggregates and its documentation [#1375](https://github.com/greenbone/gvmd/pull/1375)
- Improve "Failed to find..." messages [#1395](https://github.com/greenbone/gvmd/pull/1395)

### Removed
- Remove DROP from vulns creation [#1281](http://github.com/greenbone/gvmd/pull/1281)
Expand Down
25 changes: 15 additions & 10 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -11218,7 +11218,7 @@ handle_get_alerts (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_alerts", "alert", get_alerts_data->get.filt_id,
("get_alerts", "filter", get_alerts_data->get.filt_id,
gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -11782,7 +11782,7 @@ handle_get_configs (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_configs", "config", get_configs_data->get.filt_id,
("get_configs", "filter", get_configs_data->get.filt_id,
gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -12152,7 +12152,7 @@ handle_get_credentials (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client ("get_credentials",
"credential",
"filter",
get_credentials_data->get.filt_id,
gmp_parser))
{
Expand Down Expand Up @@ -12941,7 +12941,7 @@ handle_get_groups (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_groups", "group", get_groups_data->get.filt_id,
("get_groups", "filter", get_groups_data->get.filt_id,
gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -13197,8 +13197,13 @@ handle_get_info (gmp_parser_t *gmp_parser, GError **error)
switch (ret)
{
case 1:
if (send_find_error_to_client ("get_info", "type",
get_info_data->type,
if (send_find_error_to_client ("get_info",
get_info_data->name
? "name"
: "ID",
get_info_data->name
? get_info_data->name
: get_info_data->get.id,
gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -14103,7 +14108,7 @@ handle_get_port_lists (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_port_lists", "port_list",
("get_port_lists", "filter",
get_port_lists_data->get.filt_id, gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -15435,7 +15440,7 @@ handle_get_roles (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_roles", "role", get_roles_data->get.filt_id,
("get_roles", "filter", get_roles_data->get.filt_id,
gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -17021,7 +17026,7 @@ handle_get_tasks (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_tasks", "task", get_tasks_data->get.filt_id,
("get_tasks", "filter", get_tasks_data->get.filt_id,
gmp_parser))
{
error_send_to_client (error);
Expand Down Expand Up @@ -17734,7 +17739,7 @@ handle_get_users (gmp_parser_t *gmp_parser, GError **error)
break;
case 2:
if (send_find_error_to_client
("get_users", "user", get_users_data->get.filt_id,
("get_users", "filter", get_users_data->get.filt_id,
gmp_parser))
{
error_send_to_client (error);
Expand Down
8 changes: 4 additions & 4 deletions src/gmp_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ send_find_error_to_client (const char* command, const char* type,
gchar *msg;
gboolean ret;

msg = g_strdup_printf ("<%s_response status=\""
STATUS_ERROR_MISSING
"\" status_text=\"Failed to find %s '%s'\"/>",
command, type, id);
msg = g_markup_printf_escaped ("<%s_response status=\""
STATUS_ERROR_MISSING
"\" status_text=\"Failed to find %s '%s'\"/>",
command, type, id);
ret = send_to_client (msg, gmp_parser->client_writer,
gmp_parser->client_writer_data);
g_free (msg);
Expand Down

0 comments on commit c02001b

Please sign in to comment.