[Openvas-commits] r12157 - in trunk/openvas-manager: . report_formats/simple_bar_chart report_formats/simple_map_plot report_formats/simple_pie_chart report_formats/simple_topo_plot report_formats/sourcefire src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 22 16:12:00 CET 2011


Author: mattm
Date: 2011-11-22 16:11:58 +0100 (Tue, 22 Nov 2011)
New Revision: 12157

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import
   trunk/openvas-manager/report_formats/simple_map_plot/create_report_import
   trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import
   trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import
   trunk/openvas-manager/report_formats/sourcefire/create_report_import
   trunk/openvas-manager/src/manage_sql.c
Log:
	* src/manage_sql.c (compare_files): New function.
	(create_report_format): Sort the files alphabetically, to match the order
	used in verify_report_format.

	* report_formats/simple_bar_chart/create_report_import,
	report_formats/simple_map_plot/create_report_import,
	report_formats/simple_pie_chart/create_report_import,
	report_formats/simple_topo_plot/create_report_import,
	report_formats/sourcefire/create_report_import: Remove editable values
	from content for signing, to match Manager.  Order files alphabetically.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/ChangeLog	2011-11-22 15:11:58 UTC (rev 12157)
@@ -1,3 +1,16 @@
+2011-11-22  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	* src/manage_sql.c (compare_files): New function.
+	(create_report_format): Sort the files alphabetically, to match the order
+	used in verify_report_format.
+
+	* report_formats/simple_bar_chart/create_report_import,
+	report_formats/simple_map_plot/create_report_import,
+	report_formats/simple_pie_chart/create_report_import,
+	report_formats/simple_topo_plot/create_report_import,
+	report_formats/sourcefire/create_report_import: Remove editable values
+	from content for signing, to match Manager.  Order files alphabetically.
+
 2011-11-21  Matthew Mundell <matthew.mundell at greenbone.net>
 
 	* src/manage_sql.c (create_report_format, verify_report_format): Remove

Modified: trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import	2011-11-22 15:11:58 UTC (rev 12157)
@@ -53,7 +53,7 @@
 #PARAM6_TYPE_MAX=9223372036854775806
 PARAM6_TYPE_MAX=50
 
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${FNAME3}${FILE3}${PARAM1_NAME}${PARAM1_VALUE}${PARAM1_TYPE}${PARAM1_TYPE_MIN}${PARAM1_TYPE_MAX}${PARAM1_VALUE}${PARAM2_NAME}${PARAM2_VALUE}${PARAM2_TYPE}${PARAM2_VALUE}${PARAM3_NAME}${PARAM3_VALUE}${PARAM3_TYPE}${PARAM3_DEFAULT}${PARAM3_OPTION1}${PARAM3_OPTION2}${PARAM3_OPTION3}${PARAM4_NAME}${PARAM4_VALUE}${PARAM4_TYPE}${PARAM4_TYPE_MIN}${PARAM4_TYPE_MAX}${PARAM4_VALUE}${PARAM5_NAME}${PARAM5_VALUE}${PARAM5_TYPE}${PARAM5_TYPE_MAX}${PARAM5_VALUE}${PARAM6_NAME}${PARAM6_VALUE}${PARAM6_TYPE}${PARAM6_TYPE_MIN}${PARAM6_TYPE_MAX}${PARAM6_VALUE} > ${UUID}
+echo ${UUID}${EXTENSION}${CONTENT_TYPE}0${FNAME1}${FILE1}${FNAME2}${FILE2}${FNAME3}${FILE3}${PARAM1_NAME}${PARAM1_TYPE}${PARAM1_TYPE_MIN}${PARAM1_TYPE_MAX}${PARAM1_VALUE}${PARAM2_NAME}${PARAM2_TYPE}${PARAM2_VALUE}${PARAM3_NAME}${PARAM3_TYPE}${PARAM3_DEFAULT}${PARAM3_OPTION1}${PARAM3_OPTION2}${PARAM3_OPTION3}${PARAM4_NAME}${PARAM4_TYPE}${PARAM4_TYPE_MIN}${PARAM4_TYPE_MAX}${PARAM4_VALUE}${PARAM5_NAME}${PARAM5_TYPE}${PARAM5_TYPE_MAX}${PARAM5_VALUE}${PARAM6_NAME}${PARAM6_TYPE}${PARAM6_TYPE_MIN}${PARAM6_TYPE_MAX}${PARAM6_VALUE} > ${UUID}
 gpg --detach-sign --armor ${UUID}
 rm ${UUID}
 

