[Openvas-commits] r8899 - in trunk/openvas-manager: . doc report_formats/simple_bar_chart report_formats/simple_topo_plot report_formats/sourcefire src src/report_formats
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Aug 26 14:16:29 CEST 2010
Author: mattm
Date: 2010-08-26 14:16:22 +0200 (Thu, 26 Aug 2010)
New Revision: 8899
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/doc/report-format-HOWTO
trunk/openvas-manager/report_formats/simple_bar_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.c
trunk/openvas-manager/src/report_formats/create_signatures
Log:
* doc/report-format-HOWTO,
report_formats/simple_bar_chart/create_report_import,
report_formats/simple_topo_plot/create_report_import,
report_formats/sourcefire/create_report_import: Note file ordering
requirement.
* src/manage.c (get_report_format_files): Order files alphabetically.
* src/report_formats/create_signatures: Quote variable to preserve
newlines. Add trailing newline to content, as in Manager.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/ChangeLog 2010-08-26 12:16:22 UTC (rev 8899)
@@ -1,3 +1,16 @@
+2010-08-26 Matthew Mundell <matthew.mundell at greenbone.net>
+
+ * doc/report-format-HOWTO,
+ report_formats/simple_bar_chart/create_report_import,
+ report_formats/simple_topo_plot/create_report_import,
+ report_formats/sourcefire/create_report_import: Note file ordering
+ requirement.
+
+ * src/manage.c (get_report_format_files): Order files alphabetically.
+
+ * src/report_formats/create_signatures: Quote variable to preserve
+ newlines. Add trailing newline to content, as in Manager.
+
2010-08-25 Matthew Mundell <matthew.mundell at greenbone.net>
* src/manage_sql.c (init_manage): Add trust_time to SQL for last commit.
Modified: trunk/openvas-manager/doc/report-format-HOWTO
===================================================================
--- trunk/openvas-manager/doc/report-format-HOWTO 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/doc/report-format-HOWTO 2010-08-26 12:16:22 UTC (rev 8899)
@@ -40,7 +40,8 @@
this is a single XSLT file that is passed to xsltproc.
- Update the "create_report_import" script to include the files added to the
- directory in the last step.
+ directory in the last step. These must be in alphabetical order for the
+ signature to be reproducible.
- Test the generate script
Modified: trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/report_formats/simple_bar_chart/create_report_import 2010-08-26 12:16:22 UTC (rev 8899)
@@ -4,6 +4,7 @@
CONTENT_TYPE="image/png"
SUMMARY="Summary threat counts as bar chart PNG image."
DESCRIPTION="Simple example for a summary of threat counts as bar chart PNG image."
+# Names must be in alphabetical order.
FNAME1=generate
FILE1=`base64 -w 0 generate`
FNAME2=plot.plt
Modified: trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/report_formats/simple_topo_plot/create_report_import 2010-08-26 12:16:22 UTC (rev 8899)
@@ -4,6 +4,7 @@
CONTENT_TYPE="image/svg+xml"
SUMMARY="Network topology SVG image."
DESCRIPTION="Scan results in topologic structure as scalable vector graphics."
+# Names must be in alphabetical order.
FNAME1=generate
FILE1=`base64 -w 0 generate`
FNAME2=hostvisdot-summary.xsl
Modified: trunk/openvas-manager/report_formats/sourcefire/create_report_import
===================================================================
--- trunk/openvas-manager/report_formats/sourcefire/create_report_import 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/report_formats/sourcefire/create_report_import 2010-08-26 12:16:22 UTC (rev 8899)
@@ -4,6 +4,7 @@
CONTENT_TYPE="text/csv"
SUMMARY="Sourcefire Host Input Import."
DESCRIPTION="Scan results in Host Input Import format for Sourcefire DC."
+# Names must be in alphabetical order.
FNAME1=generate
FILE1=`base64 -w 0 generate`
FNAME2=sourcefire.xsl
Modified: trunk/openvas-manager/src/manage.c
===================================================================
--- trunk/openvas-manager/src/manage.c 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/src/manage.c 2010-08-26 12:16:22 UTC (rev 8899)
@@ -2272,14 +2272,14 @@
static int
get_report_format_files (const char *dir_name, GPtrArray **start)
{
- DIR *dir;
- struct dirent *entry;
GPtrArray *files;
+ struct dirent **names;
+ int n, index;
files = g_ptr_array_new ();
- dir = opendir (dir_name);
- if (dir == NULL)
+ n = scandir (dir_name, &names, NULL, alphasort);
+ if (n < 0)
{
g_warning ("%s: failed to open dir %s: %s\n",
__FUNCTION__,
@@ -2288,22 +2288,17 @@
return -1;
}
- while ((entry = readdir (dir)))
- if (strcmp (entry->d_name, ".") && strcmp (entry->d_name, ".."))
- g_ptr_array_add (files, g_strdup (entry->d_name));
-
- g_ptr_array_add (files, NULL);
-
- if (closedir (dir))
+ for (index = 0; index < n; index++)
{
- array_free (files);
- g_warning ("%s: failed to close dir %s: %s\n",
- __FUNCTION__,
- dir_name,
- strerror (errno));
- return -1;
+ if (strcmp (names[index]->d_name, ".")
+ && strcmp (names[index]->d_name, ".."))
+ g_ptr_array_add (files, g_strdup (names[index]->d_name));
+ free (names[index]);
}
+ free (names);
+ g_ptr_array_add (files, NULL);
+
*start = files;
return 0;
}
Modified: trunk/openvas-manager/src/report_formats/create_signatures
===================================================================
--- trunk/openvas-manager/src/report_formats/create_signatures 2010-08-26 09:48:49 UTC (rev 8898)
+++ trunk/openvas-manager/src/report_formats/create_signatures 2010-08-26 12:16:22 UTC (rev 8899)
@@ -37,7 +37,7 @@
rm -f ${name}/${uuid}.asc
rm -f ${uuid}
fore=`sqlite3 -separator '' -noheader -init "" $DB "SELECT uuid, name, extension, content_type, summary, description, '1' FROM report_formats WHERE uuid = '$uuid'" 2>/dev/null`
- echo -n $fore > ${uuid}
+ echo -n "$fore" > ${uuid}
for file in `sqlite3 -noheader -init "" $DB "SELECT name FROM report_formats WHERE uuid = '$uuid'" 2>/dev/null`/*; do
case $file in
*.BAK)
@@ -54,6 +54,7 @@
;;
esac
done
+ echo >> ${uuid}
gpg --detach-sign --armor ${uuid}
rm -f ${uuid}
mv ${uuid}.asc ${name}/${uuid}.asc
More information about the Openvas-commits
mailing list