From 3bb4b0bd7333e7cf387534d3596a44fc2c8342b6 Mon Sep 17 00:00:00 2001 From: Miloslav Trmac Date: Mar 31 2010 15:21:42 +0000 Subject: - Fix chart display if any of the labels contain '/' - Include 'date' among field names for making reports --- diff --git a/audit-viewer-0.6.2-chart-labels.patch b/audit-viewer-0.6.2-chart-labels.patch new file mode 100644 index 0000000..d9f07bd --- /dev/null +++ b/audit-viewer-0.6.2-chart-labels.patch @@ -0,0 +1,60 @@ +Quote escape sequences in pychart labels (e.g. '/') + +2010-03-31 Miloslav Trmač + + * src/report_tab.py (ReportTab.__repaint_chart): Quote all strings + to protect against pychart escape sequences. + +diff -r 467bd1382d59 -r 22497aedc623 src/report_tab.py +--- a/src/report_tab.py Wed Mar 31 14:22:34 2010 +0200 ++++ b/src/report_tab.py Wed Mar 31 14:42:17 2010 +0200 +@@ -30,6 +30,7 @@ + import pychart.canvas + import pychart.category_coord + import pychart.fill_style ++import pychart.font + import pychart.legend + import pychart.theme + import rsvg +@@ -339,12 +340,12 @@ + return # Nothing to do + + if self.column_statistic is None: +- data = [(row_range.get_label(), self.counts[row_range]) +- for row_range in self.row_ranges] ++ data = [(pychart.font.quotemeta(row_range.get_label()), ++ self.counts[row_range]) for row_range in self.row_ranges] + else: + data = [] + for row_range in self.row_ranges: +- row = ([row_range.get_label()] + ++ row = ([pychart.font.quotemeta(row_range.get_label())] + + [self.counts.get((row_range, column_range)) + for column_range in self.column_ranges]) + data.append(row) +@@ -375,10 +376,9 @@ + legend = None + else: + legend = pychart.legend.T() ++ x_axis_label = pychart.font.quotemeta(self.row_statistic.field_name) + area = pychart.area.T(size = (width, height), +- x_axis = pychart.axis.X(label = +- self.row_statistic. +- field_name), ++ x_axis = pychart.axis.X(label = x_axis_label), + y_axis = pychart.axis.Y(format = '%d', label=''), + legend = legend, + x_coord = pychart.category_coord.T(data, 0), +@@ -393,9 +393,11 @@ + else: + fill_it = pychart.fill_style.color_standards.iterate() + for (col, column_range) in enumerate(self.column_ranges): ++ column_plot_label = pychart.font.quotemeta(column_range. ++ get_label()) + plot = pychart.bar_plot.T(data = data, hcol = col + 1, + fill_style = fill_it.next(), +- label = column_range.get_label(), ++ label = column_plot_label, + cluster = + (col, len(self.column_ranges))) + area.add_plot(plot) diff --git a/audit-viewer-0.6.2-date-field.patch b/audit-viewer-0.6.2-date-field.patch new file mode 100644 index 0000000..23d387e --- /dev/null +++ b/audit-viewer-0.6.2-date-field.patch @@ -0,0 +1,54 @@ +Offer the 'date' field for report statistics. + +2010-03-31 Miloslav Trmač + + * src/report_properties.py (ReportProperties.__init__): Include the + synthetic 'date' field when offering fields for statistics. + * src/tab_properties.py (TabProperties._init_field_combo): New parameter + add_date. + +diff -r 09812a1ae574 -r 467bd1382d59 src/report_properties.py +--- a/src/report_properties.py Fri Mar 26 15:42:48 2010 +0100 ++++ b/src/report_properties.py Wed Mar 31 14:22:34 2010 +0200 +@@ -44,7 +44,7 @@ + super(ReportProperties, self).__gobject_init__() + + self.__old_row_field = None +- self._init_field_combo(self.report_row_field) ++ self._init_field_combo(self.report_row_field, add_date=True) + # String first is assumed by util.set_combo_option + self.row_grouping_store = gtk.ListStore(gobject.TYPE_STRING, + gobject.TYPE_PYOBJECT) +@@ -59,7 +59,7 @@ + util.connect_and_run(self.report_use_column, 'toggled', + self.__report_use_column_toggled) + self.__old_column_field = None +- self._init_field_combo(self.report_column_field) ++ self._init_field_combo(self.report_column_field, add_date=True) + self.column_grouping_store = gtk.ListStore(gobject.TYPE_STRING, + gobject.TYPE_PYOBJECT) + util.connect_and_run(self.report_column_field, 'changed', +diff -r 09812a1ae574 -r 467bd1382d59 src/tab_properties.py +--- a/src/tab_properties.py Fri Mar 26 15:42:48 2010 +0100 ++++ b/src/tab_properties.py Wed Mar 31 14:22:34 2010 +0200 +@@ -406,10 +406,17 @@ + return None + + @staticmethod +- def _init_field_combo(combo): +- '''Initialize a GtkComboBoxEntry with known field names.''' ++ def _init_field_combo(combo, add_date=False): ++ '''Initialize a GtkComboBoxEntry with known field names. ++ ++ Add 'date' if add_date. ++ ++ ''' + store = gtk.ListStore(gobject.TYPE_STRING) +- for field in lists.field_names: ++ fields = lists.field_names ++ if add_date: ++ fields = fields + ('date',) ++ for field in sorted(fields): + store.append((field,)) + combo.set_model(store) + combo.set_text_column(0) diff --git a/audit-viewer.spec b/audit-viewer.spec index 7b6613b..40ef52e 100644 --- a/audit-viewer.spec +++ b/audit-viewer.spec @@ -1,11 +1,15 @@ Summary: Audit event viewer Name: audit-viewer Version: 0.6.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: Applications/System URL: https://fedorahosted.org/audit-viewer/ Source0: https://fedorahosted.org/releases/a/u/audit-viewer/audit-viewer-%{version}.tar.xz +# Upstream changeset 467bd1382d592b29c6e2d20afd91c64ea2a3c81a +Patch0: audit-viewer-0.6.2-date-field.patch +# Upstream changeset 22497aedc623722e09af8687b600d83b5c990a4d +Patch1: audit-viewer-0.6.2-chart-labels.patch BuildRequires: desktop-file-utils, gettext, intltool, python Requires: audit-libs-python, gnome-python2-gnome, gnome-python2-rsvg Requires: pygtk2-libglade, pychart, python-gtkextra, python-sexy, usermode @@ -16,6 +20,8 @@ A graphical utility for viewing and summarizing audit events. %prep %setup -q +%patch0 -p1 -b .date-field +%patch1 -p1 -b .chart-labels %build %configure --disable-update-mimedb @@ -55,6 +61,10 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{_sysconfdir}/security/console.apps/audit-viewer-server %changelog +* Wed Mar 31 2010 Miloslav Trmač - 0.6.2-2 +- Fix chart display if any of the labels contain '/' +- Include 'date' among field names for making reports + * Fri Mar 26 2010 Miloslav Trmač - 0.6.2-1 - Update to audit-viewer-0.6.2