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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 12 09:57:23 CEST 2008


Author: mwiegand
Date: 2008-09-12 09:57:23 +0200 (Fri, 12 Sep 2008)
New Revision: 1335

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/comm.c
Log:
* nessus/comm.c (parse_plugin, comm_get_plugins_md5): Fixed parser to
correctly handle the OIDs send by the server.


Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2008-09-12 07:24:44 UTC (rev 1334)
+++ trunk/openvas-client/ChangeLog	2008-09-12 07:57:23 UTC (rev 1335)
@@ -1,3 +1,8 @@
+2008-09-12  Michael Wiegand <michael.wiegand at intevation.de>
+
+	* nessus/comm.c (parse_plugin, comm_get_plugins_md5): Fixed parser to
+	correctly handle the OIDs send by the server.
+
 2008-09-11  Tim Brown <timb at nth-dimension.org.uk>
 
 	* nessus/monitor_dialog.c: Fixed #758, which leads to an OpenVAS client

Modified: trunk/openvas-client/nessus/comm.c
===================================================================
--- trunk/openvas-client/nessus/comm.c	2008-09-12 07:24:44 UTC (rev 1334)
+++ trunk/openvas-client/nessus/comm.c	2008-09-12 07:57:23 UTC (rev 1335)
@@ -148,11 +148,16 @@
   char * bid = NULL;
   char * xref = NULL;
 
-  str = parse_separator(buf);
-  if(!str) return NULL;
-  oid = str;
+  char * space = strstr(buf, " ");
+  if(space != NULL)
+  {
+    oid = emalloc((space - buf) + 1);
+    snprintf(oid, (space - buf) + 1, "%s", buf);
+  }
+  else
+    return NULL;
 
-  l = strlen(str) + 5;
+  l = strlen(oid);
   str = parse_separator(buf + l);
   if(!str) return NULL;
   name = str;
@@ -902,13 +907,14 @@
 	break;
       else
       {
-	char * oid = parse_separator(buf);
-	char * rest = buf + strlen(oid) + 5;
+        char * space = strstr(buf, " ");
+        if(space != NULL)
+        {
+          char * oid = emalloc((space - buf) + 1);
+          snprintf(oid, (space - buf) + 1, "%s", buf);
+          char * md5sum = buf + strlen(oid) + 5;
 
-	if (strncmp(rest, " <|> ", 5) == 0)
-	{
 	  struct nessus_plugin * plugin = NULL;
-	  char *md5sum = rest + 5;
 
 	  /* the md5sum goes on until the end of the line.  Strip the
 	   * trailing newline */
@@ -916,7 +922,7 @@
 	  if (md5sum[md5len - 1] == '\n')
 	    md5sum[md5len - 1] = '\0';
 
-	  plugin = nessus_plugin_get_by_oid(context->plugins, oid);
+          plugin = nessus_plugin_get_by_oid(context->plugins, oid);
 	  if (plugin == NULL)
 	    plugin = nessus_plugin_get_by_oid(context->scanners, oid);
 	  if (callback(context, oid, md5sum, plugin, data))



More information about the Openvas-commits mailing list