Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warning for source_iface settings which will be removed with 21.10 release #732

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added
- Improve nasl linter to catch more cases of undeclared variables. [#728][(https://github.com/greenbone/openvas-scanner/pull/728)
- Add deprecation warning for source_iface related settings which will be removed with the 21.10 release. [#732][(https://github.com/greenbone/openvas-scanner/pull/732)

### Changed
- Update default log config [#711](https://github.com/greenbone/openvas-scanner/pull/711)
Expand Down
37 changes: 37 additions & 0 deletions src/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,41 @@ vhosts_to_str (GSList *list)
return g_string_free (string, FALSE);
}

/**
* @brief Check if any deprecated prefs are in pref table and print warning.
*/
static void
check_deprecated_prefs ()
{
const gchar *source_iface = prefs_get ("source_iface");
const gchar *ifaces_allow = prefs_get ("ifaces_allow");
const gchar *ifaces_deny = prefs_get ("ifaces_deny");
const gchar *sys_ifaces_allow = prefs_get ("sys_ifaces_allow");
const gchar *sys_ifaces_deny = prefs_get ("sys_ifaces_deny");

if (source_iface || ifaces_allow || ifaces_deny || sys_ifaces_allow
|| sys_ifaces_deny)
{
kb_t main_kb = NULL;
gchar *msg = NULL;

msg = g_strdup_printf (
"The following provided settings are deprecated and will be ignored "
"starting with the upcoming release 21.10: %s%s%s%s%s",
source_iface ? "source_iface (task setting) " : "",
ifaces_allow ? "ifaces_allow (user setting) " : "",
ifaces_deny ? "ifaces_deny (user setting) " : "",
sys_ifaces_allow ? "sys_ifaces_allow (scanner only setting) " : "",
sys_ifaces_deny ? "sys_ifaces_deny (scanner only setting)" : "");
g_warning ("%s: %s", __func__, msg);

connect_main_kb (&main_kb);
message_to_client (main_kb, msg, NULL, NULL, "ERRMSG");
kb_lnk_reset (main_kb);
g_free (msg);
}
}

/*
* Check if a scan is authorized on a host.
*
Expand Down Expand Up @@ -1049,6 +1084,8 @@ attack_network (struct scan_globals *globals)
GSList *unresolved;
char buf[96];

check_deprecated_prefs ();

gboolean test_alive_hosts_only = prefs_get_bool ("test_alive_hosts_only");
gvm_hosts_t *alive_hosts_list = NULL;
kb_t alive_hosts_kb = NULL;
Expand Down