Skip to content

Commit

Permalink
Merge pull request #646 from jjnicola/host-count
Browse files Browse the repository at this point in the history
Send the hosts count to the client as -1, because the invalid target list
  • Loading branch information
jjnicola committed Feb 1, 2021
2 parents 5a9c491 + 0384d34 commit 54211aa
Show file tree
Hide file tree
Showing 2 changed files with 9 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
9 changes: 8 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,12 @@ 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, INVALID_TARGET_LIST, 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 54211aa

Please sign in to comment.