diff --git a/CHANGELOG.md b/CHANGELOG.md index 36cbb91ef..60152a0db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/manage_pg.c b/src/manage_pg.c index 555f5b231..fb68a33a7 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -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;" diff --git a/src/manage_sql_secinfo.c b/src/manage_sql_secinfo.c index 747ed71a7..9509f0bab 100644 --- a/src/manage_sql_secinfo.c +++ b/src/manage_sql_secinfo.c @@ -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 */