Modified: trunk/openvas-manager/report_formats/simple_map_plot/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_map_plot/create_report_import	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/report_formats/simple_map_plot/create_report_import	2011-11-22 15:11:58 UTC (rev 12157)
@@ -5,10 +5,10 @@
 SUMMARY="Geographic Map"
 DESCRIPTION="Targets located on a worldmap as static png image."
 # Names must be in alphabetical order.
-FNAME1=fonts.txt
-FILE1=`base64 -w 0 fonts.txt`
-FNAME2=FreeSans.ttf
-FILE2=`base64 -w 0 FreeSans.ttf`
+FNAME1=FreeSans.ttf
+FILE1=`base64 -w 0 FreeSans.ttf`
+FNAME2=fonts.txt
+FILE2=`base64 -w 0 fonts.txt`
 FNAME3=generate
 FILE3=`base64 -w 0 generate`
 FNAME4=hosts.vrt
@@ -17,18 +17,18 @@
 FILE5=`base64 -w 0 join.awk`
 FNAME6=locations.csv
 FILE6=`base64 -w 0 locations.csv`
-FNAME7=report_to_csv_host.xsl
-FILE7=`base64 -w 0 report_to_csv_host.xsl`
-FNAME8=world_map.map
-FILE8=`base64 -w 0 world_map.map`
-FNAME9=world_map.tiff
-FILE9=`base64 -w 0 world_map.tiff`
-FNAME10=non-georeferenced.map
-FILE10=`base64 -w 0 non-georeferenced.map`
-FNAME11=non-georeferenced.dot
-FILE11=`base64 -w 0 non-georeferenced.dot`
+FNAME7=non-georeferenced.dot
+FILE7=`base64 -w 0 non-georeferenced.dot`
+FNAME8=non-georeferenced.map
+FILE8=`base64 -w 0 non-georeferenced.map`
+FNAME9=report_to_csv_host.xsl
+FILE9=`base64 -w 0 report_to_csv_host.xsl`
+FNAME10=world_map.map
+FILE10=`base64 -w 0 world_map.map`
+FNAME11=world_map.tiff
+FILE11=`base64 -w 0 world_map.tiff`
 
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${FNAME3}${FILE3}${FNAME4}${FILE4}${FNAME5}${FILE5}${FNAME6}${FILE6}${FNAME7}${FILE7}${FNAME8}${FILE8}${FNAME9}${FILE9}${FNAME10}${FILE10}${FNAME11}${FILE11}> ${UUID}
+echo ${UUID}${EXTENSION}${CONTENT_TYPE}0${FNAME1}${FILE1}${FNAME2}${FILE2}${FNAME3}${FILE3}${FNAME4}${FILE4}${FNAME5}${FILE5}${FNAME6}${FILE6}${FNAME7}${FILE7}${FNAME8}${FILE8}${FNAME9}${FILE9}${FNAME10}${FILE10}${FNAME11}${FILE11}> ${UUID}
 gpg --detach-sign --armor ${UUID}
 rm ${UUID}
 

Modified: trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/report_formats/simple_pie_chart/create_report_import	2011-11-22 15:11:58 UTC (rev 12157)
@@ -20,7 +20,7 @@
 PARAM2_VALUE="400"
 PARAM2_TYPE=string
 
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_VALUE}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM2_NAME}${PARAM2_VALUE}${PARAM2_TYPE}${PARAM2_VALUE} > ${UUID}
+echo ${UUID}${EXTENSION}${CONTENT_TYPE}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM2_NAME}${PARAM2_TYPE}${PARAM2_VALUE} > ${UUID}
 gpg --detach-sign --armor ${UUID}
 rm ${UUID}
 

