[Openvas-commits] r1316 - in trunk/openvas-client: . nessus

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 10 10:30:20 CEST 2008


Author: jan
Date: 2008-09-10 10:30:19 +0200 (Wed, 10 Sep 2008)
New Revision: 1316

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/plugin_cache.c
   trunk/openvas-client/nessus/plugin_infos.c
Log:
Migrate plugin(nvt) caches to OID.

* nessus/plugin_cache.c: Changed HEADER_MAGIC to OpenVAS code,
because the structure of caches changes. Also changed PLUGIN_KEYWORD
to "nvt", while we are at it. And rename PLUGIN_KEYWORD to NVT_KEYWORD.
(write_plugin): Write OID instead of ID into plugin cache.
(plugin_cache_get_filename): Renamed cache file from "nessus_plugin_cache"
to "openvas_nvt_cache" and global cache file from ".openvas_plugin_cache" to
".openvas_nvt_cache".

* nessus/plugin_infos.c (plugin_info_window_setup): Now display the OID in
instead of ID in the info dialog.



Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2008-09-10 08:22:48 UTC (rev 1315)
+++ trunk/openvas-client/ChangeLog	2008-09-10 08:30:19 UTC (rev 1316)
@@ -1,3 +1,18 @@
+2008-09-10  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
+
+	Migrate plugin(nvt) caches to OID.
+
+	* nessus/plugin_cache.c: Changed HEADER_MAGIC to OpenVAS code,
+	because the structure of caches changes. Also changed PLUGIN_KEYWORD
+	to "nvt", while we are at it. And rename PLUGIN_KEYWORD to NVT_KEYWORD.
+	(write_plugin): Write OID instead of ID into plugin cache.
+	(plugin_cache_get_filename): Renamed cache file from "nessus_plugin_cache"
+	to "openvas_nvt_cache" and global cache file from ".openvas_plugin_cache" to
+	".openvas_nvt_cache".
+
+	* nessus/plugin_infos.c (plugin_info_window_setup): Now display the OID in
+	instead of ID in the info dialog.
+
 2008-09-09  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
 
 	Migrate PLUGIN_INFO request based on OIDs.

Modified: trunk/openvas-client/nessus/plugin_cache.c
===================================================================
--- trunk/openvas-client/nessus/plugin_cache.c	2008-09-10 08:22:48 UTC (rev 1315)
+++ trunk/openvas-client/nessus/plugin_cache.c	2008-09-10 08:30:19 UTC (rev 1316)
@@ -48,7 +48,7 @@
  *
  * There are several kinds of lines, distinguished by the keyword:
  *
- *   NessusClientPluginCache
+ *   OpenVASNVTCache
  *
  *     This is only and always used on the first line and also serves as
  *     a magic string identifying the file.  The following fields are in
@@ -60,9 +60,9 @@
  *      - the hex-encoded md5sum that was reported by the server for the
  *        set of plugins saved in the cache.
  *
- *   plugin
+ *   nvt
  *
- *     Plugin desription.  The rest of the fields are: id, md5sum, name,
+ *     NVT desription.  The rest of the fields are: oid, md5sum, name,
  *     category, copyright, description, summary, family, version, cve,
  *     bid, xrefs.
  *
@@ -96,16 +96,16 @@
 /* file format constants */
 #define MAX_HEADER_ITEMS 3
 #define MAX_LINE_ITEMS 13
-#define HEADER_MAGIC "NessusClientPluginCache"
+#define HEADER_MAGIC "OpenVASNVTDescCache"
 #define FILE_FORMAT_VERSION 0
-#define PLUGIN_KEYWORD "plugin"
+#define NVT_KEYWORD "nvt"
 #define DEP_KEYWORD "dependency"
 #define END_KEYWORD "end"
 
 /* Determine the cache file to use for the context.
  *
  * The cache file will be in the same directory as the nessusrc file of
- * the context.  The return value has to be free's with efree.
+ * the context.  The return value has to be free'd with efree.
  */
 char *
 plugin_cache_get_filename(struct context *context)
@@ -114,15 +114,15 @@
 
   if (context->dir)
   {
-    filename = emalloc(strlen(context->dir) + strlen("/nessus_plugin_cache")+1);
-    sprintf(filename, "%s/nessus_plugin_cache", context->dir);
+    filename = emalloc(strlen(context->dir) + strlen("/openvas_nvt_cache")+1);
+    sprintf(filename, "%s/openvas_nvt_cache", context->dir);
   }
   else
   {
     char *home = prefs_get_nessushome();
 
-    filename = emalloc(strlen(home) + strlen("/.openvas_plugin_cache") + 1);
-    sprintf(filename, "%s/.openvas_plugin_cache", home);
+    filename = emalloc(strlen(home) + strlen("/.openvas_nvt_cache") + 1);
+    sprintf(filename, "%s/.openvas_nvt_cache", home);
   }
 
   return filename;
@@ -235,8 +235,8 @@
   if (md5sum == NULL)
     md5sum = "";
 
-  return write_record(file, "kisssssssssss", PLUGIN_KEYWORD,
-      plugin->id, md5sum, plugin->name, plugin->category, plugin->copyright,
+  return write_record(file, "kssssssssssss", NVT_KEYWORD,
+      plugin->oid, md5sum, plugin->name, plugin->category, plugin->copyright,
       nessus_plugin_get_description(plugin), plugin->summary, plugin->family,
       plugin->version, plugin->cve, plugin->bid, plugin->xrefs);
 }
@@ -701,9 +701,9 @@
       break;
     }
 
-    if (nitems == 13 && strcmp(items[0], PLUGIN_KEYWORD) == 0)
+    if (nitems == 13 && strcmp(items[0], NVT_KEYWORD) == 0)
     {
-      struct nessus_plugin *plugin = nessus_plugin_new(items[1] /*id*/,
+      struct nessus_plugin *plugin = nessus_plugin_new(items[1] /*oid*/,
 	  items[3] /*name*/, items[4] /*category*/, items[5] /*copyright*/,
 	  items[6] /*description*/, items[7] /*summary*/,
 	  items[8] /*family*/, items[9] /*version*/, items[10] /*cve*/,

Modified: trunk/openvas-client/nessus/plugin_infos.c
===================================================================
--- trunk/openvas-client/nessus/plugin_infos.c	2008-09-10 08:22:48 UTC (rev 1315)
+++ trunk/openvas-client/nessus/plugin_infos.c	2008-09-10 08:30:19 UTC (rev 1316)
@@ -326,8 +326,8 @@
   gtk_misc_set_alignment((GtkMisc *)label, 0, 1);
   gtk_widget_show(label);
 
-  /* The Plugin ID */
-  snprintf(buf, sizeof(buf), _("OpenVAS Plugin ID: %d"), plugin->id);
+  /* The NVT OID */
+  snprintf(buf, sizeof(buf), _("OpenVAS NVT OID: %s"), plugin->oid);
   label = gtk_label_new(buf);
   gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE,0);
   gtk_misc_set_alignment((GtkMisc *)label, 0, 1);



More information about the Openvas-commits mailing list