Author: felix
Date: 2008-10-21 09:53:12 +0200 (Tue, 21 Oct 2008)
New Revision: 1586

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/comm.c
   trunk/openvas-client/nessus/plugin_cache.c
   trunk/openvas-client/nessus/preferences.c
Log:
* nessus/commc.c (parse_plugin): Peeled if-onion, variable name improved
* nessus/plugin_cache.c: Updated doc/comments about format of nvt 
cache file.
* nessus/preferences.c: Fixed tiny typo in comment.

M    openvas-client/nessus/preferences.c
M    openvas-client/nessus/plugin_cache.c
M    openvas-client/nessus/comm.c
M    openvas-client/ChangeLog


Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog      2008-10-21 06:23:42 UTC (rev 1585)
+++ trunk/openvas-client/ChangeLog      2008-10-21 07:53:12 UTC (rev 1586)
@@ -1,3 +1,12 @@
+2008-10-21  Felix Wolfsteller <[EMAIL PROTECTED]>
+
+       * nessus/commc.c (parse_plugin): Peeled if-onion, variable name improved
+
+       * nessus/plugin_cache.c: Updated doc/comments about format of nvt 
+       cache file.
+
+       * nessus/preferences.c: Fixed tiny typo in comment.
+
 2008-10-20  Michael Wiegand <[EMAIL PROTECTED]>
 
        * po/de.po: Updated German translation.

Modified: trunk/openvas-client/nessus/comm.c
===================================================================
--- trunk/openvas-client/nessus/comm.c  2008-10-21 06:23:42 UTC (rev 1585)
+++ trunk/openvas-client/nessus/comm.c  2008-10-21 07:53:12 UTC (rev 1586)
@@ -129,12 +129,11 @@
  * plugin in it.
  */
 static struct nessus_plugin *
-parse_plugin(buf)
-  char *buf;
+parse_plugin(char * buf)
 {
   char *str = NULL;
   char *t;
-  size_t l;
+  size_t offset;
 
   char * oid = NULL;
   char * name = NULL;
@@ -157,65 +156,59 @@
   else
     return NULL;
 
-  l = strlen(oid);
-  str = parse_separator(buf + l);
+  offset = strlen(oid);
+  str = parse_separator(buf + offset);
   if(!str) return NULL;
   name = str;
 
-  l += strlen(str) + 5;
-  str = parse_separator(buf + l);
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
   if(!str) return NULL;
   category = str;
 
-  l += strlen(str) + 5;
-  str = parse_separator(buf + l);
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
   if(!str) return NULL;
   copyright = str;
 
-  l += strlen(str) + 5;
-  str = parse_separator(buf + l);
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
   if(!str) return NULL;
   t = str;
   while((t = strchr(t, ';')))
     t[0] = '\n';
   description = str;
 
-  l += strlen(str) + 5;
-  str = parse_separator(buf + l);
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
   if(!str) return NULL;
   summary = str;
 
-  l += strlen(str) + 5;
-  str = parse_separator(buf + l);
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
   if(!str) return NULL;
   family = str;
 
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
+  if(!str) return NULL;
+  version = str;
 
-  l += strlen(str) + 5;
-  str = parse_separator(buf + l);
-  if(str)
-  {
-    version = str;
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
+  if(!str) return NULL;
+  cve = str;
 
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
+  if(!str) return NULL;
+  bid = str;
 
-    l += strlen(str) + 5;
-    str = parse_separator(buf + l);
-    if(str != NULL)
-    {
-      cve = str;
-      l += strlen(str) + 5;
+  offset += strlen(str) + 5;
+  str = parse_separator(buf + offset);
+  if(!str) return NULL;
+  xref = str;
 
-      str = parse_separator(buf + l);
-      if(str != NULL)
-      {
-       bid = str;
-       l += strlen(str) + 5;
-       str = parse_separator(buf + l);
-       if(str != NULL) xref = str;
-      }
-    }
-  }
-
   return nessus_plugin_new(oid, name, category, copyright, description,
                            summary, family, version, cve, bid, xref);
 }
@@ -225,6 +218,7 @@
 
 
 
+
 /*
  * comm_init
  *

Modified: trunk/openvas-client/nessus/plugin_cache.c
===================================================================
--- trunk/openvas-client/nessus/plugin_cache.c  2008-10-21 06:23:42 UTC (rev 
1585)
+++ trunk/openvas-client/nessus/plugin_cache.c  2008-10-21 07:53:12 UTC (rev 
1586)
@@ -46,9 +46,10 @@
  * all | with NUL and then %-unescaping each field.  Unescaping never
  * makes the string longer and thus can be done in place.
  *
- * There are several kinds of lines, distinguished by the keyword:
+ * There are several kinds of lines, distinguished by keywords.
+ * For a healthy cache file they appear in the following order:
  *
- *   OpenVASNVTCache
+ *   OpenVASNVTDescCache
  *
  *     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
@@ -66,6 +67,12 @@
  *     category, copyright, description, summary, family, version, cve,
  *     bid, xrefs.
  *
+ *   dependency
+ *
+ *     Description of a dependency. Currently, in this line the plugins
+ *     are refered to by their respective name. Indication is that the
+ *     first plugin depends on the later.
+ *
  *   end
  *
  *     No further fields.  This line marks the end of the file.  If it's
@@ -77,9 +84,9 @@
  * ----------
  *
  * A cache file is specific for a given context and is stored in the
- * same directory as the nessusrc file for the context.  The cache for
- * the global context is ~/.openvas_plugin_cache.  If an alternate
- * nessurc file was given on the command line, no caching is done.
+ * same directory as the openvasrc file for the context.  The cache for
+ * the global context is ~/.openvas_nvt_cache.  If an alternate
+ * openvas file was given on the command line, no caching is done.
  */
 
 #include <includes.h>
@@ -92,7 +99,6 @@
 #include "globals.h"
 #include "plugin_cache.h"
 
-
 /* file format constants */
 #define MAX_HEADER_ITEMS 3
 #define MAX_LINE_ITEMS 13

Modified: trunk/openvas-client/nessus/preferences.c
===================================================================
--- trunk/openvas-client/nessus/preferences.c   2008-10-21 06:23:42 UTC (rev 
1585)
+++ trunk/openvas-client/nessus/preferences.c   2008-10-21 07:53:12 UTC (rev 
1586)
@@ -240,6 +240,7 @@
     }
   }
 
+  /* Parse file that has been opened without error */
   buffer = emalloc(4096);
   while(!feof(fd) && fgets(buffer, 4096, fd))
   {
@@ -310,7 +311,7 @@
   char *value;
   int val = -1;
 
-  /* If we need to heep the order, we have to use arg_add_value,
+  /* If we need to keep the order, we have to use arg_add_value,
    * otherwise we can use the faster (for long lists much faster)
    * arg_add_value_at_head */
   void (*arg_add)(struct arglist *, const char *, int, long, void *)

_______________________________________________
Openvas-commits mailing list
[email protected]
http://lists.wald.intevation.org/mailman/listinfo/openvas-commits

Reply via email to