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

Use error variable in osp_get_vts_version(), #1159

Merged
merged 1 commit into from
Jun 29, 2020
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 @@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Do not ignore empty hosts_allow and ifaces_allow [#1064](https://github.com/greenbone/gvmd/pull/1064)
- Reduce the memory cache of NVTs [#1076](https://github.com/greenbone/gvmd/pull/1076)
- Sync SCAP using a second schema [#1111](https://github.com/greenbone/gvmd/pull/1111)
- Use error variable in osp_get_vts_version(). [#1159](https://github.com/greenbone/gvmd/pull/1159)

### Fixed
- Add NULL check in nvts_feed_version_epoch [#768](https://github.com/greenbone/gvmd/pull/768)
Expand Down
16 changes: 12 additions & 4 deletions src/manage_sql_nvts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,7 @@ update_nvt_cache_osp (const gchar *update_socket, gchar *db_feed_version,
return -1;
}

get_vts_opts = osp_get_vts_opts_default;
if (db_feed_version)
get_vts_opts.filter = g_strdup_printf ("modification_time>%s", db_feed_version);
else
Expand Down Expand Up @@ -1799,6 +1800,7 @@ manage_update_nvt_cache_osp (const gchar *update_socket)
{
osp_connection_t *connection;
gchar *db_feed_version, *scanner_feed_version;
gchar *error;

/* Re-open DB after fork. */

Expand All @@ -1817,9 +1819,12 @@ manage_update_nvt_cache_osp (const gchar *update_socket)
return -1;
}

if (osp_get_vts_version (connection, &scanner_feed_version))
error = NULL;
if (osp_get_vts_version (connection, &scanner_feed_version, &error))
{
g_debug ("%s: failed to get scanner_version", __func__);
g_debug ("%s: failed to get scanner_feed_version. %s",
__func__, error ? : "");
g_free (error);
return -1;
}
g_debug ("%s: scanner_feed_version: %s", __func__, scanner_feed_version);
Expand Down Expand Up @@ -1870,6 +1875,7 @@ update_or_rebuild_nvts (int update)
gchar *db_feed_version, *scanner_feed_version;
osp_connection_t *connection;
int ret;
gchar *error;

if (check_osp_vt_update_socket ())
{
Expand All @@ -1896,9 +1902,11 @@ update_or_rebuild_nvts (int update)
return -1;
}

if (osp_get_vts_version (connection, &scanner_feed_version))
error = NULL;
if (osp_get_vts_version (connection, &scanner_feed_version, &error))
{
printf ("Failed to get scanner_version.\n");
printf ("Failed to get scanner_version. %s\n", error ? : "");
g_free (error);
return -1;
}
g_debug ("%s: scanner_feed_version: %s", __func__, scanner_feed_version);
Expand Down