Skip to content

Commit

Permalink
Merge pull request #1080 from timopollmeier/ovaldefs-delete-fix-9.0
Browse files Browse the repository at this point in the history
Fix deletion of OVAL definition data (9.0)
  • Loading branch information
mattmundell authored May 12, 2020
2 parents a5d3e4a + 7f20961 commit 7dfea86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix scanner_options not inserted correctly when starting ospd task [#1056](https://github.com/greenbone/gvmd/pull/1056)
- Fix QoD handling in NVTi cache and sensor scans [#1060](https://github.com/greenbone/gvmd/pull/1060)
- Fix doc of get_tasks in GMP doc [#1065](https://github.com/greenbone/gvmd/pull/1065)
- Fix deletion of OVAL definition data [#1080](https://github.com/greenbone/gvmd/pull/1080)

### Removed
- Remove 1.3.6.1.4.1.25623.1.0.90011 from Discovery config (9.0) [#847](https://github.com/greenbone/gvmd/pull/847)
Expand Down
3 changes: 3 additions & 0 deletions src/manage_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3674,6 +3674,9 @@ manage_db_init (const gchar *name)
sql ("CREATE OR REPLACE FUNCTION scap_delete_oval ()"
" RETURNS TRIGGER AS $$"
" BEGIN"
" DELETE FROM affected_ovaldefs"
" WHERE id IN (SELECT id FROM ovaldefs"
" WHERE ovaldefs.xml_file = old.xml_file);"
" DELETE FROM ovaldefs WHERE ovaldefs.xml_file = old.xml_file;"
" RETURN old;"
" END;"
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_secinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5210,9 +5210,9 @@ rebuild_scap (const char *type)
|| strcasecmp (type, "ovaldef") == 0)
{
g_debug ("%s: rebuilding ovaldefs", __func__);
sql ("DELETE FROM ovalfiles");
sql ("DELETE FROM affected_ovaldefs");
sql ("DELETE FROM ovaldefs");
sql ("DELETE FROM ovalfiles");

ret = update_scap (lockfile,
TRUE, /* ignore_last_scap_update */
Expand Down

0 comments on commit 7dfea86

Please sign in to comment.