[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvas-cvs
Subject:    [Openvas-commits] r22662 - in trunk/openvas-scanner: . src
From:       scm-commit () wald ! intevation ! org
Date:       2015-06-18 18:34:39
Message-ID: 20150618183439.6F1F09A194C1 () wald ! intevation ! org
[Download RAW message or body]

Author: kroosec
Date: 2015-06-18 20:34:39 +0200 (Thu, 18 Jun 2015)
New Revision: 22662

Modified:
   trunk/openvas-scanner/ChangeLog
   trunk/openvas-scanner/src/comm.c
   trunk/openvas-scanner/src/pluginscheduler.c
Log:
* src/comm.c (send_plug_info, comm_send_pluginlist),
src/pluginscheduler.c (plugins_scheduler_fill): Adjust to use
nvticache_get_names() and nvticache_get_by_name_full() in order to
reduce number of KB queries.

Modified: trunk/openvas-scanner/ChangeLog
===================================================================
--- trunk/openvas-scanner/ChangeLog	2015-06-18 18:32:03 UTC (rev 22661)
+++ trunk/openvas-scanner/ChangeLog	2015-06-18 18:34:39 UTC (rev 22662)
@@ -1,3 +1,10 @@
+2015-06-18  Hani Benhabiles  <hani.benhabiles@greenbone.net>
+
+	* src/comm.c (send_plug_info, comm_send_pluginlist),
+	src/pluginscheduler.c (plugins_scheduler_fill): Adjust to use
+	nvticache_get_names() and nvticache_get_by_name_full() in order to
+	reduce number of KB queries.
+
 2015-06-17  Hani Benhabiles  <hani.benhabiles@greenbone.net>
 
 	* src/hosts.c (hosts_new): Check if scan is stopped.

Modified: trunk/openvas-scanner/src/comm.c
===================================================================
--- trunk/openvas-scanner/src/comm.c	2015-06-18 18:32:03 UTC (rev 22661)
+++ trunk/openvas-scanner/src/comm.c	2015-06-18 18:34:39 UTC (rev 22662)
@@ -162,17 +162,17 @@
  * @brief Sends a plugin info.
  */
 void
-send_plug_info (int soc, const char *oid)
+send_plug_info (int soc, const char *filename)
 {
   int j, ignored = 0;
   static const char *categories[] = { ACT_STRING_LIST_ALL };
 #define CAT_MAX	(sizeof(categories) / sizeof(categories[0]))
   const char *name, *copyright, *summary, *version, *family;
-  nvti_t *nvti = nvticache_get_by_oid_full (oid);
+  nvti_t *nvti = nvticache_get_by_name_full (filename);
 
   if (!nvti)
     {
-      log_write ("NVTI not found for OID %s. Will not be sent.", oid);
+      log_write ("NVTI not found for %s. Will not be sent.", filename);
       return;
     }
 
@@ -290,7 +290,7 @@
 {
   GSList *list, *element;
 
-  list = element = nvticache_get_oids ();
+  list = element = nvticache_get_names ();
   send_printf (soc, "SERVER <|> PLUGIN_LIST <|>\n");
   while (element)
     {

Modified: trunk/openvas-scanner/src/pluginscheduler.c
===================================================================
--- trunk/openvas-scanner/src/pluginscheduler.c	2015-06-18 18:32:03 UTC (rev 22661)
+++ trunk/openvas-scanner/src/pluginscheduler.c	2015-06-18 18:34:39 UTC (rev 22662)
@@ -482,22 +482,20 @@
   int i;
   GSList *list, *element;
 
-  list = element = nvticache_get_oids ();
+  list = element = nvticache_get_names ();
   while (element)
     {
       struct scheduler_plugin *scheduler_plugin;
       struct list *dup;
-      char *oid;
       nvti_t *nvti;
       int category;
 
-      assert (element->data);
-      oid = g_strdup (element->data);
-      nvti = nvticache_get_by_oid_full (oid);
+      nvti = nvticache_get_by_name_full (element->data);
+      assert (nvti);
       category = nvti_category (nvti);
       scheduler_plugin = g_malloc0 (sizeof (struct scheduler_plugin));
       scheduler_plugin->running_state = PLUGIN_STATUS_UNRUN;
-      scheduler_plugin->oid = oid;
+      scheduler_plugin->oid = g_strdup (nvti_oid (nvti));
       scheduler_plugin->enabled = LAUNCH_DISABLED;
 
       assert (category <= ACT_LAST);

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic