[Openvas-commits] r5404 - in trunk/openvas-client: . openvas openvas/prefs_dialog
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Oct 6 13:57:01 CEST 2009
Author: mattm
Date: 2009-10-06 13:57:00 +0200 (Tue, 06 Oct 2009)
New Revision: 5404
Modified:
trunk/openvas-client/ChangeLog
trunk/openvas-client/openvas/context.c
trunk/openvas-client/openvas/prefs_dialog/prefs_scope_tree.c
Log:
* openvas/prefs_dialog/prefs_scope_tree.c (create_omp_scope): Symlink
NVT cache instead of copying it. Turn off saving of report NVT cache.
* openvas/context.c (context_new): Symlink NVT to parent cache instead of
saving cache to disk.
Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog 2009-10-06 11:55:47 UTC (rev 5403)
+++ trunk/openvas-client/ChangeLog 2009-10-06 11:57:00 UTC (rev 5404)
@@ -1,5 +1,13 @@
2009-10-06 Matthew Mundell <matthew.mundell at intevation.de>
+ * openvas/prefs_dialog/prefs_scope_tree.c (create_omp_scope): Symlink
+ NVT cache instead of copying it. Turn off saving of report NVT cache.
+
+ * openvas/context.c (context_new): Symlink NVT to parent cache instead of
+ saving cache to disk.
+
+2009-10-06 Matthew Mundell <matthew.mundell at intevation.de>
+
* openvas/prefs_dialog/prefs_scope_tree.c (scopetree_refresh): Remove
verbose flag setting. Correct indentation.
Modified: trunk/openvas-client/openvas/context.c
===================================================================
--- trunk/openvas-client/openvas/context.c 2009-10-06 11:55:47 UTC (rev 5403)
+++ trunk/openvas-client/openvas/context.c 2009-10-06 11:57:00 UTC (rev 5404)
@@ -856,7 +856,38 @@
if (copied_plugins)
if (prefs_get_int (Global, "cache_plugin_information") > 0)
{
- plugin_cache_write (context, context->plugins_md5sum);
+ int pwd;
+
+ /* Symbolic link the server NVT cache into the scope. */
+
+ pwd = open (".", O_RDONLY);
+ if (pwd == -1)
+ {
+ show_error_and_wait (_("%s: failed to open current directory"),
+ __FUNCTION__);
+ return NULL;
+ }
+
+ if (chdir (context->dir))
+ {
+ show_error_and_wait (_("%s: failed to chdir to %s"),
+ context->dir,
+ __FUNCTION__);
+ return NULL;
+ }
+
+ if (symlink ("../openvas_nvt_cache", "openvas_nvt_cache"))
+ {
+ show_error_and_wait (_("%s: failed to symlink to parent NVT cache"),
+ __FUNCTION__);
+ return NULL;
+ }
+
+ if (fchdir (pwd))
+ show_error_and_wait (_("%s: failed to fchdir back to previous dir"),
+ __FUNCTION__);
+
+ close (pwd);
}
#endif /* USE_OMP */
Modified: trunk/openvas-client/openvas/prefs_dialog/prefs_scope_tree.c
===================================================================
--- trunk/openvas-client/openvas/prefs_dialog/prefs_scope_tree.c 2009-10-06 11:55:47 UTC (rev 5403)
+++ trunk/openvas-client/openvas/prefs_dialog/prefs_scope_tree.c 2009-10-06 11:57:00 UTC (rev 5404)
@@ -950,6 +950,8 @@
assert (context->type == CONTEXT_SERVER);
+ g_free (servers_dir_name);
+
if (server_dir_name == NULL)
{
show_error (_("%s: server dir is NULL"), __FUNCTION__);
@@ -968,7 +970,6 @@
if (g_mkdir_with_parents (*scope_dir_name, 0700 /* d-w-rwxr-- */) == -1)
{
show_error (_("%s: g_mkdir_with_parents"), __FUNCTION__);
- g_free (servers_dir_name);
return -2;
}
@@ -979,7 +980,6 @@
{
show_error (_("%s: g_file_set_contents"), __FUNCTION__);
g_free (file_name);
- g_free (servers_dir_name);
return -3;
}
@@ -1006,7 +1006,6 @@
// FIX note error
g_error_free (error);
g_free (file_name);
- g_free (servers_dir_name);
return -4;
}
@@ -1036,52 +1035,49 @@
// FIX note error
g_error_free (error);
g_free (file_name);
- g_free (servers_dir_name);
return -5;
}
}
g_free (file_name);
- /* Copy server NVT cache into scope. */
-
{
- gchar *cache = NULL;
- gsize cache_size;
+ int pwd;
- file_name = g_build_filename (server_dir_name,
- "openvas_nvt_cache",
- NULL);
- ok = g_file_get_contents (file_name, &cache, &cache_size, NULL);
- if (ok)
+ /* Symbolic link the server NVT cache into the scope. */
+
+ pwd = open (".", O_RDONLY);
+ if (pwd == -1)
{
- g_free (servers_dir_name);
- g_free (file_name);
+ show_error_and_wait (_("%s: failed to open current directory"),
+ __FUNCTION__);
+ return NULL;
+ }
- file_name = g_build_filename (*scope_dir_name,
- "openvas_nvt_cache",
- NULL);
- ok = g_file_set_contents (file_name, cache, cache_size, NULL);
- g_free (file_name);
- g_free (cache);
-
- if (ok)
- return 0;
-
- show_error (_("%s: set contents"), __FUNCTION__);
- return -1;
+ if (chdir (*scope_dir_name))
+ {
+ show_error_and_wait (_("%s: failed to chdir to %s"),
+ context->dir,
+ __FUNCTION__);
+ return NULL;
}
- else
+
+ if (symlink ("../openvas_nvt_cache", "openvas_nvt_cache"))
{
- show_error (_("%s: get contents"), __FUNCTION__);
- g_free (servers_dir_name);
- g_free (file_name);
- return -1;
+ show_error_and_wait (_("%s: failed to symlink to parent NVT cache"),
+ __FUNCTION__);
+ return NULL;
}
+
+ if (fchdir (pwd))
+ show_error_and_wait (_("%s: failed to fchdir back to previous dir"),
+ __FUNCTION__);
+
+ close (pwd);
}
}
-
g_free (servers_dir_name);
+
show_error (_("%s: check_is_dir"), __FUNCTION__);
return -1;
}
@@ -1141,6 +1137,8 @@
g_free (file_name);
if (!ok) goto fail;
+ /* Turned off for now to reduce disk usage. */
+#if 0
file_name = g_build_filename (scope_dir_name, "openvas_nvt_cache", NULL);
ok = g_file_get_contents (file_name, &rcfile, &rcfile_len, NULL);
g_free (file_name);
@@ -1148,6 +1146,7 @@
file_name = g_build_filename (report_dir_name, "openvas_nvt_cache", NULL);
ok = g_file_set_contents (file_name, rcfile, strlen (rcfile), NULL);
g_free (file_name);
+#endif
if (ok)
{
More information about the Openvas-commits
mailing list