[Openvas-commits] r6026 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Dec 1 16:15:13 CET 2009


Author: mwiegand
Date: 2009-12-01 16:15:12 +0100 (Tue, 01 Dec 2009)
New Revision: 6026

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/tasks_sql.h
Log:
Set up an empty scan config as template for new configs.

* src/tasks_sql.h (init_manage): Make sure the scan config 'empty'
exists, create it if it does not.
(delete_config): Refuse to delete 'empty'.
(config_in_use): Set 'empty' as in use.



Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-12-01 13:57:56 UTC (rev 6025)
+++ trunk/openvas-manager/ChangeLog	2009-12-01 15:15:12 UTC (rev 6026)
@@ -1,3 +1,12 @@
+2009-12-01  Michael Wiegand <michael.wiegand at greenbone.net>
+
+	Set up an empty scan config as template for new configs.
+
+	* src/tasks_sql.h (init_manage): Make sure the scan config 'empty'
+	exists, create it if it does not.
+	(delete_config): Refuse to delete 'empty'.
+	(config_in_use): Set 'empty' as in use.
+
 2009-11-30  Michael Wiegand <michael.wiegand at greenbone.net>
 
 	Post-release version bump.

Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h	2009-12-01 13:57:56 UTC (rev 6025)
+++ trunk/openvas-manager/src/tasks_sql.h	2009-12-01 15:15:12 UTC (rev 6026)
@@ -2425,6 +2425,24 @@
       setup_full_config_prefs (config, 0, 0, 1);
     }
 
+  if (sql_int (0, 0,
+               "SELECT count(*) FROM configs"
+               " WHERE name = 'empty';")
+      == 0)
+    {
+      config_t config;
+
+      sql ("INSERT into configs (name, nvt_selector, comment, family_count,"
+           " nvt_count, nvts_growing, families_growing)"
+           " VALUES ('empty', 'empty',"
+           " 'Empty and static configuration template',"
+           " 0, 0, 0, 0);");
+
+      /* Setup preferences for the config. */
+      config = sqlite3_last_insert_rowid (task_db);
+      setup_full_config_prefs (config, 1, 1, 0);
+    }
+
   /* Ensure the predefined target exists. */
 
   if (sql_int (0, 0, "SELECT count(*) FROM targets WHERE name = 'Localhost';")
@@ -5541,7 +5559,8 @@
   if (strcmp (name, "Full and fast") == 0
       || strcmp (name, "Full and fast ultimate") == 0
       || strcmp (name, "Full and very deep") == 0
-      || strcmp (name, "Full and very deep ultimate") == 0)
+      || strcmp (name, "Full and very deep ultimate") == 0
+      || strcmp (name, "empty") == 0)
     return 1;
 
   quoted_name = sql_nquote (name, strlen (name));
@@ -5650,7 +5669,8 @@
   if (strcmp (name, "Full and fast") == 0
       || strcmp (name, "Full and fast ultimate") == 0
       || strcmp (name, "Full and very deep") == 0
-      || strcmp (name, "Full and very deep ultimate") == 0)
+      || strcmp (name, "Full and very deep ultimate") == 0
+      || strcmp (name, "empty") == 0)
     return 1;
 
   quoted_name = sql_quote (name);



More information about the Openvas-commits mailing list