[Openvas-commits] r13724 - in trunk/openvas-scanner: . src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 12 00:19:00 CEST 2012


Author: jan
Date: 2012-07-12 00:19:00 +0200 (Thu, 12 Jul 2012)
New Revision: 13724

Modified:
   trunk/openvas-scanner/CMakeLists.txt
   trunk/openvas-scanner/ChangeLog
   trunk/openvas-scanner/src/nasl_plugins.c
   trunk/openvas-scanner/src/openvassd.c
   trunk/openvas-scanner/src/oval_plugins.c
Log:
Use nvticache API instead of store_* API in a first step.
Now it is mandatory that a cache directory really exists.

*  src/nasl_plugins.c (nasl_plugin_add): Replace use of store_
API by nvticache API.

* src/oval_plugins.c (oval_plugin_add): Replace use of store_
API by nvticache API.

* src/openvassd.c (init_openvassd): Replaced init via store_
by direct nvtichache calls. Make it mandatory that a
cache directory exists. Fallback of nvi directory not
used anymore.

* CMakeLists.txt: Increase dependency to openvas-libaries
to 6.0.0.



Modified: trunk/openvas-scanner/CMakeLists.txt
===================================================================
--- trunk/openvas-scanner/CMakeLists.txt	2012-07-11 21:44:37 UTC (rev 13723)
+++ trunk/openvas-scanner/CMakeLists.txt	2012-07-11 22:19:00 UTC (rev 13724)
@@ -185,7 +185,7 @@
 ## list and throw an error, otherwise long install-cmake-install-cmake cycles
 ## might occur.
 
-pkg_check_modules (LIBOPENVAS REQUIRED libopenvas>=5.0.0)
+pkg_check_modules (LIBOPENVAS REQUIRED libopenvas>=6.0.0)
 pkg_check_modules (GNUTLS REQUIRED gnutls>=2.2)
 pkg_check_modules (GLIB REQUIRED glib-2.0>=2.16)
 

Modified: trunk/openvas-scanner/ChangeLog
===================================================================
--- trunk/openvas-scanner/ChangeLog	2012-07-11 21:44:37 UTC (rev 13723)
+++ trunk/openvas-scanner/ChangeLog	2012-07-11 22:19:00 UTC (rev 13724)
@@ -1,3 +1,22 @@
+2012-07-12  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	Use nvticache API instead of store_* API in a first step.
+        Now it is mandatory that a cache directory really exists.
+
+	*  src/nasl_plugins.c (nasl_plugin_add): Replace use of store_
+	API by nvticache API.
+
+	* src/oval_plugins.c (oval_plugin_add): Replace use of store_
+	API by nvticache API.
+
+	* src/openvassd.c (init_openvassd): Replaced init via store_
+	by direct nvtichache calls. Make it mandatory that a
+	cache directory exists. Fallback of nvi directory not
+	used anymore.
+
+	* CMakeLists.txt: Increase dependency to openvas-libaries
+	to 6.0.0.
+
 2012-07-10  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	Post branch version bump.

Modified: trunk/openvas-scanner/src/nasl_plugins.c
===================================================================
--- trunk/openvas-scanner/src/nasl_plugins.c	2012-07-11 21:44:37 UTC (rev 13723)
+++ trunk/openvas-scanner/src/nasl_plugins.c	2012-07-11 22:19:00 UTC (rev 13724)
@@ -41,12 +41,13 @@
 #include <utime.h>
 
 #include <openvas/base/drop_privileges.h> /* for drop_privileges */
+#include <openvas/base/nvticache.h>       /* for nvticache_add */
 #include <openvas/nasl/nasl.h>
 #include <openvas/misc/network.h>    /* for internal_send */
 #include <openvas/misc/nvt_categories.h>  /* for ACT_SCANNER */
 #include <openvas/misc/plugutils.h>     /* for plug_set_launch */
 #include <openvas/misc/internal_com.h>  /* for INTERNAL_COMM_CTRL_FINISHED */
-#include <openvas/misc/store.h>      /* for store_plugin */
+#include <openvas/misc/store.h>      /* for store_load_plugin */
 #include <openvas/misc/system.h>     /* for emalloc */
 #include <openvas/misc/proctitle.h>  /* for setproctitle */
 
@@ -162,7 +163,9 @@
 
       if (nvti_oid (nvti) != NULL)
         {
-          store_plugin (plugin_args, name);
+          nvticache_add (arg_get_value(preferences, "nvticache"), nvti, name);
+          arg_set_value (plugin_args, "preferences", -1, NULL);
+          arg_free_all (plugin_args);
           plugin_args = store_load_plugin (name, preferences);
         }
       else

Modified: trunk/openvas-scanner/src/openvassd.c
===================================================================
--- trunk/openvas-scanner/src/openvassd.c	2012-07-11 21:44:37 UTC (rev 13723)
+++ trunk/openvas-scanner/src/openvassd.c	2012-07-11 22:19:00 UTC (rev 13724)
@@ -62,6 +62,7 @@
 #include <openvas/misc/services1.h>  /* for openvas_init_svc */
 #include <openvas/misc/proctitle.h>  /* for setproctitle.h */
 #include <openvas/base/pidfile.h>    /* for pidfile_remove */
+#include <openvas/base/nvticache.h>  /* for nvticache_new */
 
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
@@ -976,15 +977,13 @@
 
   if (stop_early == 0)
     {
-      // TODO: It is better to have cache_folder mandatory.
-      // Anything else will call for trouble (cache files
-      // mix up with source NVT files)
-      if (store_init
-          (arg_get_value (preferences, "cache_folder"),
-           arg_get_value (preferences, "plugins_folder")) != 0)
-        store_init (arg_get_value (preferences, "plugins_folder"),
-                    arg_get_value (preferences, "plugins_folder"));
+      nvticache_t * nvti_cache;
 
+      // @todo: Perhaps check wether "nvticache" is already present in arglist
+      nvti_cache = nvticache_new (arg_get_value (preferences, "cache_folder"),
+                                  arg_get_value (preferences, "plugins_folder"));
+      arg_add_value (preferences, "nvticache", ARG_PTR, -1, nvti_cache);
+
       plugins = plugins_init (preferences, be_quiet);
 
       if (first_pass != 0)

Modified: trunk/openvas-scanner/src/oval_plugins.c
===================================================================
--- trunk/openvas-scanner/src/oval_plugins.c	2012-07-11 21:44:37 UTC (rev 13723)
+++ trunk/openvas-scanner/src/oval_plugins.c	2012-07-11 22:19:00 UTC (rev 13724)
@@ -46,6 +46,7 @@
 #include <openvas/misc/internal_com.h>  /* for INTERNAL_COMM_MSG_TYPE_CTRL */
 
 #include <openvas/base/nvti.h>  /* for nvti_t */
+#include <openvas/base/nvticache.h>       /* for nvticache_add */
 #include <openvas/base/drop_privileges.h> /* for drop_privileges */
 #include <openvas/base/openvas_file.h>  /* for openvas_file_remove_recurse */
 
@@ -482,11 +483,8 @@
 
       nvti_set_sign_key_ids (first_plugin, sign_fprs);
 
-      args = emalloc (sizeof (struct arglist));
+      nvticache_add ((const nvticache_t *)arg_get_value (preferences, "nvticache"), first_plugin, name);
 
-      arg_add_value (args, "NVTI", ARG_PTR, -1, first_plugin);
-
-      store_plugin (args, name);
       args = store_load_plugin (name, preferences);
     }
 



More information about the Openvas-commits mailing list