Author: mattm Date: 2016-10-14 13:42:26 +0200 (Fri, 14 Oct 2016) New Revision: 26406
Modified: trunk/openvas-manager/ChangeLog trunk/openvas-manager/src/manage_sql.c Log: * src/manage_sql.c (check_db_configs): Only check for removed Service Detection NVTs when there are NVTs in the nvts table. Modified: trunk/openvas-manager/ChangeLog =================================================================== --- trunk/openvas-manager/ChangeLog 2016-10-14 07:31:20 UTC (rev 26405) +++ trunk/openvas-manager/ChangeLog 2016-10-14 11:42:26 UTC (rev 26406) @@ -1,3 +1,8 @@ +2016-10-14 Matthew Mundell <matthew.mund...@greenbone.net> + + * src/manage_sql.c (check_db_configs): Only check for removed Service + Detection NVTs when there are NVTs in the nvts table. + 2016-10-13 Matthew Mundell <matthew.mund...@greenbone.net> * src/manage_migrators.c (migrate_153_to_154): Put closing parens on Modified: trunk/openvas-manager/src/manage_sql.c =================================================================== --- trunk/openvas-manager/src/manage_sql.c 2016-10-14 07:31:20 UTC (rev 26405) +++ trunk/openvas-manager/src/manage_sql.c 2016-10-14 11:42:26 UTC (rev 26406) @@ -14750,15 +14750,21 @@ /* In the Service Detection family, NVTs sometimes move to Product * Detection, and once an NVT was removed. So remove those NVTs * from Service Detection in the NVT selector. */ + sql ("DELETE FROM nvt_selectors" " WHERE name = '" MANAGE_NVT_SELECTOR_UUID_DISCOVERY "'" " AND family = 'Service detection'" - " AND (((SELECT family FROM nvts" - " WHERE oid = nvt_selectors.family_or_nvt)" - " = 'Product detection')" - " OR NOT EXISTS (SELECT * FROM nvts" - " WHERE oid = nvt_selectors.family_or_nvt));"); + " AND (SELECT family FROM nvts" + " WHERE oid = nvt_selectors.family_or_nvt)" + " = 'Product detection';"); + if (sql_int ("SELECT EXISTS (SELECT * FROM nvts);")) + sql ("DELETE FROM nvt_selectors" + " WHERE name = '" MANAGE_NVT_SELECTOR_UUID_DISCOVERY "'" + " AND family = 'Service detection'" + " AND NOT EXISTS (SELECT * FROM nvts" + " WHERE oid = nvt_selectors.family_or_nvt);"); + if (sql_int ("SELECT count(*) FROM configs" " WHERE uuid = '%s';", CONFIG_UUID_HOST_DISCOVERY) _______________________________________________ Openvas-commits mailing list Openvas-commits@wald.intevation.org https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits