diff --git a/CHANGELOG.md b/CHANGELOG.md index e65ff164e..0cd244606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -110,6 +110,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix doc of get_tasks in GMP doc [#1066](https://github.com/greenbone/gvmd/pull/1066) - Improve refs and error handling in NVTs update [#1067](https://github.com/greenbone/gvmd/pull/1067) - Fix failure detection for xml_split command [#1074](https://github.com/greenbone/gvmd/pull/1074) +- Fix deletion of OVAL definition data [#1079](https://github.com/greenbone/gvmd/pull/1079) ### Removed - Remove support for "All SecInfo": removal of "allinfo" for type in get_info [#790](https://github.com/greenbone/gvmd/pull/790) diff --git a/src/manage_pg.c b/src/manage_pg.c index b8a0d3e41..c4ace7510 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -3201,6 +3201,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 5c4f2e98e..7600cf9f0 100644 --- a/src/manage_sql_secinfo.c +++ b/src/manage_sql_secinfo.c @@ -5003,9 +5003,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 (TRUE, /* ignore_last_scap_update */ FALSE, /* update_cpes */