Skip to content

Commit

Permalink
Send the hosts count to the client as -1, because the invalid target …
Browse files Browse the repository at this point in the history
…list

This allows ospd to finish the scan gracefully, setting the scan to finished
instead of interrupted, but sending the error message as well.
  • Loading branch information
jjnicola committed Feb 1, 2021
1 parent 5a9c491 commit db7748c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix snmp result. Only return the value and do not stop at the first \n. [#627](https://github.com/greenbone/openvas/pull/627)
- Fix masking of IPv6 addresses. [#635](https://github.com/greenbone/openvas/pull/635)
- Fix technique switch for getting the appropriate interface to use for IPv6 dst addr. [#636](https://github.com/greenbone/openvas/pull/636)
- Fix host count. Set to -1 when the target string is invalid. [#646](https://github.com/greenbone/openvas/pull/646)

[20.08]: https://github.com/greenbone/openvas/compare/v20.8.0...openvas-20.08

Expand Down
8 changes: 7 additions & 1 deletion src/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
* process bar.
*/
#define PROGRESS_BAR_STYLE 1
/**
* Define value to be sent to the client for invalid target list.
**/
#define INVALID_TARGET_LIST "-1"

#undef G_LOG_DOMAIN
/**
Expand Down Expand Up @@ -1082,9 +1086,11 @@ attack_network (struct scan_globals *globals)
connect_main_kb (&main_kb);
message_to_client (main_kb, buffer, NULL, NULL, "ERRMSG");
g_free (buffer);
/* Send the hosts count to the client as -1,
* because the invalid target list.*/
message_to_client (main_kb, "-1", NULL, NULL, "HOSTS_COUNT");
kb_lnk_reset (main_kb);
g_warning ("Invalid target list. Scan terminated.");
set_scan_status ("finished");
goto stop;
}

Expand Down

0 comments on commit db7748c

Please sign in to comment.