Modified: trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import	2011-11-22 15:11:58 UTC (rev 12157)
@@ -25,7 +25,7 @@
 PARAM2_TYPE_MIN=1
 PARAM2_TYPE_MAX=20
 
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_VALUE}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM1_OPTION1}${PARAM1_OPTION2}${PARAM1_OPTION3}${PARAM2_NAME}${PARAM2_VALUE}${PARAM2_TYPE}${PARAM2_TYPE_MIN}${PARAM2_TYPE_MAX}${PARAM2_VALUE} > ${UUID}
+echo ${UUID}${EXTENSION}${CONTENT_TYPE}0${FNAME1}${FILE1}${FNAME2}${FILE2}${PARAM1_NAME}${PARAM1_TYPE}${PARAM1_VALUE}${PARAM1_OPTION1}${PARAM1_OPTION2}${PARAM1_OPTION3}${PARAM2_NAME}${PARAM2_TYPE}${PARAM2_TYPE_MIN}${PARAM2_TYPE_MAX}${PARAM2_VALUE} > ${UUID}
 gpg --detach-sign --armor ${UUID}
 rm ${UUID}
 

Modified: trunk/openvas-manager/report_formats/sourcefire/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/sourcefire/create_report_import	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/report_formats/sourcefire/create_report_import	2011-11-22 15:11:58 UTC (rev 12157)
@@ -10,7 +10,7 @@
 FNAME2=sourcefire.xsl
 FILE2=`base64 -w 0 sourcefire.xsl`
 
-echo ${UUID}${NAME}${EXTENSION}${CONTENT_TYPE}${SUMMARY}${DESCRIPTION}0${FNAME1}${FILE1}${FNAME2}${FILE2}> ${UUID}
+echo ${UUID}${EXTENSION}${CONTENT_TYPE}0${FNAME1}${FILE1}${FNAME2}${FILE2}> ${UUID}
 gpg --detach-sign --armor ${UUID}
 rm ${UUID}
 

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2011-11-22 12:51:05 UTC (rev 12156)
+++ trunk/openvas-manager/src/manage_sql.c	2011-11-22 15:11:58 UTC (rev 12157)
@@ -42,6 +42,7 @@
 #include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
+#include <locale.h>
 #include <pwd.h>
 #include <sqlite3.h>
 #include <stdlib.h>
@@ -30149,6 +30150,29 @@
 }
 
 /**
+ * @brief Compare files for create_report_format.
+ *
+ * @param[in]  one  First.
+ * @param[in]  two  Second.
+ */
+static gint
+compare_files (gconstpointer one, gconstpointer two)
+{
+  gchar *file_one, *file_two;
+  file_one = *((gchar**) one);
+  file_two = *((gchar**) two);
+  if (file_one == NULL)
+    {
+      if (file_two == NULL)
+        return 0;
+      return 1;
+    }
+  else if (file_two == NULL)
+    return -1;
+  return strcoll (file_one, file_two);
+}
+
+/**
  * @brief Create a report format.
  *
  * @param[in]   uuid           UUID of format.
@@ -30196,6 +30220,7 @@
                           &format_signature_size)
           == 0))
     {
+      char *locale;
       GString *format;
 
       format = g_string_new ("");
@@ -30208,6 +30233,9 @@
                               global & 1);
 
       index = 0;
+      locale = setlocale (LC_ALL, "C");
+      g_ptr_array_sort (files, compare_files);
+      setlocale (LC_ALL, locale);
       while ((file_name = (gchar*) g_ptr_array_index (files, index++)))
         g_string_append_printf (format,
                                 "%s%s",



More information about the Openvas-commits mailing list