[Openvas-commits] r3445 - in trunk/openvas-client: . src/util

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 20 15:05:56 CEST 2009


Author: felix
Date: 2009-05-20 15:05:55 +0200 (Wed, 20 May 2009)
New Revision: 3445

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/src/util/openvas_lsc_target_prep.c
   trunk/openvas-client/src/util/openvas_lsc_user_makensis.c
   trunk/openvas-client/src/util/openvas_ssh_rpm.c
Log:
Removed code duplicates, changed working (temporary) directory for
package generators (rpm and makensis).

* src/util/openvas_ssh_rpm.c (create_tmp_dir),
src/util/openvas_lsc_user_makensis.c (create_tmp_dir): Removed, calls
replaced by calls top openvas_lsc_target_prep_create_tmp_dir.

* src/util/openvas_lsc_target_prep.c
(openvas_lsc_target_prep_create_tmp_dir): Changed location of temporary
directory from subdirectory of .openvas/.ssh to .openvas/lsc-mngt.


Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2009-05-20 13:03:27 UTC (rev 3444)
+++ trunk/openvas-client/ChangeLog	2009-05-20 13:05:55 UTC (rev 3445)
@@ -1,3 +1,16 @@
+2009-05-20  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
+	Removed code duplicates, changed working (temporary) directory for
+	package generators (rpm and makensis).
+	
+	* src/util/openvas_ssh_rpm.c (create_tmp_dir),
+	src/util/openvas_lsc_user_makensis.c (create_tmp_dir): Removed, calls
+	replaced by calls top openvas_lsc_target_prep_create_tmp_dir.
+	
+	* src/util/openvas_lsc_target_prep.c
+	(openvas_lsc_target_prep_create_tmp_dir): Changed location of temporary
+	directory from subdirectory of .openvas/.ssh to .openvas/lsc-mngt.
+
 2009-05-19  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
 	Added tooltips for all entries in the ssh_key_info_form, added todo.

Modified: trunk/openvas-client/src/util/openvas_lsc_target_prep.c
===================================================================
--- trunk/openvas-client/src/util/openvas_lsc_target_prep.c	2009-05-20 13:03:27 UTC (rev 3444)
+++ trunk/openvas-client/src/util/openvas_lsc_target_prep.c	2009-05-20 13:05:55 UTC (rev 3445)
@@ -56,7 +56,7 @@
  * @brief Creates a temporary directory as working directory for installer and
  * @brief package generators.
  * 
- * Default directory is .openvas/.ssh/.tmprpm .
+ * Default directory is .openvas/lsc-mngt/.tmp .
  * 
  * @return Path to the temporary directory if directory successfully created or
  * @return exists, NULL in case of error (and will show the error).
@@ -64,8 +64,8 @@
 gchar*
 openvas_lsc_target_prep_create_tmp_dir ()
 {
-  gchar* tmpdir = g_build_filename (prefs_get_nessushome(), ".openvas", ".ssh",
-                                    ".tmprpm", NULL);
+  gchar* tmpdir = g_build_filename (prefs_get_nessushome(), ".openvas", "lsc-mngt",
+                                    ".tmp", NULL);
   if (file_utils_ensure_dir(tmpdir) == FALSE)
     {
       show_error ("Could not create temporary dir %s.", tmpdir);

Modified: trunk/openvas-client/src/util/openvas_lsc_user_makensis.c
===================================================================
--- trunk/openvas-client/src/util/openvas_lsc_user_makensis.c	2009-05-20 13:03:27 UTC (rev 3444)
+++ trunk/openvas-client/src/util/openvas_lsc_user_makensis.c	2009-05-20 13:05:55 UTC (rev 3445)
@@ -68,33 +68,7 @@
 #include "openvas_lsc_target_prep.h"
 #include "openvas_lsc_user_makensis.h"
 
-
-/** @TODO code duplicate of openvas_ssh_rpm.c */
 /**
- * @brief Creates a temporary directory to place copy of key and as working
- * @brief directory for the RPM generator script.
- * 
- * Default directory is .openvas/.ssh/.tmprpm .
- * 
- * @return Path to the temporary directory if directory successfully created or
- * @return exists, NULL in case of error (and will show the error).
- */
-static gchar*
-create_tmp_dir ()
-{
-  gchar* tmpdir = g_build_filename (prefs_get_nessushome(), ".openvas", ".ssh",
-                                    ".tmprpm", NULL);
-  if (file_utils_ensure_dir(tmpdir) == FALSE)
-    {
-      show_error ("Could not create temporary dir %s.", tmpdir);
-      g_free (tmpdir);
-      tmpdir = NULL;
-    }
-  return tmpdir;
-}
-
-
-/**
  * @brief Writes a nsi file to be used with the 'Nullsoft scriptable installer
  * @brief system'.
  */
@@ -277,7 +251,7 @@
   gboolean success   = FALSE;
   int rmdir_response = TRUE;
 
-  gchar* tmpdir  = create_tmp_dir ();
+  gchar* tmpdir  = openvas_lsc_target_prep_create_tmp_dir ();
   gchar* nsifile = g_build_filename (tmpdir, "lsc_user_installer.nsi", NULL);
   success = create_nsi_file (nsifile, loginfo, to_filename);
   if (success)

Modified: trunk/openvas-client/src/util/openvas_ssh_rpm.c
===================================================================
--- trunk/openvas-client/src/util/openvas_ssh_rpm.c	2009-05-20 13:03:27 UTC (rev 3444)
+++ trunk/openvas-client/src/util/openvas_ssh_rpm.c	2009-05-20 13:05:55 UTC (rev 3445)
@@ -47,29 +47,6 @@
 
 
 /**
- * @brief Creates a temporary directory to place copy of key and as working
- * @brief directory for the RPM generator script.
- * 
- * Default directory is .openvas/.ssh/.tmprpm .
- * 
- * @return Path to the temporary directory if directory successfully created or
- * @return exists, NULL in case of error (and will show the error).
- */
-static gchar*
-create_tmp_dir ()
-{
-  gchar* tmpdir = g_build_filename (prefs_get_nessushome(), ".openvas", ".ssh",
-                                    ".tmprpm", NULL);
-  if (file_utils_ensure_dir(tmpdir) == FALSE)
-    {
-      show_error ("Could not create temporary dir %s.", tmpdir);
-      g_free (tmpdir);
-      tmpdir = NULL;
-    }
-  return tmpdir;
-}
-
-/**
  * @brief Returns the path to the directory where the rpm generator
  * @brief ("openvas-ssh-client-rpm-creator.sh") is located.
  * 
@@ -173,7 +150,7 @@
 
   // First, create a temporary directory
   printf ("--- RPM-builder: create temporary directory\n");
-  tmpdir = create_tmp_dir();
+  tmpdir = openvas_lsc_target_prep_create_tmp_dir();
   if (tmpdir == NULL)
     {
       return FALSE;



More information about the Openvas-commits mailing list