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

Ensure that new kb taken by the scanner are always clean. (bp #469) #471

Merged
merged 2 commits into from
Mar 29, 2021
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 @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added
- Add function ldap_enable_debug () [#453](https://github.com/greenbone/gvm-libs/pull/453)
- Ensure that new kb taken by the scanner are always clean. [#469](https://github.com/greenbone/gvm-libs/pull/469)

### Changed
- Use a char pointer instead of an zero-lenght array as kb_redis struct member. [443](https://github.com/greenbone/gvm-libs/pull/443)
Expand Down
6 changes: 5 additions & 1 deletion util/kb.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ redis_new (kb_t *kb, const char *kb_path)
rc = -1;
}

/* Ensure that the new kb is clean */
redis_delete_all (kbr);

*kb = (kb_t) kbr;

/* Try to make unused memory available for the OS again. */
Expand Down Expand Up @@ -1603,7 +1606,8 @@ redis_delete_all (struct kb_redis *kbr)
if (sigaction (SIGPIPE, &new_action, &original_action))
return -1;

g_debug ("%s: deleting all elements from KB #%u", __func__, kbr->db);
if (kbr)
g_debug ("%s: deleting all elements from KB #%u", __func__, kbr->db);
rep = redis_cmd (kbr, "FLUSHDB");
if (rep == NULL || rep->type != REDIS_REPLY_STATUS)
{
Expand Down