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

Fix deletion of OVAL definition data (master) #1079

Merged
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 @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/manage_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
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 @@ -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 */
Expand Down