libreport package update

Signed-off-by: basebuilder_pel7ppc64lebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64lebuilder0 2019-09-10 03:10:14 +02:00
parent e7cc73d84f
commit 834dff42ec
160 changed files with 462365 additions and 0 deletions

View File

@ -0,0 +1,29 @@
From 0f2014b68ea19dd7a239c4c9b7a7774b03f2cca2 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Jan 2014 09:38:30 +0100
Subject: [LIBREPORT PATCH 1/6] wizard: do not use deprecated gtk3 API

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index c37f69f..3faa8e8 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -2597,7 +2597,11 @@ static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback f
gtk_label_set_use_markup(GTK_LABEL(label), true);
gtk_widget_set_halign(label, GTK_ALIGN_START);
gtk_widget_set_margin_top(label, 10);
+#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 11) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 11 && GTK_MICRO_VERSION < 2))
gtk_widget_set_margin_left(label, 40);
+#else
+ gtk_widget_set_margin_start(label, 40);
+#endif
gtk_widget_set_margin_bottom(label, 10);
free(btn_label);
g_signal_connect(button, "clicked", func, w);
--
1.8.3.1

View File

@ -0,0 +1,53 @@
From 9f62c707df03b371890ad139f0633c8457b146f6 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Jan 2014 17:09:00 +0100
Subject: [LIBREPORT PATCH 2/6] replace all Fedora URLs by corresponding values
for RHEL

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/report_EmergencyAnalysis.xml.in | 2 +-
src/plugins/report_uReport.xml.in | 2 +-
src/plugins/ureport.conf | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/plugins/report_EmergencyAnalysis.xml.in b/src/plugins/report_EmergencyAnalysis.xml.in
index 3fb2bd2..c00a734 100644
--- a/src/plugins/report_EmergencyAnalysis.xml.in
+++ b/src/plugins/report_EmergencyAnalysis.xml.in
@@ -15,7 +15,7 @@
<option type="text" name="Upload_URL">
<_label>URL</_label>
<allow-empty>no</allow-empty>
- <default-value>https://retrace.fedoraproject.org/faf/dumpdirs/new/</default-value>
+ <default-value>https://localhost/faf/dumpdirs/new/</default-value>
</option>
<advanced-options>
<option type="text" name="http_proxy">
diff --git a/src/plugins/report_uReport.xml.in b/src/plugins/report_uReport.xml.in
index 3a38971..c8bb858 100644
--- a/src/plugins/report_uReport.xml.in
+++ b/src/plugins/report_uReport.xml.in
@@ -11,7 +11,7 @@
<_label>uReport Server URL</_label>
<allow-empty>no</allow-empty>
<_description>Address of uReport webservice</_description>
- <default-value>https://retrace.fedoraproject.org/faf</default-value>
+ <default-value>http://bug-report.itos.redhat.com</default-value>
</option>
<option type="bool" name="uReport_SSLVerify">
<_label>Verify SSL</_label>
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index a75ad19..1f3b33a 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -1,5 +1,5 @@
# Base URL to uReport server
-URL = https://retrace.fedoraproject.org/faf
+URL = http://bug-report.itos.redhat.com
# no means that ssl certificates will not be checked
# SSLVerify = no
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From 5dcccd8af2cf36257d43450f1459175a7b579526 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Jan 2014 17:11:20 +0100
Subject: [LIBREPORT PATCH 3/6] don't offer uploading on failure in report-gtk

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 3faa8e8..e962c11 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1719,14 +1719,7 @@ _("Processing of the problem failed. This can have many reasons but there are tw
"\t▫ <b>network connection problems</b>\n"\
"\t▫ <b>corrupted problem data</b>\n"));
- add_warning(
-_("If you want to help us, please click on the upload button and provide all problem data for a deep analysis.\n"\
-"<i>Before you do that, please consider the security risks. Problem data may contain sensitive information like passwords.\n"\
-"The uploaded data are stored in a protected storage and only a limited number of persons can read them.</i>"));
-
show_warnings();
-
- gtk_widget_show(g_btn_onfail);
}
static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, gpointer data)
--
1.8.3.1

View File

@ -0,0 +1,189 @@
From fc7ce16996d750b05ffa13cec1ff0708a8972e0a Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 9 Jan 2014 13:59:51 +0100
Subject: [LIBREPORT PATCH 4/6] add a workflow for libreport type problems

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
po/POTFILES.in | 3 +++
src/lib/report_event.conf | 4 ++--
src/workflows/Makefile.am | 13 +++++++++----
src/workflows/report_fedora.conf | 4 ++++
src/workflows/report_rhel.conf | 4 ++++
src/workflows/report_rhel_bugzilla.conf | 4 ++++
src/workflows/workflow_FedoraLibreport.xml.in | 9 +++++++++
src/workflows/workflow_RHELBugzillaLibreport.xml.in | 9 +++++++++
src/workflows/workflow_RHELLibreport.xml.in | 9 +++++++++
9 files changed, 53 insertions(+), 6 deletions(-)
create mode 100644 src/workflows/workflow_FedoraLibreport.xml.in
create mode 100644 src/workflows/workflow_RHELBugzillaLibreport.xml.in
create mode 100644 src/workflows/workflow_RHELLibreport.xml.in

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 35e209d..426cfcf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -53,14 +53,17 @@ src/workflows/workflow_FedoraKerneloops.xml.in
src/workflows/workflow_FedoraPython.xml.in
src/workflows/workflow_FedoraVmcore.xml.in
src/workflows/workflow_FedoraXorg.xml.in
+src/workflows/workflow_FedoraLibreport.xml.in
src/workflows/workflow_Upload.xml.in
src/workflows/workflow_RHELCCpp.xml.in
src/workflows/workflow_RHELKerneloops.xml.in
src/workflows/workflow_RHELPython.xml.in
src/workflows/workflow_RHELvmcore.xml.in
src/workflows/workflow_RHELxorg.xml.in
+src/workflows/workflow_RHELLibreport.xml.in
src/workflows/workflow_RHELBugzillaCCpp.xml.in
src/workflows/workflow_RHELBugzillaKerneloops.xml.in
src/workflows/workflow_RHELBugzillaPython.xml.in
src/workflows/workflow_RHELBugzillaVmcore.xml.in
src/workflows/workflow_RHELBugzillaXorg.xml.in
+src/workflows/workflow_RHELBugzillaLibreport.xml.in
diff --git a/src/lib/report_event.conf b/src/lib/report_event.conf
index bcf523d..7b2e4f4 100644
--- a/src/lib/report_event.conf
+++ b/src/lib/report_event.conf
@@ -49,7 +49,7 @@ include workflows.d/*.conf
#EVENT=report_Dummy analyzer=libreport echo "Hello world" >> /tmp/libreport.log
EVENT=report-gui analyzer=libreport
- report-gtk -e report_Bugzilla -- "$DUMP_DIR"
+ report-gtk -- "$DUMP_DIR"
EVENT=report-cli analyzer=libreport
- report-cli -e report_Bugzilla -- "$DUMP_DIR"
+ report-cli -- "$DUMP_DIR"
diff --git a/src/workflows/Makefile.am b/src/workflows/Makefile.am
index 5b3cfb8..54a504e 100644
--- a/src/workflows/Makefile.am
+++ b/src/workflows/Makefile.am
@@ -11,7 +11,8 @@ dist_workflows_DATA = \
workflow_RHELKerneloops.xml \
workflow_RHELPython.xml \
workflow_RHELvmcore.xml \
- workflow_RHELxorg.xml
+ workflow_RHELxorg.xml \
+ workflow_RHELLibreport.xml
if BUILD_BUGZILLA
dist_workflows_DATA += \
@@ -23,7 +24,8 @@ dist_workflows_DATA += \
workflow_RHELBugzillaKerneloops.xml \
workflow_RHELBugzillaPython.xml \
workflow_RHELBugzillaVmcore.xml \
- workflow_RHELBugzillaXorg.xml
+ workflow_RHELBugzillaXorg.xml \
+ workflow_RHELBugzillaLibreport.xml
endif
workflowsdefdir = $(WORKFLOWS_DEFINITION_DIR)
@@ -46,12 +48,14 @@ EXTRA_DIST = \
workflow_FedoraPython.xml.in \
workflow_FedoraVmcore.xml.in \
workflow_FedoraXorg.xml.in \
+ workflow_FedoraLibreport.xml.in \
workflow_Upload.xml.in \
workflow_RHELCCpp.xml.in \
workflow_RHELKerneloops.xml.in \
workflow_RHELPython.xml.in \
workflow_RHELvmcore.xml.in \
- workflow_RHELxorg.xml.in
+ workflow_RHELxorg.xml.in \
+ workflow_RHELLibreport.xml.in
if BUILD_BUGZILLA
EXTRA_DIST += \
@@ -63,5 +67,6 @@ EXTRA_DIST += \
workflow_RHELBugzillaKerneloops.xml.in \
workflow_RHELBugzillaPython.xml.in \
workflow_RHELBugzillaVmcore.xml.in \
- workflow_RHELBugzillaXorg.xml.in
+ workflow_RHELBugzillaXorg.xml.in \
+ workflow_RHELBugzillaLibreport.xml.in
endif
diff --git a/src/workflows/report_fedora.conf b/src/workflows/report_fedora.conf
index 84009bf..e935b16 100644
--- a/src/workflows/report_fedora.conf
+++ b/src/workflows/report_fedora.conf
@@ -1,3 +1,7 @@
+EVENT=workflow_FedoraLibreport analyzer=libreport
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
+
EVENT=workflow_FedoraCCpp analyzer=CCpp
# this is just a meta event which consists of other events
# the list is defined in the xml file
diff --git a/src/workflows/report_rhel.conf b/src/workflows/report_rhel.conf
index 104bcc3..870db3f 100644
--- a/src/workflows/report_rhel.conf
+++ b/src/workflows/report_rhel.conf
@@ -1,3 +1,7 @@
+EVENT=workflow_RHELLibreport analyzer=libreport
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
+
EVENT=workflow_RHELCCpp analyzer=CCpp
# this is just a meta event which consists of other events
# the list is defined in the xml file
diff --git a/src/workflows/report_rhel_bugzilla.conf b/src/workflows/report_rhel_bugzilla.conf
index 3281cb8..b986959 100644
--- a/src/workflows/report_rhel_bugzilla.conf
+++ b/src/workflows/report_rhel_bugzilla.conf
@@ -1,3 +1,7 @@
+EVENT=workflow_RHELBugzillaLibreport analyzer=libreport
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
+
EVENT=workflow_RHELBugzillaCCpp analyzer=CCpp
# this is just a meta event which consists of other events
# the list is defined in the xml file
diff --git a/src/workflows/workflow_FedoraLibreport.xml.in b/src/workflows/workflow_FedoraLibreport.xml.in
new file mode 100644
index 0000000..16e08cc
--- /dev/null
+++ b/src/workflows/workflow_FedoraLibreport.xml.in
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<workflow>
+ <_name>Report to Fedora</_name>
+ <_description>Process the problem using the Fedora infrastructure</_description>
+
+ <events>
+ <event>report_Bugzilla</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_RHELBugzillaLibreport.xml.in b/src/workflows/workflow_RHELBugzillaLibreport.xml.in
new file mode 100644
index 0000000..b9c5cb3
--- /dev/null
+++ b/src/workflows/workflow_RHELBugzillaLibreport.xml.in
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<workflow>
+ <_name>Report to Red Hat Bugzilla</_name>
+ <_description>Process the problem using the Red Hat infrastructure</_description>
+
+ <events>
+ <event>report_Bugzilla</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_RHELLibreport.xml.in b/src/workflows/workflow_RHELLibreport.xml.in
new file mode 100644
index 0000000..b8b4f04
--- /dev/null
+++ b/src/workflows/workflow_RHELLibreport.xml.in
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<workflow>
+ <_name>Report to Red Hat Customer Portal</_name>
+ <_description>Process the problem using the Red Hat infrastructure</_description>
+
+ <events>
+ <event>report_RHTSupport</event>
+ </events>
+</workflow>
--
1.8.3.1

View File

@ -0,0 +1,26 @@
From 90583212efbb3655c021be1c8be29c00c20603fc Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 9 Jan 2014 15:53:11 +0100
Subject: [LIBREPORT PATCH 6/6] make: add libreport workflow fedora to dist
files

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/workflows/Makefile.am | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/workflows/Makefile.am b/src/workflows/Makefile.am
index 54a504e..4a8fb82 100644
--- a/src/workflows/Makefile.am
+++ b/src/workflows/Makefile.am
@@ -6,6 +6,7 @@ dist_workflows_DATA = \
workflow_FedoraPython.xml \
workflow_FedoraVmcore.xml \
workflow_FedoraXorg.xml \
+ workflow_FedoraLibreport.xml \
workflow_Upload.xml \
workflow_RHELCCpp.xml \
workflow_RHELKerneloops.xml \
--
1.8.3.1

View File

@ -0,0 +1,219 @@
From 3aa2a3446370dfade43f7b0e66769676edb3ef11 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 16 Jan 2014 16:03:19 +0100
Subject: [LIBREPORT PATCH 07/11] define DBus config interfaces for all plugins

Closes #228
Related to abrt/abrt#751
Related to rhbz#1055610

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
configure.ac | 10 ++++++++++
doc/Makefile.am | 2 ++
doc/plugins-dbus/Makefile.am | 13 +++++++++++++
.../com.redhat.problems.configuration.bugzilla.xml.in | 17 +++++++++++++++++
.../com.redhat.problems.configuration.mailx.xml.in | 14 ++++++++++++++
.../com.redhat.problems.configuration.rhtsupport.xml.in | 16 ++++++++++++++++
.../com.redhat.problems.configuration.ureport.xml.in | 13 +++++++++++++
src/plugins/Makefile.am | 12 ++++++++----
8 files changed, 93 insertions(+), 4 deletions(-)
create mode 100644 doc/plugins-dbus/Makefile.am
create mode 100644 doc/plugins-dbus/com.redhat.problems.configuration.bugzilla.xml.in
create mode 100644 doc/plugins-dbus/com.redhat.problems.configuration.mailx.xml.in
create mode 100644 doc/plugins-dbus/com.redhat.problems.configuration.rhtsupport.xml.in
create mode 100644 doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in

diff --git a/configure.ac b/configure.ac
index c372c7f..1c9c7ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,6 +211,7 @@ CONF_DIR='${sysconfdir}/${PACKAGE_NAME}'
VAR_RUN='${localstatedir}/run'
PLUGINS_CONF_DIR='${sysconfdir}/${PACKAGE_NAME}/plugins'
REPORT_PLUGINS_CONF_DIR='${sysconfdir}/libreport/plugins'
+DEFAULT_REPORT_PLUGINS_CONF_DIR='${datadir}/${PACKAGE_NAME}/conf.d/plugins'
EVENTS_DIR='${pkgdatadir}/events'
EVENTS_DEFINITION_DIR='${sysconfdir}/${PACKAGE_NAME}/events.d'
EVENTS_CONF_DIR='${sysconfdir}/${PACKAGE_NAME}/events'
@@ -258,6 +259,13 @@ AC_ARG_ENABLE([userownsdumpdir],
[Configure abrt to be owner of dump directories (default: user owns dump dir)])],
[DUMP_DIR_OWNED_BY_USER=0])
+
+AC_ARG_WITH([dbusinterfacedir],
+ AS_HELP_STRING([--with-dbusinterfacedir=DIR], [Directory for dbus interface files]),
+ [], [with_dbusinterfacedir=${datadir}/dbus-1/interfaces])
+AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
+
+
AC_ARG_ENABLE(doxygen-docs,
AS_HELP_STRING([--enable-doxygen-docs],
[build DOXYGEN documentation (requires Doxygen)]),
@@ -292,6 +300,7 @@ AC_SUBST(CONF_DIR)
AC_SUBST(VAR_RUN)
AC_SUBST(PLUGINS_CONF_DIR)
AC_SUBST(REPORT_PLUGINS_CONF_DIR)
+AC_SUBST(DEFAULT_REPORT_PLUGINS_CONF_DIR)
AC_SUBST(EVENTS_DEFINITION_DIR)
AC_SUBST(EVENTS_CONF_DIR)
AC_SUBST(EVENTS_DIR)
@@ -331,6 +340,7 @@ AC_CONFIG_FILES([
src/client-python/Makefile
po/Makefile.in
doc/Makefile
+ doc/plugins-dbus/Makefile
src/workflows/Makefile
])
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 96964f0..7eb3065 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = plugins-dbus
+
# silent rules for ASCIIDOC and XMLTO
ASCIIDOC_SILENT = $(ASCIIDOC_SILENT_$(V))
ASCIIDOC_SILENT_ = $(ASCIIDOC_SILENT_$(AM_DEFAULT_VERBOSITY))
diff --git a/doc/plugins-dbus/Makefile.am b/doc/plugins-dbus/Makefile.am
new file mode 100644
index 0000000..5624e81
--- /dev/null
+++ b/doc/plugins-dbus/Makefile.am
@@ -0,0 +1,13 @@
+INTERFACES_DIST_FILES=$(wildcard *.xml.in)
+
+%.xml: %.xml.in
+ cp $< $@
+
+dbusplugininterfacesdir = ${dbusinterfacedir}
+dist_dbusplugininterfaces_DATA = \
+ com.redhat.problems.configuration.bugzilla.xml \
+ com.redhat.problems.configuration.mailx.xml \
+ com.redhat.problems.configuration.rhtsupport.xml \
+ com.redhat.problems.configuration.ureport.xml
+
+EXTRA_DIST = ${INTERFACES_DIST_FILES}
diff --git a/doc/plugins-dbus/com.redhat.problems.configuration.bugzilla.xml.in b/doc/plugins-dbus/com.redhat.problems.configuration.bugzilla.xml.in
new file mode 100644
index 0000000..e9302b7
--- /dev/null
+++ b/doc/plugins-dbus/com.redhat.problems.configuration.bugzilla.xml.in
@@ -0,0 +1,17 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<node name="/com/redhat/problems/configuration/bugzilla">
+ <annotation name="com.redhat.problems.ConfFile" value="/etc/libreport/plugins/bugzilla.conf" />
+ <annotation name="com.redhat.problems.DefaultConfFile" value="/usr/share/libreport/conf.d/plugins/bugzilla.conf" />
+
+ <interface name="com.redhat.problems.configuration.bugzilla">
+ <property name="BugzillaURL" type="s" access="readwrite" />
+ <property name="Login" type="s" access="readwrite" />
+ <property name="Password" type="s" access="readwrite" />
+ <property name="SSLVerify" type="b" access="readwrite" />
+ <property name="DontMatchComponents" type="as" access="readwrite" />
+ <property name="CreatePrivate" type="b" access="readwrite" />
+ <property name="PrivateGroup" type="as" access="readwrite" />
+ </interface>
+</node>
diff --git a/doc/plugins-dbus/com.redhat.problems.configuration.mailx.xml.in b/doc/plugins-dbus/com.redhat.problems.configuration.mailx.xml.in
new file mode 100644
index 0000000..80fd95f
--- /dev/null
+++ b/doc/plugins-dbus/com.redhat.problems.configuration.mailx.xml.in
@@ -0,0 +1,14 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<node name="/com/redhat/problems/configuration/mailx">
+ <annotation name="com.redhat.problems.ConfFile" value="/etc/libreport/plugins/mailx.conf" />
+ <annotation name="com.redhat.problems.DefaultConfFile" value="/usr/share/libreport/conf.d/plugins/mailx.conf" />
+
+ <interface name="com.redhat.problems.configuration.mailx">
+ <property name="Subject" type="s" access="readwrite" />
+ <property name="EmailFrom" type="s" access="readwrite" />
+ <property name="EmailTo" type="s" access="readwrite" />
+ <property name="SendBinaryData" type="b" access="readwrite" />
+ </interface>
+</node>
diff --git a/doc/plugins-dbus/com.redhat.problems.configuration.rhtsupport.xml.in b/doc/plugins-dbus/com.redhat.problems.configuration.rhtsupport.xml.in
new file mode 100644
index 0000000..58d8084
--- /dev/null
+++ b/doc/plugins-dbus/com.redhat.problems.configuration.rhtsupport.xml.in
@@ -0,0 +1,16 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<node name="/com/redhat/problems/configuration/rhtsupport">
+ <annotation name="com.redhat.problems.ConfFile" value="/etc/libreport/plugins/rhtsupport.conf" />
+ <annotation name="com.redhat.problems.DefaultConfFile" value="/usr/share/libreport/conf.d/plugins/rhtsupport.conf" />
+
+ <interface name="com.redhat.problems.configuration.rhtsupport">
+ <property name="URL" type="s" access="readwrite" />
+ <property name="Login" type="s" access="readwrite" />
+ <property name="Password" type="s" access="readwrite" />
+ <property name="BigFileURL" type="s" access="readwrite" />
+ <property name="BigSizeMB" type="i" access="readwrite" />
+ <property name="SSLVerify" type="b" access="readwrite" />
+ </interface>
+</node>
diff --git a/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in b/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in
new file mode 100644
index 0000000..58498c7
--- /dev/null
+++ b/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in
@@ -0,0 +1,13 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<node name="/com/redhat/problems/configuration/ureport">
+ <annotation name="com.redhat.problems.ConfFile" value="/etc/libreport/plugins/ureport.conf" />
+ <annotation name="com.redhat.problems.DefaultConfFile" value="/usr/share/libreport/conf.d/plugins/ureport.conf" />
+
+ <interface name="com.redhat.problems.configuration.ureport">
+ <property name="URL" type="s" access="readwrite" />
+ <property name="SSLVerify" type="b" access="readwrite" />
+ <!-- <property name="ContactEmail" type="s" access="readwrite" /> -->
+ </interface>
+</node>
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 21d237e..7ec5219 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -23,22 +23,26 @@ pluginsconfdir = $(PLUGINS_CONF_DIR)
reportpluginsconfdir = $(REPORT_PLUGINS_CONF_DIR)
reporters_plugin_conf =
+reporters_plugin_format_conf =
if BUILD_BUGZILLA
-reporters_plugin_conf += bugzilla.conf \
- bugzilla_format.conf \
+reporters_plugin_conf += bugzilla.conf
+reporters_plugin_format_conf += bugzilla_format.conf \
bugzilla_formatdup.conf \
bugzilla_format_libreport.conf \
bugzilla_format_kernel.conf \
bugzilla_format_anaconda.conf \
bugzilla_formatdup_anaconda.conf
-
endif
-dist_reportpluginsconf_DATA = $(reporters_plugin_conf) \
+defaultreportpluginsconfdir = $(DEFAULT_REPORT_PLUGINS_CONF_DIR)
+dist_defaultreportpluginsconf_DATA = $(reporters_plugin_conf) \
rhtsupport.conf \
mailx.conf \
ureport.conf
+dist_reportpluginsconf_DATA = $(reporters_plugin_format_conf) \
+ $(dist_defaultreportpluginsconf_DATA)
+
eventsdir = $(EVENTS_DIR)
eventsconfdir = $(EVENTS_CONF_DIR)
--
1.8.3.1

View File

@ -0,0 +1,193 @@
From 5fbeff7b002d0ac0b0fedfd380e3c72ac09be66e Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 17 Jan 2014 12:00:56 +0100
Subject: [LIBREPORT PATCH 09/11] add Java reporting workflows

Related to rhbz#1054713

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
po/POTFILES.in | 3 +++
src/workflows/Makefile.am | 14 ++++++++++----
src/workflows/report_fedora.conf | 4 ++++
src/workflows/report_rhel.conf | 4 ++++
src/workflows/report_rhel_bugzilla.conf | 4 ++++
src/workflows/workflow_FedoraJava.xml.in | 12 ++++++++++++
src/workflows/workflow_RHELBugzillaJava.xml.in | 12 ++++++++++++
src/workflows/workflow_RHELJava.xml.in | 10 ++++++++++
8 files changed, 59 insertions(+), 4 deletions(-)
create mode 100644 src/workflows/workflow_FedoraJava.xml.in
create mode 100644 src/workflows/workflow_RHELBugzillaJava.xml.in
create mode 100644 src/workflows/workflow_RHELJava.xml.in

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 426cfcf..26acba1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -54,6 +54,7 @@ src/workflows/workflow_FedoraPython.xml.in
src/workflows/workflow_FedoraVmcore.xml.in
src/workflows/workflow_FedoraXorg.xml.in
src/workflows/workflow_FedoraLibreport.xml.in
+src/workflows/workflow_FedoraJava.xml.in
src/workflows/workflow_Upload.xml.in
src/workflows/workflow_RHELCCpp.xml.in
src/workflows/workflow_RHELKerneloops.xml.in
@@ -61,9 +62,11 @@ src/workflows/workflow_RHELPython.xml.in
src/workflows/workflow_RHELvmcore.xml.in
src/workflows/workflow_RHELxorg.xml.in
src/workflows/workflow_RHELLibreport.xml.in
+src/workflows/workflow_RHELJava.xml.in
src/workflows/workflow_RHELBugzillaCCpp.xml.in
src/workflows/workflow_RHELBugzillaKerneloops.xml.in
src/workflows/workflow_RHELBugzillaPython.xml.in
src/workflows/workflow_RHELBugzillaVmcore.xml.in
src/workflows/workflow_RHELBugzillaXorg.xml.in
src/workflows/workflow_RHELBugzillaLibreport.xml.in
+src/workflows/workflow_RHELBugzillaJava.xml.in
diff --git a/src/workflows/Makefile.am b/src/workflows/Makefile.am
index 4a8fb82..54a6f31 100644
--- a/src/workflows/Makefile.am
+++ b/src/workflows/Makefile.am
@@ -7,13 +7,15 @@ dist_workflows_DATA = \
workflow_FedoraVmcore.xml \
workflow_FedoraXorg.xml \
workflow_FedoraLibreport.xml \
+ workflow_FedoraJava.xml \
workflow_Upload.xml \
workflow_RHELCCpp.xml \
workflow_RHELKerneloops.xml \
workflow_RHELPython.xml \
workflow_RHELvmcore.xml \
workflow_RHELxorg.xml \
- workflow_RHELLibreport.xml
+ workflow_RHELLibreport.xml \
+ workflow_RHELJava.xml
if BUILD_BUGZILLA
dist_workflows_DATA += \
@@ -26,7 +28,8 @@ dist_workflows_DATA += \
workflow_RHELBugzillaPython.xml \
workflow_RHELBugzillaVmcore.xml \
workflow_RHELBugzillaXorg.xml \
- workflow_RHELBugzillaLibreport.xml
+ workflow_RHELBugzillaLibreport.xml \
+ workflow_RHELBugzillaJava.xml
endif
workflowsdefdir = $(WORKFLOWS_DEFINITION_DIR)
@@ -50,13 +53,15 @@ EXTRA_DIST = \
workflow_FedoraVmcore.xml.in \
workflow_FedoraXorg.xml.in \
workflow_FedoraLibreport.xml.in \
+ workflow_FedoraJava.xml.in \
workflow_Upload.xml.in \
workflow_RHELCCpp.xml.in \
workflow_RHELKerneloops.xml.in \
workflow_RHELPython.xml.in \
workflow_RHELvmcore.xml.in \
workflow_RHELxorg.xml.in \
- workflow_RHELLibreport.xml.in
+ workflow_RHELLibreport.xml.in \
+ workflow_RHELJava.xml.in
if BUILD_BUGZILLA
EXTRA_DIST += \
@@ -69,5 +74,6 @@ EXTRA_DIST += \
workflow_RHELBugzillaPython.xml.in \
workflow_RHELBugzillaVmcore.xml.in \
workflow_RHELBugzillaXorg.xml.in \
- workflow_RHELBugzillaLibreport.xml.in
+ workflow_RHELBugzillaLibreport.xml.in \
+ workflow_RHELBugzillaJava.xml.in
endif
diff --git a/src/workflows/report_fedora.conf b/src/workflows/report_fedora.conf
index e935b16..8494661 100644
--- a/src/workflows/report_fedora.conf
+++ b/src/workflows/report_fedora.conf
@@ -21,3 +21,7 @@ EVENT=workflow_FedoraVmcore analyzer=vmcore
EVENT=workflow_FedoraXorg analyzer=xorg
# this is just a meta event which consists of other events
# the list is defined in the xml file
+
+EVENT=workflow_FedoraJava analyzer=Java
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
diff --git a/src/workflows/report_rhel.conf b/src/workflows/report_rhel.conf
index 870db3f..38ee231 100644
--- a/src/workflows/report_rhel.conf
+++ b/src/workflows/report_rhel.conf
@@ -21,3 +21,7 @@ EVENT=workflow_RHELvmcore analyzer=vmcore
EVENT=workflow_RHELxorg analyzer=xorg
# this is just a meta event which consists of other events
# the list is defined in the xml file
+
+EVENT=workflow_RHELJava analyzer=Java
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
diff --git a/src/workflows/report_rhel_bugzilla.conf b/src/workflows/report_rhel_bugzilla.conf
index b986959..08f307b 100644
--- a/src/workflows/report_rhel_bugzilla.conf
+++ b/src/workflows/report_rhel_bugzilla.conf
@@ -21,3 +21,7 @@ EVENT=workflow_RHELBugzillaVmcore analyzer=vmcore
EVENT=workflow_RHELBugzillaXorg analyzer=xorg
# this is just a meta event which consists of other events
# the list is defined in the xml file
+
+EVENT=workflow_RHELBugzillaJava analyzer=Java
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
diff --git a/src/workflows/workflow_FedoraJava.xml.in b/src/workflows/workflow_FedoraJava.xml.in
new file mode 100644
index 0000000..650197e
--- /dev/null
+++ b/src/workflows/workflow_FedoraJava.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<workflow>
+ <_name>Report to Fedora</_name>
+ <_description>Process the Java exception using the Fedora infrastructure</_description>
+
+ <events>
+ <event>report_uReport</event>
+ <event>collect_*</event>
+ <event>report_Bugzilla</event>
+ <event>post-report</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_RHELBugzillaJava.xml.in b/src/workflows/workflow_RHELBugzillaJava.xml.in
new file mode 100644
index 0000000..3ef7619
--- /dev/null
+++ b/src/workflows/workflow_RHELBugzillaJava.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<workflow>
+ <_name>Report to Red Hat Bugzilla</_name>
+ <_description>Process the Java exception using the Red Hat infrastructure</_description>
+
+ <events>
+ <event>report_uReport</event>
+ <event>collect_*</event>
+ <event>report_Bugzilla</event>
+ <event>post-report</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_RHELJava.xml.in b/src/workflows/workflow_RHELJava.xml.in
new file mode 100644
index 0000000..23ef0cb
--- /dev/null
+++ b/src/workflows/workflow_RHELJava.xml.in
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<workflow>
+ <_name>Report to Red Hat Customer Portal</_name>
+ <_description>Process the Java exception using the Red Hat infrastructure</_description>
+
+ <events>
+ <event>collect_*</event>
+ <event>report_RHTSupport</event>
+ </events>
+</workflow>
--
1.8.3.1

View File

@ -0,0 +1,68 @@
From 6eb3c81faf1809f54334fc69d9916bd7949c1e93 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 21 Jan 2014 17:25:58 +0100
Subject: [LIBREPORT PATCH 11/11] Remove Workflows tab in Preferences

Closes rhbz#1055633

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gtk-helpers/config_dialog.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/gtk-helpers/config_dialog.c b/src/gtk-helpers/config_dialog.c
index cc98b9b..8276130 100644
--- a/src/gtk-helpers/config_dialog.c
+++ b/src/gtk-helpers/config_dialog.c
@@ -206,7 +206,8 @@ GtkWidget *create_config_tab_content(const char *column_label,
gtk_tree_view_append_column(GTK_TREE_VIEW(tv), column);
/* "Please draw rows in alternating colors": */
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tv), TRUE);
- // TODO: gtk_tree_view_set_headers_visible(FALSE)? We have only one column anyway...
+ /* Hide Column Headers because we have only one - 'Events' - rhbz#1055633 */
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE);
GtkTreeModel *model = gtk_tree_model_filter_new(GTK_TREE_MODEL(store), NULL);
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model), config_filter_func, NULL, NULL);
@@ -287,6 +288,9 @@ GtkWindow *create_config_list_window(GHashTable *configs, GtkWindow *parent)
GtkWidget *main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
GtkWidget *config_nb = gtk_notebook_new();
+ /* Hide Tabs because we have only one - 'Events' - rhbz#1055633 */
+ gtk_notebook_set_show_tabs(GTK_NOTEBOOK(config_nb), FALSE);
+
gtk_box_pack_start(GTK_BOX(main_vbox), config_nb, 1, 1, 0);
/* we can't use this, because we want the workflows first and hashtable
@@ -295,12 +299,12 @@ GtkWindow *create_config_list_window(GHashTable *configs, GtkWindow *parent)
//g_hash_table_foreach(configs, (GHFunc)add_config_tabs, config_nb);
gpointer config = g_hash_table_lookup(configs, _("Workflows"));
- if (config != NULL);
- add_config_tabs(_("Workflows"), config, config_nb);
+ if (config != NULL)
+ add_config_tabs(_("Workflows"), config, config_nb);
config = g_hash_table_lookup(configs, _("Events"));
- if (config != NULL);
- add_config_tabs(_("Events"), config, config_nb);
+ if (config != NULL)
+ add_config_tabs(_("Events"), config, config_nb);
//buttons
GtkWidget *btn_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
@@ -344,11 +348,6 @@ void show_config_list_dialog(GtkWindow *parent)
GHashTable *events = load_event_config_data();
load_event_config_data_from_user_storage(events);
- GHashTable *workflows = load_workflow_config_data(WORKFLOWS_DIR);
- load_workflow_config_data_from_user_storage(workflows);
- GtkListStore *workflows_store = add_workflows_to_liststore(workflows);
- g_hash_table_insert(confs, _("Workflows"), workflows_store);
-
GtkListStore *events_store = add_events_to_liststore(events);
g_hash_table_insert(confs, _("Events"), events_store);
--
1.8.3.1

View File

@ -0,0 +1,380 @@
From c0e4f8f27f0becd93c7abd9f20224232d5f1a5cf Mon Sep 17 00:00:00 2001
From: Martin Milata <mmilata@redhat.com>
Date: Thu, 16 Jan 2014 20:02:05 +0100
Subject: [LIBREPORT PATCH 12/14] ureport: add support for client-side
authentication

Please note that the libreport_curl api is changed and since we're not
bumping sonames ABRT has to explicitly depend on this version in spec.

Related to rhbz#1053042.

Signed-off-by: Martin Milata <mmilata@redhat.com>
---
doc/reporter-ureport.txt | 18 ++++++++++
src/include/libreport_curl.h | 2 ++
src/lib/curl.c | 7 ++++
src/lib/json.c | 48 ++++++++++++-------------
src/lib/ureport.h | 7 ++--
src/plugins/ureport.c | 85 ++++++++++++++++++++++++++++++++++++++++++--
src/plugins/ureport.conf | 10 ++++++
7 files changed, 149 insertions(+), 28 deletions(-)

diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index b739b6d..54823ae 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -27,6 +27,20 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
'SSLVerify'::
Use no/false/off/0 to disable verification of server's SSL certificate. (default: yes)
+'SSLClientAuth'::
+ If this option is set, client-side SSL certificate is used to authenticate
+ to the server so that it knows which machine it came from. Possible values
+ are:
+
+ 'rhsm';;
+ Uses the system certificate that is used for Red Hat subscription management.
+
+ 'puppet';;
+ Uses the certificate that is used by the Puppet configuration management tool.
+
+ '<cert_path>:<key_path>';;
+ Manually supply paths to certificate and the corresponding key in PEM format.
+
'ContactEmail'::
Email address attached to a bthash on the server.
@@ -61,6 +75,10 @@ OPTIONS
-k, --insecure::
Allow insecure connection to ureport server
+-t, --auth SOURCE::
+ Enables client authentication. See 'SSLClientAuth' configuration file
+ option for list of possible values.
+
-v::
Be more verbose. Can be given multiple times.
diff --git a/src/include/libreport_curl.h b/src/include/libreport_curl.h
index 4cd855f..7d6fa02 100644
--- a/src/include/libreport_curl.h
+++ b/src/include/libreport_curl.h
@@ -35,6 +35,8 @@ typedef struct post_state {
int flags;
const char *username;
const char *password;
+ const char *client_cert_path;
+ const char *client_key_path;
/* Results of POST transaction: */
int http_resp_code;
/* cast from CURLcode enum.
diff --git a/src/lib/curl.c b/src/lib/curl.c
index 6722b4a..662a2cf 100644
--- a/src/lib/curl.c
+++ b/src/lib/curl.c
@@ -532,6 +532,13 @@ post(post_state_t *state,
xcurl_easy_setopt_long(handle, CURLOPT_SSL_VERIFYPEER, 0);
xcurl_easy_setopt_long(handle, CURLOPT_SSL_VERIFYHOST, 0);
}
+ if (state->client_cert_path && state->client_key_path)
+ {
+ xcurl_easy_setopt_ptr(handle, CURLOPT_SSLCERTTYPE, "PEM");
+ xcurl_easy_setopt_ptr(handle, CURLOPT_SSLKEYTYPE, "PEM");
+ xcurl_easy_setopt_ptr(handle, CURLOPT_SSLCERT, state->client_cert_path);
+ xcurl_easy_setopt_ptr(handle, CURLOPT_SSLKEY, state->client_key_path);
+ }
// This is the place where everything happens.
// Here errors are not limited to "out of memory", can't just die.
diff --git a/src/lib/json.c b/src/lib/json.c
index eb8e5ed..66db537 100644
--- a/src/lib/json.c
+++ b/src/lib/json.c
@@ -68,7 +68,7 @@ char *new_json_attachment(const char *bthash, const char *type, const char *data
return result;
}
-struct post_state *post_ureport(const char *json_ureport, struct ureport_server_config *config)
+struct post_state *post_ureport(const char *json, struct ureport_server_config *config)
{
int flags = POST_WANT_BODY | POST_WANT_ERROR_MSG;
@@ -77,6 +77,12 @@ struct post_state *post_ureport(const char *json_ureport, struct ureport_server_
struct post_state *post_state = new_post_state(flags);
+ if (config->ur_client_cert && config->ur_client_key)
+ {
+ post_state->client_cert_path = config->ur_client_cert;
+ post_state->client_key_path = config->ur_client_key;
+ }
+
static const char *headers[] = {
"Accept: application/json",
"Connection: close",
@@ -84,30 +90,24 @@ struct post_state *post_ureport(const char *json_ureport, struct ureport_server_
};
post_string_as_form_data(post_state, config->ur_url, "application/json",
- headers, json_ureport);
+ headers, json);
- return post_state;
-}
+ /* Client authentication failed. Try again without client auth.
+ * CURLE_SSL_CONNECT_ERROR - cert not found/server doesnt trust the CA
+ * CURLE_SSL_CERTPROBLEM - malformed certificate/no permission
+ */
+ if ((post_state->curl_result == CURLE_SSL_CONNECT_ERROR
+ || post_state->curl_result == CURLE_SSL_CERTPROBLEM)
+ && config->ur_client_cert && config->ur_client_key)
+ {
+ warn_msg("Authentication failed. Retrying unauthenticated.");
+ free_post_state(post_state);
+ post_state = new_post_state(flags);
-static
-struct post_state *ureport_attach(const char *json_attachment,
- struct ureport_server_config *config)
-{
- int flags = POST_WANT_BODY | POST_WANT_ERROR_MSG;
+ post_string_as_form_data(post_state, config->ur_url, "application/json",
+ headers, json);
- if (config->ur_ssl_verify)
- flags |= POST_WANT_SSL_VERIFY;
-
- struct post_state *post_state = new_post_state(flags);
-
- static const char *headers[] = {
- "Accept: application/json",
- "Connection: close",
- NULL,
- };
-
- post_string_as_form_data(post_state, config->ur_url, "application/json",
- headers, json_attachment);
+ }
return post_state;
}
@@ -117,7 +117,7 @@ struct post_state *ureport_attach_rhbz(const char *bthash, int rhbz_bug_id,
{
char *str_bug_id = xasprintf("%d", rhbz_bug_id);
char *json_attachment = new_json_attachment(bthash, "RHBZ", str_bug_id);
- struct post_state *post_state = ureport_attach(json_attachment, config);
+ struct post_state *post_state = post_ureport(json_attachment, config);
free(str_bug_id);
free(json_attachment);
@@ -128,7 +128,7 @@ struct post_state *ureport_attach_email(const char *bthash, const char *email,
struct ureport_server_config *config)
{
char *json_attachment = new_json_attachment(bthash, "email", email);
- struct post_state *post_state = ureport_attach(json_attachment, config);
+ struct post_state *post_state = post_ureport(json_attachment, config);
free(json_attachment);
return post_state;
diff --git a/src/lib/ureport.h b/src/lib/ureport.h
index 4cc4e10..16f40f1 100644
--- a/src/lib/ureport.h
+++ b/src/lib/ureport.h
@@ -30,8 +30,11 @@ extern "C" {
*/
struct ureport_server_config
{
- const char *ur_url; ///< Web service URL
- bool ur_ssl_verify; ///< Verify HOST and PEER certificates
+ const char *ur_url; ///< Web service URL
+ bool ur_ssl_verify; ///< Verify HOST and PEER certificates
+ char *ur_client_cert; ///< Path to certificate used for client
+ ///< authentication (or NULL)
+ char *ur_client_key; ///< Private key for the certificate
};
struct abrt_post_state;
diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index 0168744..b57eada 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -28,10 +28,73 @@
#define ATTACH_URL_SFX "reports/attach/"
#define BTHASH_URL_SFX "reports/bthash/"
+#define RHSM_CERT_PATH "/etc/pki/consumer/cert.pem"
+#define RHSM_KEY_PATH "/etc/pki/consumer/key.pem"
+
#define VALUE_FROM_CONF(opt, var, tr) do { const char *value = getenv("uReport_"opt); \
if (!value) { value = get_map_string_item_or_NULL(settings, opt); } if (value) { var = tr(value); } \
} while(0)
+static char *puppet_config_print(const char *key)
+{
+ char *command = xasprintf("puppet config print %s", key);
+ char *result = run_in_shell_and_save_output(0, command, NULL, NULL);
+ free(command);
+
+ /* run_in_shell_and_save_output always returns non-NULL */
+ if (result[0] != '/')
+ goto error;
+
+ char *newline = strchrnul(result, '\n');
+ if (!newline)
+ goto error;
+
+ *newline = '\0';
+ return result;
+error:
+ free(result);
+ error_msg_and_die("Unable to determine puppet %s path (puppet not installed?)", key);
+}
+
+static void parse_client_auth_paths(struct ureport_server_config *config, const char *client_auth)
+{
+ if (client_auth == NULL)
+ return;
+
+ if (strcmp(client_auth, "") == 0)
+ {
+ config->ur_client_cert = NULL;
+ config->ur_client_key = NULL;
+ log_notice("Not using client authentication");
+ }
+ else if (strcmp(client_auth, "rhsm") == 0)
+ {
+ config->ur_client_cert = xstrdup(RHSM_CERT_PATH);
+ config->ur_client_key = xstrdup(RHSM_KEY_PATH);
+ }
+ else if (strcmp(client_auth, "puppet") == 0)
+ {
+ config->ur_client_cert = puppet_config_print("hostcert");
+ config->ur_client_key = puppet_config_print("hostprivkey");
+ }
+ else
+ {
+ char *scratch = xstrdup(client_auth);
+ config->ur_client_cert = xstrdup(strtok(scratch, ":"));
+ config->ur_client_key = xstrdup(strtok(NULL, ":"));
+ free(scratch);
+
+ if (config->ur_client_cert == NULL || config->ur_client_key == NULL)
+ error_msg_and_die("Invalid client authentication specification");
+ }
+
+ if (config->ur_client_cert && config->ur_client_key)
+ {
+ log_notice("Using client certificate: %s", config->ur_client_cert);
+ log_notice("Using client private key: %s", config->ur_client_key);
+ }
+}
+
/*
* Loads uReport configuration from various sources.
*
@@ -44,6 +107,10 @@ static void load_ureport_server_config(struct ureport_server_config *config, map
{
VALUE_FROM_CONF("URL", config->ur_url, (const char *));
VALUE_FROM_CONF("SSLVerify", config->ur_ssl_verify, string_to_bool);
+
+ const char *client_auth = NULL;
+ VALUE_FROM_CONF("SSLClientAuth", client_auth, (const char *));
+ parse_client_auth_paths(config, client_auth);
}
struct ureport_server_response {
@@ -243,7 +310,12 @@ static struct ureport_server_response *ureport_server_parse_json(json_object *js
static struct ureport_server_response *get_server_response(post_state_t *post_state, struct ureport_server_config *config)
{
- if (post_state->errmsg[0] != '\0')
+ /* Previously, the condition here was (post_state->errmsg[0] != '\0')
+ * however when the server asks for optional client authentication and we do not have the certificates,
+ * then post_state->errmsg contains "NSS: client certificate not found (nickname not specified)" even though
+ * the request succeeded.
+ */
+ if (post_state->curl_result != CURLE_OK)
{
error_msg(_("Failed to upload uReport to the server '%s' with curl: %s"), config->ur_url, post_state->errmsg);
return NULL;
@@ -349,6 +421,8 @@ int main(int argc, char **argv)
struct ureport_server_config config = {
.ur_url = NULL,
.ur_ssl_verify = true,
+ .ur_client_cert = NULL,
+ .ur_client_key = NULL,
};
enum {
@@ -356,12 +430,14 @@ int main(int argc, char **argv)
OPT_d = 1 << 1,
OPT_u = 1 << 2,
OPT_k = 1 << 3,
+ OPT_t = 1 << 4,
};
int ret = 1; /* "failure" (for now) */
bool insecure = !config.ur_ssl_verify;
const char *conf_file = CONF_FILE_PATH;
const char *arg_server_url = NULL;
+ const char *client_auth = NULL;
const char *dump_dir_path = ".";
const char *ureport_hash = NULL;
bool ureport_hash_from_rt = false;
@@ -376,6 +452,7 @@ int main(int argc, char **argv)
OPT_STRING('u', "url", &arg_server_url, "URL", _("Specify server URL")),
OPT_BOOL('k', "insecure", &insecure,
_("Allow insecure connection to ureport server")),
+ OPT_STRING('t', "auth", &client_auth, "SOURCE", _("Use client authentication")),
OPT_STRING('c', NULL, &conf_file, "FILE", _("Configuration file")),
OPT_STRING('a', "attach", &ureport_hash, "BTHASH",
_("bthash of uReport to attach (conflicts with -A)")),
@@ -393,7 +470,7 @@ int main(int argc, char **argv)
};
const char *program_usage_string = _(
- "& [-v] [-c FILE] [-u URL] [-k] [-A -a bthash -B -b bug-id -E -e email] [-d DIR]\n"
+ "& [-v] [-c FILE] [-u URL] [-k] [-t SOURCE] [-A -a bthash -B -b bug-id -E -e email] [-d DIR]\n"
"\n"
"Upload micro report or add an attachment to a micro report\n"
"\n"
@@ -411,6 +488,8 @@ int main(int argc, char **argv)
config.ur_url = arg_server_url;
if (opts & OPT_k)
config.ur_ssl_verify = !insecure;
+ if (opts & OPT_t)
+ parse_client_auth_paths(&config, client_auth);
if (!config.ur_url)
error_msg_and_die("You need to specify server URL");
@@ -580,6 +659,8 @@ format_err:
finalize:
free_map_string(settings);
+ free(config.ur_client_cert);
+ free(config.ur_client_key);
return ret;
}
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index 1f3b33a..13b6386 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -6,3 +6,13 @@ URL = http://bug-report.itos.redhat.com
# Contact email attached to an uploaded uReport if required
# ContactEmail = foo@example.com
+
+# Client-side authentication
+# None (default):
+# SSLClientAuth =
+# Using RH subscription management certificate:
+# SSLClientAuth = rhsm
+# Using Puppet certificate:
+# SSLClientAuth = puppet
+# Using custom certificate:
+# SSLClientAuth = /path/to/cert.pem:/path/to/key.pem
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From b40bce3a493e9fa305d4aee38a2d176c39a26543 Mon Sep 17 00:00:00 2001
From: Martin Milata <mmilata@redhat.com>
Date: Mon, 20 Jan 2014 16:37:15 +0100
Subject: [LIBREPORT PATCH 13/14] add SSLClientAuth to ureport dbus config
interface

Related to rhbz#1053042.

Signed-off-by: Martin Milata <mmilata@redhat.com>
---
doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in | 1 +
1 file changed, 1 insertion(+)

diff --git a/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in b/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in
index 58498c7..28c5fea 100644
--- a/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in
+++ b/doc/plugins-dbus/com.redhat.problems.configuration.ureport.xml.in
@@ -8,6 +8,7 @@
<interface name="com.redhat.problems.configuration.ureport">
<property name="URL" type="s" access="readwrite" />
<property name="SSLVerify" type="b" access="readwrite" />
+ <property name="SSLClientAuth" type="s" access="readwrite" />
<!-- <property name="ContactEmail" type="s" access="readwrite" /> -->
</interface>
</node>
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From e7aabc7d2db6b3178286f4226bd179316488a8d2 Mon Sep 17 00:00:00 2001
From: Martin Milata <mmilata@redhat.com>
Date: Wed, 22 Jan 2014 15:30:50 +0100
Subject: [LIBREPORT PATCH 14/14] ureport.conf: turn on SSL auth with RHSM cert

Related to rhbz#1053042

Signed-off-by: Martin Milata <mmilata@redhat.com>
---
src/plugins/ureport.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index 13b6386..407fbca 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -11,7 +11,7 @@ URL = http://bug-report.itos.redhat.com
# None (default):
# SSLClientAuth =
# Using RH subscription management certificate:
-# SSLClientAuth = rhsm
+SSLClientAuth = rhsm
# Using Puppet certificate:
# SSLClientAuth = puppet
# Using custom certificate:
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From 09421cc80d7e783c8194043ac61f76285e3e6bd9 Mon Sep 17 00:00:00 2001
From: Martin Milata <mmilata@redhat.com>
Date: Mon, 20 Jan 2014 14:43:51 +0100
Subject: [LIBREPORT PATCH 15/15] Export plugin config dir in pkg-config

Related to rhbz#1053042.

Signed-off-by: Martin Milata <mmilata@redhat.com>
---
libreport.pc.in | 2 ++
1 file changed, 2 insertions(+)

diff --git a/libreport.pc.in b/libreport.pc.in
index 277b46a..70cef9f 100755
--- a/libreport.pc.in
+++ b/libreport.pc.in
@@ -2,7 +2,9 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
+sysconfdir=@sysconfdir@
dd_mode=@DEFAULT_DUMP_DIR_MODE@
+plugins_conf_dir=@REPORT_PLUGINS_CONF_DIR@
Name: libreport
Description: Generic library for reporting various problems
--
1.8.3.1

View File

@ -0,0 +1,69 @@
From 2886582f6e48258d7b8c941725a4456ed62578e9 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 28 Jan 2014 16:58:04 +0100
Subject: [LIBREPORT PATCH 16/17] report-cli: use the Client API for
communication to user

Closes rhbz#1058845

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/cli/cli-report.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
index 5b32fbc..68baa8b 100644
--- a/src/cli/cli-report.c
+++ b/src/cli/cli-report.c
@@ -408,26 +408,6 @@ static int run_report_editor(problem_data_t *problem_data)
}
/**
- * Asks user for a text response.
- * @param question
- * Question displayed to user.
- * @param result
- * Output array.
- * @param result_size
- * Maximum byte count to be written.
- */
-static void read_from_stdin(const char *question, char *result, int result_size)
-{
- assert(result_size > 1);
- printf("%s", question);
- fflush(NULL);
- if (NULL == fgets(result, result_size, stdin))
- result[0] = '\0';
- // Remove the trailing newline
- strchrnul(result, '\n')[0] = '\0';
-}
-
-/**
* Asks user for missing information
*/
static void ask_for_missing_settings(const char *event_name)
@@ -731,17 +711,15 @@ static int choose_number_from_range(unsigned min, unsigned max, const char *mess
unsigned ii;
for (ii = 0; ii < 3; ++ii)
{
- char answer[16];
-
- read_from_stdin(message, answer, sizeof(answer));
- if (!*answer)
- continue;
+ char *answer = ask(message);
picked = xatou(answer);
if (min <= picked && picked <= max)
return picked;
- printf("%s (%u - %u)\n", _("You have chosen number out of range"), min, max);
+ char *msg = xasprintf("%s (%u - %u)\n", _("You have chosen number out of range"), min, max);
+ alert(msg);
+ free(msg);
}
error_msg_and_die(_("Invalid input, exiting."));
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From 3578adb47a0de78dc5698c256a8d103857d22c33 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Wed, 27 Nov 2013 13:14:24 +0100
Subject: [LIBREPORT PATCH 17/17] workflow_RHELvmcore: run analyze_VMcore too

analyze_VMcore does the following:

* extracts oops from vmcore-dmesg.txt
(or from vmcore, if vmcore-dmesg.txt is missing);
creates "kernel" element.
* generates dedup hashes.
* generates pkg_* elements.

These steps probably aren't necessary if we take the usual step
of running report_RHTSupport: RHTSupport people don't absolutely
need that data. (However, I did not test whether report_RHTSupport
actually works w/o analyze_VMcore).

But for Machine Check Exceptions, oops extraction is crucial:
without seeing "backtrace" element, which in this case shows
MCE message, user won't realize he has a hardware issue,
and will still contact RHTSupport, only to be told by them,
after analysis, "look at your CPU/RAM, they seem to be faulty"
- exactly the scenario we want to avoid (we want user
to not waste his and RHTSupport's time - the problem is known).

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>

Resolves rhbz#1059651

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/workflows/workflow_RHELvmcore.xml.in | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/workflows/workflow_RHELvmcore.xml.in b/src/workflows/workflow_RHELvmcore.xml.in
index 20b6989..f2a775d 100644
--- a/src/workflows/workflow_RHELvmcore.xml.in
+++ b/src/workflows/workflow_RHELvmcore.xml.in
@@ -5,6 +5,7 @@
<events>
<event>collect_*</event>
+ <event>analyze_VMcore</event>
<event>report_RHTSupport</event>
</events>
</workflow>
--
1.8.3.1

View File

@ -0,0 +1,70 @@
From 70a804d6988a99ff85e4ca6e33ccc3de362cb74d Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 6 Feb 2014 10:38:51 +0100
Subject: [LIBREPORT PATCH 19/24] event configuration: load default values from
configuration directory

Load event configuration files from EVENT_CONF_DIR, where the files are
actually placed, instead of EVENT_DIR, which contains on XML event
definition files.

Closes rhbz#1062135

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
augeas/libreport.aug | 3 +++
src/lib/Makefile.am | 1 +
src/lib/event_config.c | 10 +++++++++-
3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/augeas/libreport.aug b/augeas/libreport.aug
index 431d3d2..3eba157 100644
--- a/augeas/libreport.aug
+++ b/augeas/libreport.aug
@@ -20,7 +20,10 @@ module Libreport =
let lns = ( comment | empty | option )*
let filter = (incl "/etc/libreport/plugins/*")
+ . (incl "/etc/libreport/events/*")
. (incl (Sys.getenv("HOME") . "/.config/abrt/settings/*"))
+ . (incl (Sys.getenv("XDG_CACHE_HOME") . "/abrt/events/*"))
+ . (incl (Sys.getenv("HOME") . "/.cache/abrt/events/*"))
. Util.stdexcl
let xfm = transform lns filter
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index a8ae75c..ac173f6 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -64,6 +64,7 @@ libreport_la_CPPFLAGS = \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
-DCONF_DIR=\"$(CONF_DIR)\" \
-DEVENTS_DIR=\"$(EVENTS_DIR)\" \
+ -DEVENTS_CONF_DIR=\"$(EVENTS_CONF_DIR)\" \
-DWORKFLOWS_DIR=\"$(WORKFLOWS_DIR)\" \
-DBIN_DIR=\"$(bindir)\" \
-DDEFAULT_DUMP_DIR_MODE=$(DEFAULT_DUMP_DIR_MODE) \
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
index 169dd78..6d12695 100644
--- a/src/lib/event_config.c
+++ b/src/lib/event_config.c
@@ -229,7 +229,15 @@ GHashTable *load_event_config_data(void)
event_files = g_list_delete_link(event_files, event_files);
}
- load_config_files(EVENTS_DIR);
+ /* EVENTS_DIR -> /usr/share/libreport/events/$EVENT_NAME.xml
+ * - event xml definition files
+ *
+ * EVENTS_CONF_DIR -> /etc/libreport/events/$EVENT_NAME.conf
+ * - default values for xml definitions
+ *
+ * https://fedorahosted.org/abrt/wiki/AbrtConfiguration#Adjustingpluginconfiguration
+ */
+ load_config_files(EVENTS_CONF_DIR);
char *cachedir;
cachedir = concat_path_file(g_get_user_cache_dir(), "abrt/events");
--
1.8.3.1

View File

@ -0,0 +1,168 @@
From 819abbfc939d7a2e5f674fd6b77c3fef655d24da Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 7 Feb 2014 16:19:20 +0100
Subject: [LIBREPORT PATCH 20/24] testsuite: xml translations

Related to rhbz#1063320

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
tests/Makefile.am | 3 +-
tests/conf/event_test_definition.xml | 32 ++++++++++++++++++
tests/conf/workflow_test_definition.xml | 13 +++++++
tests/testsuite.at | 1 +
tests/xml_definition.at | 60 +++++++++++++++++++++++++++++++++
5 files changed, 108 insertions(+), 1 deletion(-)
create mode 100644 tests/conf/event_test_definition.xml
create mode 100644 tests/conf/workflow_test_definition.xml
create mode 100644 tests/xml_definition.at

diff --git a/tests/Makefile.am b/tests/Makefile.am
index e8af4de..8ec40e1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,7 +37,8 @@ TESTSUITE_AT = \
configuration_files.at \
reported_to.at \
make_description.at \
- libreport_types.at
+ libreport_types.at \
+ xml_definition.at
EXTRA_DIST += $(TESTSUITE_AT)
TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/conf/event_test_definition.xml b/tests/conf/event_test_definition.xml
new file mode 100644
index 0000000..e12648a
--- /dev/null
+++ b/tests/conf/event_test_definition.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<event>
+ <name>Bugzilla</name>
+ <name xml:lang="zh_CN">screen name</name>
+ <name xml:lang="zh_TW">bad screen name</name>
+
+ <description>Report to Bugzilla bug tracker</description>
+ <description xml:lang="zh_CN">description</description>
+ <description xml:lang="zh_TW">bad description</description>
+
+ <long-description>Report to Bugzilla bug tracker in long description</long-description>
+ <long-description xml:lang="zh_CN">long description</long-description>
+ <long-description xml:lang="zh_TW">bad long description</long-description>
+
+ <options>
+ <option type="text" name="Bugzilla_BugzillaURL">
+ <label>Bugzilla URL</label>
+ <label xml:lang="zh_CN">label</label>
+ <label xml:lang="zh_TW">bad label</label>
+
+ <!-- Option description is not supported yet
+ <description>Address of Bugzilla server</description>
+ <description xml:lang="zh_CN">bad description</description>
+ <description xml:lang="zh_TW">description</description>
+ -->
+
+ <note-html>Bugzilla HTML note</note-html>
+ <note-html xml:lang="zh_CN">note_html</note-html>
+ <note-html xml:lang="zh_TW">bad note_html</note-html>
+ </option>
+ </options>
+</event>
diff --git a/tests/conf/workflow_test_definition.xml b/tests/conf/workflow_test_definition.xml
new file mode 100644
index 0000000..1666c1c
--- /dev/null
+++ b/tests/conf/workflow_test_definition.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+ <name>Report to Red Hat Customer Portal</name>
+ <name xml:lang="zh_CN">screen name</name>
+ <name xml:lang="zh_TW">bad screen name</name>
+ <description>Process the C/C++ crash using the Red Hat infrastructure</description>
+ <description xml:lang="zh_CN">description</description>
+ <description xml:lang="zh_TW">bad description</description>
+
+ <events>
+ <event>collect_*</event>
+ </events>
+</workflow>
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 1faccfb..97b2442 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -12,3 +12,4 @@ m4_include([configuration_files.at])
m4_include([reported_to.at])
m4_include([make_description.at])
m4_include([libreport_types.at])
+m4_include([xml_definition.at])
diff --git a/tests/xml_definition.at b/tests/xml_definition.at
new file mode 100644
index 0000000..e9cef49
--- /dev/null
+++ b/tests/xml_definition.at
@@ -0,0 +1,60 @@
+# -*- Autotest -*-
+
+AT_BANNER([XML definitions])
+
+## ------------------------ ##
+## region_specific_language ##
+## ------------------------ ##
+
+AT_TESTFUN([region_specific_language],
+[[
+#include "internal_libreport.h"
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+int main(void)
+{
+ g_verbose = 3;
+
+ setlocale(LC_ALL, "zh_CN");
+
+ {
+ event_config_t *event_config = new_event_config("event_test_definition");
+ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml");
+ assert(strcmp("screen name", ec_get_screen_name(event_config)) == 0);
+ assert(strcmp("description", ec_get_description(event_config)) == 0);
+ assert(strcmp("long description", ec_get_long_desc(event_config)) == 0);
+
+ assert(event_config->options != NULL || !"At least one event option was loaded");
+
+ /* typeof(event_config->options) == (GList *) */
+ event_option_t *event_option = (event_option_t *)event_config->options->data;
+ assert(strcmp("label", event_option->eo_label) == 0);
+ assert(strcmp("note_html", event_option->eo_note_html) == 0);
+
+ /* Option description is not supported yet
+ assert(strcmp("description", event_option->eo_description) == 0);
+ */
+
+ free_event_config(event_config);
+ }
+
+ {
+ workflow_t *workflow = new_workflow("workflow_test_definition");
+ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml");
+
+ assert(strcmp("screen name", wf_get_screen_name(workflow)) == 0);
+ assert(strcmp("description", wf_get_description(workflow)) == 0);
+
+ /* Long description is not supported yet
+ assert(strcmp("long description", wf_get_long_desc(workflow)) == 0);
+ */
+
+ free_workflow(workflow);
+ }
+
+ return EXIT_SUCCESS;
+}
+]])
--
1.8.3.1

View File

@ -0,0 +1,105 @@
From 9fb7abeeedc68878f70d2e15c191f13b9f0750b1 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Sat, 8 Feb 2014 09:14:59 +0100
Subject: [LIBREPORT PATCH 21/24] testsuite: complex testing of xml locales

Related to rhbz#1063320

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
tests/xml_definition.at | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)

diff --git a/tests/xml_definition.at b/tests/xml_definition.at
index e9cef49..d3032c9 100644
--- a/tests/xml_definition.at
+++ b/tests/xml_definition.at
@@ -55,6 +55,85 @@ int main(void)
free_workflow(workflow);
}
+ setlocale(LC_ALL, "zh_CN.utf8");
+
+ {
+ event_config_t *event_config = new_event_config("event_test_definition");
+ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml");
+ assert(strcmp("screen name", ec_get_screen_name(event_config)) == 0);
+ assert(strcmp("description", ec_get_description(event_config)) == 0);
+ assert(strcmp("long description", ec_get_long_desc(event_config)) == 0);
+
+ assert(event_config->options != NULL || !"At least one event option was loaded");
+
+ /* typeof(event_config->options) == (GList *) */
+ event_option_t *event_option = (event_option_t *)event_config->options->data;
+ assert(strcmp("label", event_option->eo_label) == 0);
+ assert(strcmp("note_html", event_option->eo_note_html) == 0);
+
+ /* Option description is not supported yet
+ assert(strcmp("description", event_option->eo_description) == 0);
+ */
+
+ free_event_config(event_config);
+ }
+
+ {
+ workflow_t *workflow = new_workflow("workflow_test_definition");
+ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml");
+
+ assert(strcmp("screen name", wf_get_screen_name(workflow)) == 0);
+ assert(strcmp("description", wf_get_description(workflow)) == 0);
+
+ /* Long description is not supported yet
+ assert(strcmp("long description", wf_get_long_desc(workflow)) == 0);
+ */
+
+ free_workflow(workflow);
+ }
+
+ /*
+ XML definitions does not contain strings for zh_HK but there are strings
+ for zh_CN and followed by zh_TW. libreport should you string for zh_TW
+ and these strings are prefixed with "bad " string.
+ */
+ setlocale(LC_ALL, "zh_HK");
+
+ {
+ event_config_t *event_config = new_event_config("event_test_definition");
+ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml");
+ assert(strcmp("bad screen name", ec_get_screen_name(event_config)) == 0);
+ assert(strcmp("bad description", ec_get_description(event_config)) == 0);
+ assert(strcmp("bad long description", ec_get_long_desc(event_config)) == 0);
+
+ assert(event_config->options != NULL || !"At least one event option was loaded");
+
+ /* typeof(event_config->options) == (GList *) */
+ event_option_t *event_option = (event_option_t *)event_config->options->data;
+ assert(strcmp("bad label", event_option->eo_label) == 0);
+ assert(strcmp("bad note_html", event_option->eo_note_html) == 0);
+
+ /* Option description is not supported yet
+ assert(strcmp("description", event_option->eo_description) == 0);
+ */
+
+ free_event_config(event_config);
+ }
+
+ {
+ workflow_t *workflow = new_workflow("workflow_test_definition");
+ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml");
+
+ assert(strcmp("bad screen name", wf_get_screen_name(workflow)) == 0);
+ assert(strcmp("bad description", wf_get_description(workflow)) == 0);
+
+ /* Long description is not supported yet
+ assert(strcmp("bad long description", wf_get_long_desc(workflow)) == 0);
+ */
+
+ free_workflow(workflow);
+ }
+
return EXIT_SUCCESS;
}
]])
--
1.8.3.1

View File

@ -0,0 +1,89 @@
From 09da182cd50ee9df08a20180d5fd1d136dc794d3 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Sat, 8 Feb 2014 09:15:35 +0100
Subject: [LIBREPORT PATCH 22/24] localization: properly handle locales with
encoding suffix

XML nodes contain xml:lang attributes whose values are plain language
codes (en_GB, zh_CN, ...).

libreport tries to find exact match with cur locale which may be
suffixed with char set identifier (.UTF-8). Therefore libreport never
finds exact match.

This patch removes the encoding suffix from cur locale string.

Closes to rhbz#1063320

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/xml_parser.h | 2 +-
src/lib/event_xml_parser.c | 6 ++++--
src/lib/workflow_xml_parser.c | 4 +++-
3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/include/xml_parser.h b/src/include/xml_parser.h
index 59517b3..36fd2ae 100644
--- a/src/include/xml_parser.h
+++ b/src/include/xml_parser.h
@@ -22,7 +22,7 @@
struct my_parse_data
{
workflow_t *workflow;
- const char *cur_locale;
+ char *cur_locale;
char *attribute_lang;
bool in_event_list;
bool exact_name;
diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c
index 2a6f477..1f98158 100644
--- a/src/lib/event_xml_parser.c
+++ b/src/lib/event_xml_parser.c
@@ -60,7 +60,7 @@ struct my_parse_data
{
parsed_event_config_t event_config;
parsed_event_option_t cur_option;
- const char *cur_locale;
+ char *cur_locale;
char *attribute_lang;
bool in_adv_option;
};
@@ -511,7 +511,8 @@ void load_event_description_from_file(event_config_t *event_config, const char*
{
log_notice("loading event: '%s'", filename);
struct my_parse_data parse_data = { {event_config, false, false, false}, {NULL, false, false}, NULL, NULL };
- parse_data.cur_locale = setlocale(LC_ALL, NULL);
+ parse_data.cur_locale = xstrdup(setlocale(LC_ALL, NULL));
+ strchrnul(parse_data.cur_locale, '.')[0] = '\0';
GMarkupParser parser;
memset(&parser, 0, sizeof(parser)); /* just in case */
@@ -541,4 +542,5 @@ void load_event_description_from_file(event_config_t *event_config, const char*
consume_cur_option(&parse_data); /* just in case */
free(parse_data.attribute_lang); /* just in case */
+ free(parse_data.cur_locale);
}
diff --git a/src/lib/workflow_xml_parser.c b/src/lib/workflow_xml_parser.c
index 681b171..0efc733 100644
--- a/src/lib/workflow_xml_parser.c
+++ b/src/lib/workflow_xml_parser.c
@@ -165,7 +165,8 @@ void load_workflow_description_from_file(workflow_t *workflow, const char* filen
{
log_notice("loading workflow: '%s'", filename);
struct my_parse_data parse_data = { workflow, NULL, NULL, 0, 0, 0};
- parse_data.cur_locale = setlocale(LC_ALL, NULL);
+ parse_data.cur_locale = xstrdup(setlocale(LC_ALL, NULL));
+ strchrnul(parse_data.cur_locale, '.')[0] = '\0';
GMarkupParser parser;
memset(&parser, 0, sizeof(parser)); /* just in case */
@@ -194,4 +195,5 @@ void load_workflow_description_from_file(workflow_t *workflow, const char* filen
g_markup_parse_context_free(context);
free(parse_data.attribute_lang); /* just in case */
+ free(parse_data.cur_locale);
}
--
1.8.3.1

View File

@ -0,0 +1,62 @@
From f689bf3b1dd26fa14bd96a2a5f0b8a6665d7ab19 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 30 Jan 2014 12:49:42 +0100
Subject: [LIBREPORT PATCH 23/24] fix loading of the user list of ignored words

Closes #1063339

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/user_settings.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/lib/user_settings.c b/src/lib/user_settings.c
index e42ebe0..4cd87ff 100644
--- a/src/lib/user_settings.c
+++ b/src/lib/user_settings.c
@@ -18,19 +18,30 @@
#include "internal_libreport.h"
#include <augeas.h>
+#define BASE_DIR_FOR_USER_CONFIG_FILE "abrt/settings/"
+
static map_string_t *user_settings;
static char *conf_path;
-static char *get_conf_path(const char *name)
+static char *get_user_config_file_path(const char *name, const char *suffix)
{
char *s, *conf;
- s = xasprintf("abrt/settings/%s.conf", name);
+ if (suffix != NULL)
+ s = xasprintf(BASE_DIR_FOR_USER_CONFIG_FILE"%s.%s", name, suffix);
+ else
+ s = xasprintf(BASE_DIR_FOR_USER_CONFIG_FILE"%s", name);
+
conf = concat_path_file(g_get_user_config_dir(), s);
free(s);
return conf;
}
+static char *get_conf_path(const char *name)
+{
+ return get_user_config_file_path(name, "conf");
+}
+
bool save_app_conf_file(const char* application_name, map_string_t *settings)
{
char *app_conf_path = get_conf_path(application_name);
@@ -103,8 +114,7 @@ GList *load_words_from_file(const char* filename)
GList *words_list = NULL;
GList *file_list = NULL;
file_list = g_list_prepend(file_list, concat_path_file(CONF_DIR, filename));
- // get_conf_path adds .conf suffix, so we need to either change it or use it like this:
- file_list = g_list_prepend(file_list, get_conf_path("forbidden_words"));
+ file_list = g_list_prepend(file_list, get_user_config_file_path(filename, /*don't append suffix*/NULL));
GList *file_list_cur = file_list;
while(file_list_cur)
--
1.8.3.1

View File

@ -0,0 +1,33 @@
From 4b6b94acc941df441bdd80f570a86fc44df0142b Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Mon, 10 Feb 2014 16:08:24 +0100
Subject: [LIBREPORT PATCH 24/24] use a KB article URL instead of upstream wiki
URL

Closes rhbz#1029438

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index e962c11..943b2d6 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -299,10 +299,10 @@ static void show_event_opt_error_dialog(const char *event_name)
{
event_config_t *ec = get_event_config(event_name);
char *message = xasprintf(_("%s is not properly configured. You can configure it now or provide the required information later.\n\n"
- "Read more about the configuration at: https://fedorahosted.org/abrt/wiki/AbrtConfiguration"),
+ "Read more about the configuration at: https://access.redhat.com/site/articles/718083"),
ec_get_screen_name(ec));
char *markup_message = xasprintf(_("<b>%s</b> is not properly configured. You can configure it now or provide the required information later.\n\n"
- "<a href=\"https://fedorahosted.org/abrt/wiki/AbrtConfiguration\">Read more about the configuration</a>"),
+ "<a href=\"https://access.redhat.com/site/articles/718083\">Read more about the configuration</a>"),
ec_get_screen_name(ec));
GtkWidget *wrong_settings = g_top_most_window = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From 4168ca76abe568c7df898771eb65a484af264b9e Mon Sep 17 00:00:00 2001
From: Richard Marko <rmarko@redhat.com>
Date: Mon, 3 Feb 2014 14:47:21 +0100
Subject: [LIBREPORT PATCH 25/25] Provide SYSLOG_FACILITY when logging through
journal

Use SYSLOG_FACILITY=1 (user.notice) as a workaround
for rhbz#1026804. This ensures forwarding to rsyslog
works correctly.

Signed-off-by: Richard Marko <rmarko@redhat.com>

Closes rhbz#1063804

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/logging.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/lib/logging.c b/src/lib/logging.c
index afa480b..259a634 100644
--- a/src/lib/logging.c
+++ b/src/lib/logging.c
@@ -143,6 +143,7 @@ static void log_handler(int level,
"CODE_FILE=%s", file,
"CODE_LINE=%d", line,
"CODE_FUNC=%s", func,
+ "SYSLOG_FACILITY=1",
NULL);
}
}
--
1.8.3.1

View File

@ -0,0 +1,26 @@
From 8cde54518832a94b6891beedece1b1a7b1d71444 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 12 Feb 2014 11:22:33 +0100
Subject: [LIBREPORT PATCH 26/26] offer reporting to Bugzilla only for pre-GA
Anaconda exceptions

Closes rhbz#1064261

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/workflows/anaconda_event.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/workflows/anaconda_event.conf b/src/workflows/anaconda_event.conf
index f9ade8e..e894a53 100644
--- a/src/workflows/anaconda_event.conf
+++ b/src/workflows/anaconda_event.conf
@@ -1,4 +1,4 @@
EVENT=workflow_AnacondaFedora component=anaconda
EVENT=workflow_AnacondaRHEL component=anaconda
-EVENT=workflow_AnacondaRHELBugzilla component=anaconda
+EVENT=workflow_AnacondaRHELBugzilla component=anaconda release_type=pre-release
EVENT=workflow_AnacondaUpload component=anaconda
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From 5d0bec1382b450d6fbdc2eea10635ae3ddbd8934 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 21 Feb 2014 13:42:15 +0100
Subject: [LIBREPORT PATCH 27/33] correct name of RH Customer Portal

Closes rhbz#1064961

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/workflows/workflow_AnacondaRHEL.xml.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/workflows/workflow_AnacondaRHEL.xml.in b/src/workflows/workflow_AnacondaRHEL.xml.in
index 6d401ff..4400546 100644
--- a/src/workflows/workflow_AnacondaRHEL.xml.in
+++ b/src/workflows/workflow_AnacondaRHEL.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<workflow>
- <_name>Report a bug to Red Hat Support Tool</_name>
+ <_name>Report a bug to Red Hat Customer Portal</_name>
<_description>Process the report using the Red Hat infrastructure</_description>
<events>
--
1.8.3.1

View File

@ -0,0 +1,37 @@
From e6e62b417b2985ac2b3af98c4df7c9f57840b774 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Sat, 22 Feb 2014 13:21:31 +0100
Subject: [LIBREPORT PATCH 28/33] Fix typos in error messages

Related in rhbz#1062498

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/ureport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index b57eada..39d27f6 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -335,7 +335,7 @@ static struct ureport_server_response *get_server_response(post_state_t *post_st
if (post_state->http_resp_code == 503)
{
- error_msg(_("The server at '%s' is currently can't handle the request (got error 503)"), config->ur_url);
+ error_msg(_("The server at '%s' currently can't handle the request (got error 503)"), config->ur_url);
return NULL;
}
@@ -353,7 +353,7 @@ static struct ureport_server_response *get_server_response(post_state_t *post_st
if (is_error(json))
{
- error_msg(_("Unable to parse response from ureport server at '%s"), config->ur_url);
+ error_msg(_("Unable to parse response from ureport server at '%s'"), config->ur_url);
log_notice("%s", post_state->body);
json_object_put(json);
return NULL;
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From bed3e6cf17a448f84111d2a9ff6d525b7a72c539 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Mon, 24 Feb 2014 09:19:36 +0100
Subject: [LIBREPORT PATCH 29/33] send ureport before creating case in RH
Customer Portal

Closes rhbz#1069111
---
src/plugins/rhtsupport_event.conf | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/plugins/rhtsupport_event.conf b/src/plugins/rhtsupport_event.conf
index 2e9b27e..58261bb 100644
--- a/src/plugins/rhtsupport_event.conf
+++ b/src/plugins/rhtsupport_event.conf
@@ -1 +1,8 @@
-EVENT=report_RHTSupport reporter-rhtsupport
+EVENT=report_RHTSupport
+ # Uploads an ureport to update Crash Statistics used to identify the
+ # hottest bugs that needs to be fixed first.
+ # Failures of reporter-ureport must not prevent users from reporting
+ # problems to Red Hat support engineers.
+ reporter-ureport || true
+ # Create a case in Red Hat Customer Portal
+ reporter-rhtsupport
--
1.8.3.1

View File

@ -0,0 +1,36 @@
From a20279617cf3a1dd9f9e64eb1c0af92f633d2296 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 25 Feb 2014 16:54:21 +0100
Subject: [LIBREPORT PATCH 30/33] wizard: update the help text for screen
casters

The only available screen casting program on RHEL7 is integrated GNOME3
screen caster.

Closes rhbz#1069340

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 943b2d6..32e95c0 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -3404,10 +3404,10 @@ void create_assistant(bool expert_mode)
gtk_widget_set_sensitive(GTK_WIDGET(g_btn_startcast), false);
gtk_widget_set_tooltip_markup(GTK_WIDGET(g_btn_startcast),
_("In order to enable the built-in screencasting "
- "functionality the package recordmydesktop has to be installed. "
+ "functionality the package fros-gnome has to be installed. "
"Please run the following command if you want to install it."
"\n\n"
- "<b>su -c \"yum install recordmydesktop\"</b>"
+ "<b>su -c \"yum install fros-gnome\"</b>"
));
}
--
1.8.3.1

View File

@ -0,0 +1,150 @@
From 90884eeb92527a8f0dbc2d90b3665b40ada3d426 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 21 Feb 2014 22:41:05 +0100
Subject: [LIBREPORT PATCH 31/33] introduce import-event-options in xml event
definitions

Related to rhbz#1069111

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/event_config.h | 1 +
src/lib/event_config.c | 49 +++++++++++++++++++++++++++++++++++++---------
src/lib/event_xml_parser.c | 15 ++++++++++++++
3 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/src/include/event_config.h b/src/include/event_config.h
index 24e1eac..e2fcc23 100644
--- a/src/include/event_config.h
+++ b/src/include/event_config.h
@@ -81,6 +81,7 @@ typedef struct
bool ec_skip_review;
bool ec_sending_sensitive_data;
+ GList *ec_imported_event_names;
GList *options;
} event_config_t;
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
index 6d12695..b25517d 100644
--- a/src/lib/event_config.c
+++ b/src/lib/event_config.c
@@ -112,10 +112,8 @@ void free_event_config(event_config_t *p)
free(p->ec_exclude_items_by_default);
free(p->ec_include_items_by_default);
free(p->ec_exclude_items_always);
- GList *opt;
- for (opt = p->options; opt; opt = opt->next)
- free_event_option(opt->data);
- g_list_free(p->options);
+ g_list_free_full(p->ec_imported_event_names, free);
+ g_list_free_full(p->options, (GDestroyNotify)free_event_option);
free(p);
}
@@ -282,22 +280,54 @@ GList *export_event_config(const char *event_name)
event_config_t *config = get_event_config(event_name);
if (config)
{
+ GList *imported = config->ec_imported_event_names;
+ while (imported)
+ {
+ GList *exported = export_event_config(/*Event name*/imported->data);
+ while (exported)
+ {
+ if (!g_list_find_custom(env_list, exported->data, (GCompareFunc)strcmp))
+ /* It is not necessary to make a copy of opt->eo_name */
+ /* since its memory is owned by event_option_t and it */
+ /* has global scope */
+ env_list = g_list_prepend(env_list, exported->data);
+
+ exported = g_list_remove_link(exported, exported);
+ }
+
+ imported = g_list_next(imported);
+ }
+
GList *lopt;
for (lopt = config->options; lopt; lopt = lopt->next)
{
event_option_t *opt = lopt->data;
if (!opt->eo_value)
continue;
- char *var_val = xasprintf("%s=%s", opt->eo_name, opt->eo_value);
- log_debug("Exporting '%s'", var_val);
- env_list = g_list_prepend(env_list, var_val);
- putenv(var_val);
+
+ log_debug("Exporting '%s=%s'", opt->eo_name, opt->eo_value);
+
+ /* Add the exported key only if it is not in the list */
+ if (!g_list_find_custom(env_list, opt->eo_name, (GCompareFunc)strcmp))
+ /* It is not necessary to make a copy of opt->eo_name */
+ /* since its memory is owned by opt and it has global scope */
+ env_list = g_list_prepend(env_list, opt->eo_name);
+
+ /* setenv() makes copies of strings */
+ xsetenv(opt->eo_name, opt->eo_value);
}
}
return env_list;
}
+/*
+ * Goes through given list and calls unsetnev() for each list item.
+ *
+ * Accepts a list of 'const char *' type items which contains names of exported
+ * environment variables and which was returned from export_event_config()
+ * function.
+ */
void unexport_event_config(GList *env_list)
{
while (env_list)
@@ -305,8 +335,9 @@ void unexport_event_config(GList *env_list)
char *var_val = env_list->data;
log_debug("Unexporting '%s'", var_val);
safe_unsetenv(var_val);
+
+ /* The list doesn't own memory of values: see export_event_config() */
env_list = g_list_remove(env_list, var_val);
- free(var_val);
}
}
diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c
index 1f98158..a15f1e1 100644
--- a/src/lib/event_xml_parser.c
+++ b/src/lib/event_xml_parser.c
@@ -40,6 +40,7 @@
#define EXCL_ALWAYS_ELEMENT "exclude-items-always"
#define EXCL_BINARY_ELEMENT "exclude-binary-items"
#define ADV_OPTIONS_ELEMENT "advanced-options"
+#define IMPORT_OPTIONS_ELEMENT "import-event-options"
typedef struct
{
@@ -210,6 +211,20 @@ static void start_element(GMarkupParseContext *context,
}
}
else
+ if (strcmp(element_name, IMPORT_OPTIONS_ELEMENT) == 0)
+ {
+ if (attribute_names[0] == NULL
+ || attribute_names[1] != NULL
+ || strcmp(attribute_names[0], "event") != 0)
+ {
+ error_msg("XML event configuration error: import-event-options element misses attribute 'event'");
+ return;
+ }
+
+ GList *head = parse_data->event_config.values->ec_imported_event_names;
+ parse_data->event_config.values->ec_imported_event_names = g_list_append(head, xstrdup(attribute_values[0]));
+ }
+ else
if (strcmp(element_name, LABEL_ELEMENT) == 0
|| strcmp(element_name, DESCRIPTION_ELEMENT) == 0
|| strcmp(element_name, LONG_DESCR_ELEMENT) == 0
--
1.8.3.1

View File

@ -0,0 +1,33 @@
From 74489c9ce932b756cd95383eaa0f528fbfc477ee Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 25 Feb 2014 17:40:57 +0100
Subject: [LIBREPORT PATCH 32/33] rhtsupport: import event options from uReport

"report_RHTSupport" event sends an ureport before creating a case.
"report_uReport" event configuration might have be modified option
values, therefore "report_RHTSupport" needs to import this configuration
too.

Related to rhbz#1069111

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/report_RHTSupport.xml.in | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/plugins/report_RHTSupport.xml.in b/src/plugins/report_RHTSupport.xml.in
index e040d8f..a69d31e 100644
--- a/src/plugins/report_RHTSupport.xml.in
+++ b/src/plugins/report_RHTSupport.xml.in
@@ -12,6 +12,8 @@
<gui-review-elements>yes</gui-review-elements>
<options>
+ <import-event-options event="report_uReport"/>
+
<option type="text" name="RHTSupport_URL">
<_label>RH Portal URL</_label>
<allow-empty>no</allow-empty>
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
From 62f216d3716433b0288ff108f46b23cb0315f427 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 27 Feb 2014 16:17:06 +0100
Subject: [LIBREPORT PATCH 34/34] remove invalid bytes from 'sv' strings

Closes rhbz#1070882

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
po/sv.po | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/po/sv.po b/po/sv.po
index 6c51ac5..23f155e 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -1345,7 +1345,7 @@ msgid ""
"CONFFILE lines should have 'PARAM = VALUE' format.\n"
"Recognized string parameter: SubmitURL.\n"
"Parameter can be overridden via $KerneloopsReporter_SubmitURL."
-msgstr "& [-v] [-c KONFFIL]… -d KAT\n\nRapporter kärn-oops till kerneloops.org (eller liknande) webbplats.\n\nFiler med namn som anges i $EXCLUDE_FROM_REPORT ingår inte i tar-arkivet.\n\nKONFFIL-rader skall ha formatet ”PARAM = VÄRDE”.\nKänd strängparameter: SubmitURL.\nParameter kan åsidosättas via $KerneloopsReporter_SubmitURL."
+msgstr "& [-v] [-c KONFFIL]… -d KAT\n\nRapporter kärn-oops till kerneloops.org (eller liknande) webbplats.\n\nFiler med namn som anges i $EXCLUDE_FROM_REPORT ingår inte i tar-arkivet.\n\nKONFFIL-rader skall ha formatet ”PARAM = VÄRDE”.\nKänd strängparameter: SubmitURL.\nParameter kan åsidosättas via $KerneloopsReporter_SubmitURL."
#: ../src/plugins/reporter-kerneloops.c:167 ../src/plugins/ureport.c:456
msgid "Configuration file"
@@ -1399,7 +1399,7 @@ msgid ""
"& [-v] -d DIR [-o FILE] [-a yes/no] [-r]\n"
"\n"
"Prints problem information to standard output or FILE"
-msgstr "& [-v] -d KAT [-o FIL] [-a yes/no] [-r]\n\nSkriver probleminformation till standard ut eller FIL"
+msgstr "& [-v] -d KAT [-o FIL] [-a yes/no] [-r]\n\nSkriver probleminformation till standard ut eller FIL"
#: ../src/plugins/reporter-print.c:57
msgid "Output file"
@@ -1442,7 +1442,7 @@ msgid ""
"Reports a problem to RHTSupport.\n"
"\n"
"If not specified, CONFFILE defaults to "
-msgstr "\n& [-v] [-c KONFFIL] -d KAT\neller:\n& [-v] [-c KONFFIL] [-d KAT] -t[ID] FIL…\n\nRapporterar ett problem att RHTSupport.\n\nOm den inte anges, är standard för KONFFIL "
+msgstr "\n& [-v] [-c KONFFIL] -d KAT\neller:\n& [-v] [-c KONFFIL] [-d KAT] -t[ID] FIL…\n\nRapporterar ett problem att RHTSupport.\n\nOm den inte anges, är standard för KONFFIL "
#: ../src/plugins/reporter-rhtsupport.c:256
msgid "Upload FILEs [to case with this ID]"
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From cff60f93d563afdfab2025b4822410c99688d445 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 6 Mar 2014 21:51:11 +0100
Subject: [LIBREPORT PATCH 35/36] config: do not export empty environment
variables

Save action of the configuration dialog converts unset environment
variables to environment variables holding empty values.

This commit adds an additional condition which prevents the
configuration dialogue from using empty string for unset environment
variables.

Closes rhbz#1073610

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gtk-helpers/config_dialog.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gtk-helpers/config_dialog.c b/src/gtk-helpers/config_dialog.c
index 8276130..fb22561 100644
--- a/src/gtk-helpers/config_dialog.c
+++ b/src/gtk-helpers/config_dialog.c
@@ -125,7 +125,11 @@ static void save_value_from_widget(gpointer data, gpointer user_data)
default:
log("unsupported option type");
}
- if (val)
+
+ /* gtk_entry_get_text() returns empty string for empty text value */
+ /* so if value is empty and the old value is NULL then nothing has */
+ /* changed and we must not set option's value */
+ if (val && (val[0] != '\0' || ow->option->eo_value != NULL))
{
free(ow->option->eo_value);
ow->option->eo_value = xstrdup(val);
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,417 @@
From 36010951c38483b4131012ebebd6b1f79c0ae799 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 23 Apr 2014 13:33:52 +0200
Subject: [LIBREPORT PATCH 37/37] Bugzilla: pass Bugzilla_token in all XML RPC
calls

Introduce the session parameters for XML RPC calls. These parameters are
added to every XML RPC call.

abrt_xmlrpc_call*() functions expected formatting string in form of
"({...})" for some good but unknown reason. Since now, the functions
expects formatting string without the outer brackets.

() - means empty array (allowed in xmlrpc-c)
{} - means empty structure (allowed in xmlrpc-c)

Cite:

Instead of returning a cookie, the User.login call now returns a token
that clients must pass in the Bugzilla_token parameter to subsequent
RPC calls. If the token is not passed, Bugzilla will treat the RPC
call as unauthenticated and will not allow access to non-public data.

See
https://partner-bugzilla.redhat.com/docs/en/html/api/Bugzilla/WebService.html#LOGGING_IN
for more details.

Client scripts that access Red Hat Bugzilla via XML-RPC or JSON-RPC
and use login cookies for authentication must be updated to instead
remember the token received when logging in and pass that token back
to Bugzilla in subsequent RPC calls.

[http://post-office.corp.redhat.com/archives/bugzilla-list/2014-April/msg00005.html]

Resolves rhbz#1090465

Signed-off-by: Jakub Filak <jfilak@redhat.com>

mmilata: fix typo in commit message subject

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/abrt_xmlrpc.c | 94 +++++++++++++++++++++++++++++++++--------
src/lib/abrt_xmlrpc.h | 3 ++
src/plugins/reporter-bugzilla.c | 34 ---------------
src/plugins/rhbz.c | 64 ++++++++++++++++++++++++----
src/plugins/rhbz.h | 4 ++
5 files changed, 139 insertions(+), 60 deletions(-)

diff --git a/src/lib/abrt_xmlrpc.c b/src/lib/abrt_xmlrpc.c
index 48b556f..84ed50d 100644
--- a/src/lib/abrt_xmlrpc.c
+++ b/src/lib/abrt_xmlrpc.c
@@ -20,6 +20,12 @@
#include "abrt_xmlrpc.h"
#include "proxies.h"
+struct abrt_xmlrpc_param_pair
+{
+ char *name;
+ xmlrpc_value *value;
+};
+
void abrt_xmlrpc_die(xmlrpc_env *env)
{
error_msg_and_die("fatal: %s", env->fault_string);
@@ -106,9 +112,77 @@ void abrt_xmlrpc_free_client(struct abrt_xmlrpc *ax)
if (ax->ax_client)
xmlrpc_client_destroy(ax->ax_client);
+ for (GList *iter = ax->ax_session_params; iter; iter = g_list_next(iter))
+ {
+ struct abrt_xmlrpc_param_pair *param_pair = (struct abrt_xmlrpc_param_pair *)iter->data;
+ xmlrpc_DECREF(param_pair->value);
+ free(param_pair->name);
+ free(param_pair);
+ }
+
+ g_list_free(ax->ax_session_params);
+
free(ax);
}
+void abrt_xmlrpc_client_add_session_param_string(xmlrpc_env *env, struct abrt_xmlrpc *ax,
+ const char *name, const char *value)
+{
+ struct abrt_xmlrpc_param_pair *new_ses_param = xmalloc(sizeof(*new_ses_param));
+ new_ses_param->name = xstrdup(name);
+
+ new_ses_param->value = xmlrpc_string_new(env, value);
+ if (env->fault_occurred)
+ abrt_xmlrpc_die(env);
+
+ ax->ax_session_params = g_list_append(ax->ax_session_params, new_ses_param);
+}
+
+/* internal helper function */
+static xmlrpc_value *abrt_xmlrpc_call_params_internal(xmlrpc_env *env, struct abrt_xmlrpc *ax, const char *method, xmlrpc_value *params)
+{
+ xmlrpc_value *array = xmlrpc_array_new(env);
+ if (env->fault_occurred)
+ abrt_xmlrpc_die(env);
+
+ bool destroy_params = false;
+ if (xmlrpc_value_type(params) == XMLRPC_TYPE_NIL)
+ {
+ destroy_params = true;
+ params = abrt_xmlrpc_params_new(env);
+ }
+
+ if (xmlrpc_value_type(params) == XMLRPC_TYPE_STRUCT)
+ {
+ for (GList *iter = ax->ax_session_params; iter; iter = g_list_next(iter))
+ {
+ struct abrt_xmlrpc_param_pair *param_pair = (struct abrt_xmlrpc_param_pair *)iter->data;
+
+ xmlrpc_struct_set_value(env, params, param_pair->name, param_pair->value);
+ if (env->fault_occurred)
+ abrt_xmlrpc_die(env);
+ }
+ }
+ else
+ {
+ log_warning("Bug: not yet supported XML RPC call type.");
+ }
+
+ xmlrpc_array_append_item(env, array, params);
+ if (env->fault_occurred)
+ abrt_xmlrpc_die(env);
+
+ xmlrpc_value *result = NULL;
+ xmlrpc_client_call2(env, ax->ax_client, ax->ax_server_info, method,
+ array, &result);
+
+ if (destroy_params)
+ xmlrpc_DECREF(params);
+
+ xmlrpc_DECREF(array);
+ return result;
+}
+
/* internal helper function */
static
xmlrpc_value *abrt_xmlrpc_call_full_va(xmlrpc_env *env, struct abrt_xmlrpc *ax,
@@ -133,10 +207,8 @@ xmlrpc_value *abrt_xmlrpc_call_full_va(xmlrpc_env *env, struct abrt_xmlrpc *ax,
suffix);
}
else
- {
- xmlrpc_client_call2(env, ax->ax_client, ax->ax_server_info, method,
- param, &result);
- }
+ result = abrt_xmlrpc_call_params_internal(env, ax, method, param);
+
xmlrpc_DECREF(param);
return result;
@@ -192,25 +264,13 @@ void abrt_xmlrpc_params_add_array(xmlrpc_env *env, xmlrpc_value *params, const c
if (env->fault_occurred)
abrt_xmlrpc_die(env);
}
-
xmlrpc_value *abrt_xmlrpc_call_params(xmlrpc_env *env, struct abrt_xmlrpc *ax, const char *method, xmlrpc_value *params)
{
- xmlrpc_value *array = xmlrpc_array_new(env);
- if (env->fault_occurred)
- abrt_xmlrpc_die(env);
-
- xmlrpc_array_append_item(env, array, params);
- if (env->fault_occurred)
- abrt_xmlrpc_die(env);
-
- xmlrpc_value *result = NULL;
- xmlrpc_client_call2(env, ax->ax_client, ax->ax_server_info, method,
- array, &result);
+ xmlrpc_value *result = abrt_xmlrpc_call_params_internal(env, ax, method, params);
if (env->fault_occurred)
abrt_xmlrpc_die(env);
- xmlrpc_DECREF(array);
return result;
}
diff --git a/src/lib/abrt_xmlrpc.h b/src/lib/abrt_xmlrpc.h
index 945a887..e11dcec 100644
--- a/src/lib/abrt_xmlrpc.h
+++ b/src/lib/abrt_xmlrpc.h
@@ -23,6 +23,7 @@
* include/xmlrpc-c/base.h: typedef int32_t xmlrpc_int32;
*/
+#include <glib.h>
#include <xmlrpc-c/base.h>
#include <xmlrpc-c/client.h>
@@ -33,6 +34,7 @@ extern "C" {
struct abrt_xmlrpc {
xmlrpc_client *ax_client;
xmlrpc_server_info *ax_server_info;
+ GList *ax_session_params;
};
xmlrpc_value *abrt_xmlrpc_array_new(xmlrpc_env *env);
@@ -45,6 +47,7 @@ void abrt_xmlrpc_params_add_array(xmlrpc_env *env, xmlrpc_value *params, const c
struct abrt_xmlrpc *abrt_xmlrpc_new_client(const char *url, int ssl_verify);
void abrt_xmlrpc_free_client(struct abrt_xmlrpc *ax);
+void abrt_xmlrpc_client_add_session_param_string(xmlrpc_env *env, struct abrt_xmlrpc *ax, const char *name, const char *value);
void abrt_xmlrpc_die(xmlrpc_env *env) __attribute__((noreturn));
void abrt_xmlrpc_error(xmlrpc_env *env);
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 0e8b277..45aa2cc 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -807,40 +807,6 @@ void login(struct abrt_xmlrpc *client, struct bugzilla_struct *rhbz)
}
}
-static
-xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax,
- const char *product,
- const char *version,
- const char *component,
- const char *duphash)
-{
- struct strbuf *query = strbuf_new();
-
- strbuf_append_strf(query, "ALL whiteboard:\"%s\"", duphash);
-
- if (product)
- strbuf_append_strf(query, " product:\"%s\"", product);
-
- if (version)
- strbuf_append_strf(query, " version:\"%s\"", version);
-
- if (component)
- strbuf_append_strf(query, " component:\"%s\"", component);
-
- char *s = strbuf_free_nobuf(query);
- log_debug("search for '%s'", s);
- xmlrpc_value *search = abrt_xmlrpc_call(ax, "Bug.search", "({s:s})",
- "quicksearch", s);
- free(s);
- xmlrpc_value *bugs = rhbz_get_member("bugs", search);
- xmlrpc_DECREF(search);
-
- if (!bugs)
- error_msg_and_die(_("Bug.search(quicksearch) return value did not contain member 'bugs'"));
-
- return bugs;
-}
-
int main(int argc, char **argv)
{
abrt_init(argv);
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 534aaed..bad9ed4 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -85,7 +85,7 @@ static GList *rhbz_comments(struct abrt_xmlrpc *ax, int bug_id)
* <value><array>
* ...
*/
- xmlrpc_value *xml_response = abrt_xmlrpc_call(ax, "Bug.comments", "({s:(i)})",
+ xmlrpc_value *xml_response = abrt_xmlrpc_call(ax, "Bug.comments", "{s:(i)}",
"ids", bug_id);
/* bugs
* This is used for bugs specified in ids. This is a hash, where the
@@ -215,7 +215,7 @@ bool rhbz_login(struct abrt_xmlrpc *ax, const char *login, const char *password)
func_entry();
xmlrpc_env env;
- xmlrpc_value *result = abrt_xmlrpc_call_full(&env, ax, "User.login", "({s:s,s:s})",
+ xmlrpc_value *result = abrt_xmlrpc_call_full(&env, ax, "User.login", "{s:s,s:s}",
"login", login, "password", password);
if (env.fault_occurred)
@@ -228,6 +228,14 @@ bool rhbz_login(struct abrt_xmlrpc *ax, const char *login, const char *password)
return false;
}
+ char *token = rhbz_bug_read_item("token", result, RHBZ_READ_STR);
+ if (token != NULL)
+ {
+ log_debug("Adding session param Bugzilla_token");
+ abrt_xmlrpc_client_add_session_param_string(&env, ax, "Bugzilla_token", token);
+ free(token);
+ }
+
//TODO: with URL like http://bugzilla.redhat.com (that is, with http: instead of https:)
//we are getting this error:
//Logging into Bugzilla at http://bugzilla.redhat.com
@@ -297,7 +305,7 @@ unsigned rhbz_version(struct abrt_xmlrpc *ax)
func_entry();
xmlrpc_value *result;
- result = abrt_xmlrpc_call(ax, "Bugzilla.version", "()");
+ result = abrt_xmlrpc_call(ax, "Bugzilla.version", "{}");
char *version = NULL;
if (result)
version = rhbz_bug_read_item("version", result, RHBZ_READ_STR);
@@ -472,7 +480,7 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id)
* <value><array><data>
* ...
*/
- xmlrpc_value *xml_bug_response = abrt_xmlrpc_call(ax, "Bug.get", "({s:(i)})",
+ xmlrpc_value *xml_bug_response = abrt_xmlrpc_call(ax, "Bug.get", "{s:(i)}",
"ids", bug_id);
xmlrpc_value *bugs_memb = rhbz_get_member("bugs", xml_bug_response);
@@ -668,7 +676,7 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id,
* 6 -> base64, two arguments (char* plain data which will be encoded by xmlrpc-c to base64,
* size_t number of bytes to encode)
*/
- result = abrt_xmlrpc_call(ax, "Bug.add_attachment", "({s:(s),s:s,s:s,s:s,s:6,s:i})",
+ result = abrt_xmlrpc_call(ax, "Bug.add_attachment", "{s:(s),s:s,s:s,s:s,s:6,s:i}",
"ids", bug_id,
"summary", fn,
"file_name", filename,
@@ -737,7 +745,12 @@ void rhbz_logout(struct abrt_xmlrpc *ax)
{
func_entry();
- xmlrpc_value* result = abrt_xmlrpc_call(ax, "User.logout", "(s)", "");
+ xmlrpc_env env;
+ xmlrpc_value *result = abrt_xmlrpc_call_full(&env, ax, "User.logout", "{}");
+
+ if (env.fault_occurred)
+ log_warning("xmlrpc fault: (%d) %s", env.fault_code, env.fault_string);
+
if (result)
xmlrpc_DECREF(result);
}
@@ -785,7 +798,7 @@ void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail, int f
);
#endif
/* Bugzilla 4.0+ uses this API: */
- result = abrt_xmlrpc_call(ax, "Bug.update", "({s:i,s:{s:(s),s:i}})",
+ result = abrt_xmlrpc_call(ax, "Bug.update", "{s:i,s:{s:(s),s:i}}",
"ids", bug_id,
"cc", "add", mail,
"nomail", nomail_notify
@@ -822,7 +835,7 @@ void rhbz_add_comment(struct abrt_xmlrpc *ax, int bug_id, const char *comment,
int nomail_notify = !!IS_NOMAIL_NOTIFY(flags);
xmlrpc_value *result;
- result = abrt_xmlrpc_call(ax, "Bug.add_comment", "({s:i,s:s,s:b,s:i})",
+ result = abrt_xmlrpc_call(ax, "Bug.add_comment", "{s:i,s:s,s:b,s:i}",
"id", bug_id, "comment", comment,
"private", private, "nomail", nomail_notify);
@@ -835,7 +848,7 @@ void rhbz_set_url(struct abrt_xmlrpc *ax, int bug_id, const char *url, int flags
func_entry();
const int nomail_notify = !!IS_NOMAIL_NOTIFY(flags);
- xmlrpc_value *result = abrt_xmlrpc_call(ax, "Bug.update", "({s:i,s:s,s:i})",
+ xmlrpc_value *result = abrt_xmlrpc_call(ax, "Bug.update", "{s:i,s:s,s:i}",
"ids", bug_id,
"url", url,
@@ -848,3 +861,36 @@ void rhbz_set_url(struct abrt_xmlrpc *ax, int bug_id, const char *url, int flags
if (result)
xmlrpc_DECREF(result);
}
+
+xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax,
+ const char *product,
+ const char *version,
+ const char *component,
+ const char *duphash)
+{
+ struct strbuf *query = strbuf_new();
+
+ strbuf_append_strf(query, "ALL whiteboard:\"%s\"", duphash);
+
+ if (product)
+ strbuf_append_strf(query, " product:\"%s\"", product);
+
+ if (version)
+ strbuf_append_strf(query, " version:\"%s\"", version);
+
+ if (component)
+ strbuf_append_strf(query, " component:\"%s\"", component);
+
+ char *s = strbuf_free_nobuf(query);
+ log_debug("search for '%s'", s);
+ xmlrpc_value *search = abrt_xmlrpc_call(ax, "Bug.search", "{s:s}", "quicksearch", s);
+
+ free(s);
+ xmlrpc_value *bugs = rhbz_get_member("bugs", search);
+ xmlrpc_DECREF(search);
+
+ if (!bugs)
+ error_msg_and_die(_("Bug.search(quicksearch) return value did not contain member 'bugs'"));
+
+ return bugs;
+}
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 742927a..976d333 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -112,6 +112,10 @@ struct bug_info *rhbz_find_origin_bug_closed_duplicate(struct abrt_xmlrpc *ax,
struct bug_info *bi);
unsigned rhbz_version(struct abrt_xmlrpc *ax);
+xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax,
+ const char *product, const char *version, const char *component,
+ const char *duphash);
+
#ifdef __cplusplus
}
#endif
--
1.8.3.1

View File

@ -0,0 +1,125 @@
From 712ca27bdbbe4f38550d5431b400dfa9e70de744 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 18 Apr 2014 14:42:03 +0200
Subject: [LIBREPORT PATCH 38/38] stop using deprecated json-c functions

Resolves: #1125743

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/ureport.c | 44 +++++++++++++++++---------------------------
1 file changed, 17 insertions(+), 27 deletions(-)

diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index 39d27f6..59554f4 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -157,16 +157,13 @@ static char *parse_solution_from_json_list(struct json_object *list, GList **rep
if (!list_elem)
continue;
- struct_elem = json_object_object_get(list_elem, "cause");
- if (!struct_elem)
+ if (!json_object_object_get_ex(list_elem, "cause", &struct_elem))
continue;
cause = json_object_get_string(struct_elem);
- if (!cause)
continue;
- struct_elem = json_object_object_get(list_elem, "note");
- if (!struct_elem)
+ if (!json_object_object_get_ex(list_elem, "note", &struct_elem))
continue;
note = json_object_get_string(struct_elem);
@@ -176,8 +173,7 @@ static char *parse_solution_from_json_list(struct json_object *list, GList **rep
empty = false;
strbuf_append_strf(solution_buf, one_format, cause, note);
- struct_elem = json_object_object_get(list_elem, "url");
- if (!struct_elem)
+ if (!json_object_object_get_ex(list_elem, "url", &struct_elem))
continue;
url = json_object_get_string(struct_elem);
@@ -216,24 +212,21 @@ static GList *parse_reported_to_from_json_list(struct json_object *list)
if (!list_elem)
continue;
- struct_elem = json_object_object_get(list_elem, "reporter");
- if (!struct_elem)
+ if (!json_object_object_get_ex(list_elem, "reporter", &struct_elem))
continue;
reporter = json_object_get_string(struct_elem);
if (!reporter)
continue;
- struct_elem = json_object_object_get(list_elem, "value");
- if (!struct_elem)
+ if (!json_object_object_get_ex(list_elem, "value", &struct_elem))
continue;
value = json_object_get_string(struct_elem);
if (!value)
continue;
- struct_elem = json_object_object_get(list_elem, "type");
- if (!struct_elem)
+ if (!json_object_object_get_ex(list_elem, "type", &struct_elem))
continue;
type = json_object_get_string(struct_elem);
@@ -265,9 +258,8 @@ static GList *parse_reported_to_from_json_list(struct json_object *list)
*/
static struct ureport_server_response *ureport_server_parse_json(json_object *json)
{
- json_object *obj = json_object_object_get(json, "error");
-
- if (obj)
+ json_object *obj = NULL;
+ if (json_object_object_get_ex(json, "error", &obj))
{
struct ureport_server_response *out_response = xzalloc(sizeof(*out_response));
out_response->is_error = true;
@@ -279,27 +271,25 @@ static struct ureport_server_response *ureport_server_parse_json(json_object *js
return out_response;
}
- obj = json_object_object_get(json, "result");
-
- if (obj)
+ if (json_object_object_get_ex(json, "result", &obj))
{
struct ureport_server_response *out_response = xzalloc(sizeof(*out_response));
out_response->value = xstrdup(json_object_get_string(obj));
- json_object *message = json_object_object_get(json, "message");
- if (message)
+ json_object *message = NULL;
+ if (json_object_object_get_ex(json, "message", &message))
out_response->message = xstrdup(json_object_get_string(message));
- json_object *bthash = json_object_object_get(json, "bthash");
- if (bthash)
+ json_object *bthash = NULL;
+ if (json_object_object_get_ex(json, "bthash", &bthash))
out_response->bthash = xstrdup(json_object_get_string(bthash));
- json_object *reported_to_list = json_object_object_get(json, "reported_to");
- if (reported_to_list)
+ json_object *reported_to_list = NULL;
+ if (json_object_object_get_ex(json, "reported_to", &reported_to_list))
out_response->reported_to_list = parse_reported_to_from_json_list(reported_to_list);
- json_object *solutions = json_object_object_get(json, "solutions");
- if (solutions)
+ json_object *solutions = NULL;
+ if (json_object_object_get_ex(json, "solutions", &solutions))
out_response->solution = parse_solution_from_json_list(solutions, &(out_response->reported_to_list));
return out_response;
--
1.8.3.1

View File

@ -0,0 +1,47 @@
From a10a6e9bbe8d53ffe661c180c6e75a4004d5f881 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Mon, 17 Mar 2014 10:37:58 +0100
Subject: [LIBREPORT PATCH 40/93] report-gtk: confirm the ask dialogs on
'Enter'

This commit adds a convinient way of closing an ask dialog. If user
enters some text, hitting 'Enter' key closes the dialog. Closing the
dialog with empty input text is not allowed because it is simmilar to
clicking 'Cancel' button.

Related to rhbz#1067123

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 32e95c0..f8df31a 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1608,6 +1608,13 @@ static void run_event_gtk_alert(const char *msg, void *args)
log_request_response_communication(msg, NULL, (struct analyze_event_data *)args);
}
+static void gtk_entry_emit_dialog_response_ok(GtkEntry *entry, GtkDialog *dialog)
+{
+ /* Don't close the dialogue if the entry is empty */
+ if (gtk_entry_get_text_length(entry) > 0)
+ gtk_dialog_response(dialog, GTK_RESPONSE_OK);
+}
+
static char *ask_helper(const char *msg, void *args, bool password)
{
GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant),
@@ -1626,6 +1633,7 @@ static char *ask_helper(const char *msg, void *args, bool password)
* g_object_set
*/
g_object_set(G_OBJECT(textbox), "editable", TRUE, NULL);
+ g_signal_connect(textbox, "activate", G_CALLBACK(gtk_entry_emit_dialog_response_ok), dialog);
if (password)
gtk_entry_set_visibility(GTK_ENTRY(textbox), FALSE);
--
1.8.3.1

View File

@ -0,0 +1,49 @@
From 21b7c2d4086262fcc5a0c46fc0e4679b5d9fcd6f Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 4 Apr 2014 11:30:13 +0200
Subject: [LIBREPORT PATCH 41/93] testsuite: check return value of setlocale()

If setlocale() fails to set the desired locale value, the test results
look like a bug appeared in libreport.

Related to rhbz#1070892

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
tests/xml_definition.at | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/xml_definition.at b/tests/xml_definition.at
index d3032c9..29043f8 100644
--- a/tests/xml_definition.at
+++ b/tests/xml_definition.at
@@ -18,7 +18,7 @@ int main(void)
{
g_verbose = 3;
- setlocale(LC_ALL, "zh_CN");
+ assert(setlocale(LC_ALL, "zh_CN") != NULL || !"setlocale() failed");
{
event_config_t *event_config = new_event_config("event_test_definition");
@@ -55,7 +55,7 @@ int main(void)
free_workflow(workflow);
}
- setlocale(LC_ALL, "zh_CN.utf8");
+ assert(setlocale(LC_ALL, "zh_CN.utf8") != NULL || !"setlocale() failed");
{
event_config_t *event_config = new_event_config("event_test_definition");
@@ -97,7 +97,7 @@ int main(void)
for zh_CN and followed by zh_TW. libreport should you string for zh_TW
and these strings are prefixed with "bad " string.
*/
- setlocale(LC_ALL, "zh_HK");
+ assert(setlocale(LC_ALL, "zh_HK") != NULL || !"setlocale() failed");
{
event_config_t *event_config = new_event_config("event_test_definition");
--
1.8.3.1

View File

@ -0,0 +1,37 @@
From d5a089e10c0af7b362689a113000c38341667e29 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 4 Apr 2014 15:35:22 +0200
Subject: [LIBREPORT PATCH 42/93] include 'package' in AVC bugzilla bug reports

Resolves rhbz#1075452

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/report-python/__init__.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
index 2c58736..c11b000 100644
--- a/src/report-python/__init__.py
+++ b/src/report-python/__init__.py
@@ -147,7 +147,7 @@ def getVersion():
return _hardcoded_default_version
-def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSignature, executable=None):
+def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSignature, executable=None, package=None):
pd = problem_data()
pd.add("component", component)
pd.add("hashmarkername", hashmarkername)
@@ -156,6 +156,8 @@ def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSig
pd.add("description", alertSignature)
if executable:
pd.add("executable", executable)
+ if package:
+ pd.add("package", package)
pd.add_basics()
return pd
--
1.8.3.1

View File

@ -0,0 +1,420 @@
From c01356b4cda271c96a8129f66e63904f4b75efd2 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 15 Apr 2014 17:40:13 +0200
Subject: [LIBREPORT PATCH 43/93] localization: fix gettext

https://www.gnu.org/software/gettext/manual/html_node/Libraries.html

Resolves to rhbz#1087861

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/client-python/__init__.py | 5 ++---
src/gtk-helpers/ask_dialogs.c | 2 ++
src/gtk-helpers/config_dialog.c | 5 +++++
src/gtk-helpers/event_config_dialog.c | 6 ++++++
src/gtk-helpers/secrets.c | 8 ++++++++
src/gtk-helpers/workflow_config_dialog.c | 2 ++
src/include/internal_libreport.h | 15 ++++++++++++++-
src/lib/Makefile.am | 6 +++++-
src/lib/abrt_sock.c | 2 ++
src/lib/client.c | 10 ++++------
src/lib/create_dump_dir.c | 2 ++
src/lib/curl.c | 2 ++
src/lib/event_config.c | 4 ++++
src/lib/libreport_init.c | 28 ++++++++++++++++++++++++++++
src/lib/make_descr.c | 2 ++
src/lib/parse_options.c | 2 ++
src/lib/problem_data.c | 2 ++
src/lib/run_event.c | 2 ++
18 files changed, 94 insertions(+), 11 deletions(-)
create mode 100644 src/lib/libreport_init.c

diff --git a/src/client-python/__init__.py b/src/client-python/__init__.py
index 53f5f92..8966f22 100644
--- a/src/client-python/__init__.py
+++ b/src/client-python/__init__.py
@@ -30,11 +30,11 @@ from report import EXIT_CANCEL_BY_USER as RETURN_CANCEL_BY_USER
from report import EXIT_STOP_EVENT_RUN as RETURN_STOP_EVENT_RUN
-GETTEXT_PROGNAME = "abrt"
+GETTEXT_PROGNAME = "libreport"
import locale
import gettext
-_ = lambda x: gettext.lgettext(x)
+_ = lambda x: gettext.ldgettext(GETTEXT_PROGNAME, x)
def init_gettext():
try:
@@ -48,7 +48,6 @@ def init_gettext():
except AttributeError:
pass
gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
- gettext.textdomain(GETTEXT_PROGNAME)
init_gettext()
diff --git a/src/gtk-helpers/ask_dialogs.c b/src/gtk-helpers/ask_dialogs.c
index a038126..d188dc5 100644
--- a/src/gtk-helpers/ask_dialogs.c
+++ b/src/gtk-helpers/ask_dialogs.c
@@ -54,6 +54,8 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
const char *message,
GtkWindow *parent)
{
+ INITIALIZE_LIBREPORT();
+
const char *ask_result = get_user_setting(key);
if (ask_result)
diff --git a/src/gtk-helpers/config_dialog.c b/src/gtk-helpers/config_dialog.c
index fb22561..c80dc56 100644
--- a/src/gtk-helpers/config_dialog.c
+++ b/src/gtk-helpers/config_dialog.c
@@ -145,6 +145,8 @@ void dehydrate_config_dialog(GList *option_widgets)
void add_item_to_config_liststore(gpointer cdialog, gpointer inf, gpointer user_data)
{
+ INITIALIZE_LIBREPORT();
+
GtkListStore *list_store = (GtkListStore *)user_data;
config_item_info_t *info = (config_item_info_t *)inf;
@@ -272,6 +274,7 @@ static void on_close_cb(GtkWidget *btn, gpointer config_list_w)
GtkWindow *create_config_list_window(GHashTable *configs, GtkWindow *parent)
{
+ INITIALIZE_LIBREPORT();
// config window
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -341,6 +344,8 @@ GtkWindow *create_config_list_window(GHashTable *configs, GtkWindow *parent)
void show_config_list_dialog(GtkWindow *parent)
{
+ INITIALIZE_LIBREPORT();
+
GHashTable *confs = g_hash_table_new_full(
/*hash_func*/ g_str_hash,
/*key_equal_func:*/ g_str_equal,
diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index c8a251c..1ed5196 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -191,6 +191,8 @@ static void add_option_to_table(gpointer data, gpointer user_data)
config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWidget *content)
{
+ INITIALIZE_LIBREPORT();
+
if (content == NULL)
content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
@@ -285,6 +287,8 @@ config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWi
config_dialog_t *create_event_config_dialog(const char *event_name, GtkWindow *parent)
{
+ INITIALIZE_LIBREPORT();
+
event_config_t *event = get_event_config(event_name);
if(!ec_is_configurable(event))
@@ -340,6 +344,8 @@ GtkListStore *add_events_to_liststore(GHashTable *events)
int show_event_config_dialog(const char *event_name, GtkWindow *parent)
{
+ INITIALIZE_LIBREPORT();
+
event_config_t *event = get_event_config(event_name);
GtkWindow *parent_window = parent ? parent : g_event_list_window;
diff --git a/src/gtk-helpers/secrets.c b/src/gtk-helpers/secrets.c
index 86c2208..fdc6616 100644
--- a/src/gtk-helpers/secrets.c
+++ b/src/gtk-helpers/secrets.c
@@ -1493,6 +1493,8 @@ static void save_event_config(const char *event_name,
bool is_event_config_user_storage_available()
{
+ INITIALIZE_LIBREPORT();
+
if (g_state == SBS_INITIAL)
g_state = secrets_service_connect();
@@ -1507,6 +1509,8 @@ bool is_event_config_user_storage_available()
*/
void load_single_event_config_data_from_user_storage(event_config_t *config)
{
+ INITIALIZE_LIBREPORT();
+
GHashTable *tmp = g_hash_table_new_full(
/*hash_func*/ g_str_hash,
/*key_equal_func:*/ g_str_equal,
@@ -1529,6 +1533,8 @@ void load_single_event_config_data_from_user_storage(event_config_t *config)
*/
void load_event_config_data_from_user_storage(GHashTable *event_config_list)
{
+ INITIALIZE_LIBREPORT();
+
if (is_event_config_user_storage_available())
{
bool dismissed = false;
@@ -1589,6 +1595,8 @@ void save_event_config_data_to_user_storage(const char *event_name,
const event_config_t *event_config,
bool store_passwords)
{
+ INITIALIZE_LIBREPORT();
+
if (is_event_config_user_storage_available())
save_event_config(event_name, event_config->options, store_passwords);
else
diff --git a/src/gtk-helpers/workflow_config_dialog.c b/src/gtk-helpers/workflow_config_dialog.c
index fb312e3..7c399e4 100644
--- a/src/gtk-helpers/workflow_config_dialog.c
+++ b/src/gtk-helpers/workflow_config_dialog.c
@@ -64,6 +64,8 @@ void save_data_from_worfklow_dialog(gpointer data, /* not needed */ const char *
config_dialog_t *create_workflow_config_dialog(const char *workflow_name, GtkWindow *parent)
{
+ INITIALIZE_LIBREPORT();
+
workflow_t *workflow = get_workflow(workflow_name);
GList *events = wf_get_event_list(workflow);
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index e6d3150..f9670b0 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -62,7 +62,7 @@
/* Must be after #include "config.h" */
#if ENABLE_NLS
# include <libintl.h>
-# define _(S) gettext(S)
+# define _(S) dgettext(PACKAGE, S)
#else
# define _(S) (S)
#endif
@@ -925,6 +925,19 @@ enum {
#define log_problem_data libreport_log_problem_data
void log_problem_data(problem_data_t *problem_data, const char *pfx);
+extern int g_libreport_inited;
+void libreport_init(void);
+
+#define INITIALIZE_LIBREPORT() \
+ do \
+ { \
+ if (!g_libreport_inited) \
+ { \
+ g_libreport_inited = 1; \
+ libreport_init(); \
+ } \
+ } \
+ while (0)
const char *abrt_init(char **argv);
#define export_abrt_envvars libreport_export_abrt_envvars
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index ac173f6..d2ff675 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -54,7 +54,9 @@ libreport_la_SOURCES = \
workflow.c \
workflow_xml_parser.c \
config_item_info.c \
- xml_parser.c
+ xml_parser.c \
+ libreport_init.c
+
libreport_la_CPPFLAGS = \
-I$(srcdir)/../include \
-DLOCALSTATEDIR='"$(localstatedir)"' \
@@ -145,6 +147,8 @@ libreport_web_la_LIBADD = \
$(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS) \
libreport.la
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
$(DESTDIR)/$(DEBUG_DUMPS_DIR):
$(mkdir_p) '$@'
# no need to chmod it here
diff --git a/src/lib/abrt_sock.c b/src/lib/abrt_sock.c
index 1526623..962ecc9 100644
--- a/src/lib/abrt_sock.c
+++ b/src/lib/abrt_sock.c
@@ -136,6 +136,8 @@ int problem_data_send_to_abrt(problem_data_t* problem_data)
int delete_dump_dir_possibly_using_abrtd(const char *dump_dir_name)
{
+ INITIALIZE_LIBREPORT();
+
#if DUMP_DIR_OWNED_BY_USER == 0
/* Try to delete it ourselves */
struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
diff --git a/src/lib/client.c b/src/lib/client.c
index 7761150..93b4876 100644
--- a/src/lib/client.c
+++ b/src/lib/client.c
@@ -50,9 +50,8 @@ int set_echo(int enable)
int ask_yes_no(const char *question)
{
-#if ENABLE_NLS
- textdomain(PACKAGE);
-#endif
+ INITIALIZE_LIBREPORT();
+
const char *yes = _("y");
const char *no = _("N");
@@ -83,9 +82,8 @@ int ask_yes_no(const char *question)
int ask_yes_no_yesforever(const char *key, const char *question)
{
-#if ENABLE_NLS
- textdomain(PACKAGE);
-#endif
+ INITIALIZE_LIBREPORT();
+
const char *yes = _("y");
const char *no = _("N");
const char *forever = _("f");
diff --git a/src/lib/create_dump_dir.c b/src/lib/create_dump_dir.c
index d48b099..4f67523 100644
--- a/src/lib/create_dump_dir.c
+++ b/src/lib/create_dump_dir.c
@@ -32,6 +32,8 @@ static struct dump_dir *try_dd_create(const char *base_dir_name, const char *dir
struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)
{
+ INITIALIZE_LIBREPORT();
+
char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);
if (!type)
diff --git a/src/lib/curl.c b/src/lib/curl.c
index 662a2cf..5ca18dd 100644
--- a/src/lib/curl.c
+++ b/src/lib/curl.c
@@ -301,6 +301,8 @@ post(post_state_t *state,
const char *data,
off_t data_size)
{
+ INITIALIZE_LIBREPORT();
+
CURLcode curl_err;
long response_code;
post_state_t localstate;
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
index b25517d..30b94d3 100644
--- a/src/lib/event_config.c
+++ b/src/lib/event_config.c
@@ -395,6 +395,8 @@ static char *validate_event_option(event_option_t *opt)
GHashTable *validate_event(const char *event_name)
{
+ INITIALIZE_LIBREPORT();
+
event_config_t *config = get_event_config(event_name);
if (!config)
return NULL;
@@ -435,6 +437,8 @@ bool check_problem_rating_usability(const event_config_t *cfg,
char **description,
char **detail)
{
+ INITIALIZE_LIBREPORT();
+
char *tmp_desc = NULL;
char *tmp_detail = NULL;
bool result = true;
diff --git a/src/lib/libreport_init.c b/src/lib/libreport_init.c
new file mode 100644
index 0000000..8b9c3f5
--- /dev/null
+++ b/src/lib/libreport_init.c
@@ -0,0 +1,28 @@
+/*
+ Copyright (C) 2014 ABRT team
+ Copyright (C) 2014 RedHat Inc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "internal_libreport.h"
+
+int g_libreport_inited;
+
+void libreport_init(void)
+{
+#if ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+#endif
+}
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index 660a7ac..d183ac1 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -51,6 +51,8 @@ char *make_description_item_multiline(const char *name, const char *content)
char *make_description(problem_data_t *problem_data, char **names_to_skip,
unsigned max_text_size, unsigned desc_flags)
{
+ INITIALIZE_LIBREPORT();
+
struct strbuf *buf_dsc = strbuf_new();
const char *analyzer = problem_data_get_content_or_NULL(problem_data,
diff --git a/src/lib/parse_options.c b/src/lib/parse_options.c
index 3f079d2..b6bf312 100644
--- a/src/lib/parse_options.c
+++ b/src/lib/parse_options.c
@@ -55,6 +55,8 @@ void export_abrt_envvars(int pfx)
void show_usage_and_die(const char *usage, const struct options *opt)
{
+ INITIALIZE_LIBREPORT();
+
fputs(_("Usage: "), stderr);
while (*usage)
{
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
index 3b90b43..18d9541 100644
--- a/src/lib/problem_data.c
+++ b/src/lib/problem_data.c
@@ -207,6 +207,8 @@ void problem_data_add_file(problem_data_t *pd, const char *name, const char *pat
char *problem_data_get_content_or_die(problem_data_t *problem_data, const char *key)
{
+ INITIALIZE_LIBREPORT();
+
struct problem_item *item = problem_data_get_item_or_NULL(problem_data, key);
if (!item)
error_msg_and_die(_("Essential element '%s' is missing, can't continue"), key);
diff --git a/src/lib/run_event.c b/src/lib/run_event.c
index 5efc0c5..a56cf88 100644
--- a/src/lib/run_event.c
+++ b/src/lib/run_event.c
@@ -756,6 +756,8 @@ static void run_event_stdio_error_and_die(const char *error_line, void *param)
char *exit_status_as_string(const char *progname, int status)
{
+ INITIALIZE_LIBREPORT();
+
char *msg;
if (WIFSIGNALED(status))
msg = xasprintf(_("('%s' was killed by signal %u)\n"), progname, WTERMSIG(status));
--
1.8.3.1

View File

@ -0,0 +1,858 @@
From 54fa01f84b33f8081aa936af71ceea2ae3515d9a Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 25 Mar 2014 16:01:05 +0100
Subject: [LIBREPORT PATCH 44/93] wizard: introduce the searched words list

Replace the navigation arrows by a list consisting of lines containing
the searched words.

Resolves rhbz#1069917

Conflicts:
src/gui-wizard-gtk/wizard.glade
---
src/gui-wizard-gtk/wizard.c | 352 +++++++++++++++++++++++-----------------
src/gui-wizard-gtk/wizard.glade | 236 ++++++++++++++++++---------
2 files changed, 366 insertions(+), 222 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index f8df31a..197492a 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -101,10 +101,15 @@ static GtkListStore *g_ls_details;
static GtkBox *g_box_buttons; //TODO: needs not be global
static GtkNotebook *g_notebook;
+static GtkListStore *g_ls_sensitive_list;
+static GtkTreeView *g_tv_sensitive_list;
+static GtkTreeSelection *g_tv_sensitive_sel;
+static GtkRadioButton *g_rb_forbidden_words;
+static GtkRadioButton *g_rb_custom_search;
+static GtkExpander *g_exp_search;
+static gulong g_tv_sensitive_sel_hndlr;
static gboolean g_warning_issued;
-static GtkEventBox *g_ev_search_up;
-static GtkEventBox *g_ev_search_down;
static GtkSpinner *g_spinner_event_log;
static GtkImage *g_img_process_fail;
@@ -117,10 +122,6 @@ static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback f
static void set_auto_event_chain(GtkButton *button, gpointer user_data);
static void start_event_run(const char *event_name);
-static GList *g_search_result_list;
-static guint g_current_highlighted_word;
-static bool g_first_highlight = true;
-
enum
{
/* Note: need to update types in
@@ -136,6 +137,15 @@ enum
/* Search in bt */
static guint g_timeout = 0;
static GtkEntry *g_search_entry_bt;
+static const gchar *g_search_text;
+static search_item_t *g_current_highlighted_word;
+
+enum
+{
+ SEARCH_COLUMN_FILE,
+ SEARCH_COLUMN_TEXT,
+ SEARCH_COLUMN_ITEM,
+};
static GtkBuilder *g_builder;
static PangoFontDescription *g_monospace_font;
@@ -190,9 +200,11 @@ static const gchar *const page_names[] =
#define PRIVATE_TICKET_CB "private_ticket_cb"
#define SENSITIVE_DATA_WARN "sensitive_data_warning"
+#define SENSITIVE_LIST "ls_sensitive_words"
static const gchar *misc_widgets[] =
{
SENSITIVE_DATA_WARN,
+ SENSITIVE_LIST,
NULL
};
@@ -2184,6 +2196,54 @@ static GList *find_words_in_text_buffer(int page,
return found_words;
}
+static void search_item_to_list_store_item(GtkListStore *store, GtkTreeIter *new_row,
+ const gchar *file_name, search_item_t *word)
+{
+ GtkTextIter *beg = gtk_text_iter_copy(&(word->start));
+ gtk_text_iter_backward_line(beg);
+
+ GtkTextIter *end = gtk_text_iter_copy(&(word->end));
+ /* the first call moves end variable at the end of the current line */
+ if (gtk_text_iter_forward_line(end))
+ {
+ /* the second call moves end variable at the end of the next line */
+ gtk_text_iter_forward_line(end);
+
+ /* don't include the last new which causes an empty line in the GUI list */
+ gtk_text_iter_backward_char(end);
+ }
+
+ gchar *tmp = gtk_text_buffer_get_text(word->buffer, beg, &(word->start),
+ /*don't include hidden chars*/FALSE);
+ gchar *prefix = g_markup_escape_text(tmp, /*NULL terminated string*/-1);
+ g_free(tmp);
+
+ tmp = gtk_text_buffer_get_text(word->buffer, &(word->start), &(word->end),
+ /*don't include hidden chars*/FALSE);
+ gchar *text = g_markup_escape_text(tmp, /*NULL terminated string*/-1);
+ g_free(tmp);
+
+ tmp = gtk_text_buffer_get_text(word->buffer, &(word->end), end,
+ /*don't include hidden chars*/FALSE);
+ gchar *suffix = g_markup_escape_text(tmp, /*NULL terminated string*/-1);
+ g_free(tmp);
+
+ char *content = xasprintf("%s<span foreground=\"red\">%s</span>%s", prefix, text, suffix);
+
+ g_free(suffix);
+ g_free(text);
+ g_free(prefix);
+
+ gtk_text_iter_free(end);
+ gtk_text_iter_free(beg);
+
+ gtk_list_store_set(store, new_row,
+ SEARCH_COLUMN_FILE, file_name,
+ SEARCH_COLUMN_TEXT, content,
+ SEARCH_COLUMN_ITEM, word,
+ -1);
+}
+
static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words, GList *ignored_words)
{
GtkTextBuffer *buffer = gtk_text_view_get_buffer(tev);
@@ -2193,30 +2253,49 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
GtkWidget *tab_lbl = gtk_notebook_get_tab_label(g_notebook, notebook_child);
/* Remove old results */
- int bufferpos = -1;
- GList *after_buffer = NULL;
- int allwordspos = 0;
- int bufferwords = 0;
- for (GList* item = g_search_result_list; item; ++allwordspos)
+ bool buffer_removing = false;
+
+ GtkTreeIter iter;
+ gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_sensitive_list), &iter);
+
+ /* Turn off the changed callback during the update */
+ g_signal_handler_block(g_tv_sensitive_sel, g_tv_sensitive_sel_hndlr);
+
+ while (valid)
{
- GList* current = item;
- item = g_list_next(item);
+ char *text = NULL;
+ search_item_t *word = NULL;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(g_ls_sensitive_list), &iter,
+ SEARCH_COLUMN_TEXT, &text,
+ SEARCH_COLUMN_ITEM, &word,
+ -1);
+
+ if (word->buffer == buffer)
+ {
+ buffer_removing = true;
- search_item_t *word = (search_item_t *)current->data;
- if (word->buffer == buffer)
- {
- ++bufferwords;
+ valid = gtk_list_store_remove(g_ls_sensitive_list, &iter);
- if (allwordspos < g_current_highlighted_word)
- ++bufferpos;
+ free(text);
- g_search_result_list = g_list_delete_link(g_search_result_list, current);
- free(word);
- }
- else if(after_buffer == NULL && bufferwords != 0)
- after_buffer = current;
+ if (word == g_current_highlighted_word)
+ g_current_highlighted_word = NULL;
+
+ free(word);
+ }
+ else
+ {
+ if(buffer_removing)
+ break;
+
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(g_ls_sensitive_list), &iter);
+ }
}
+ /* Turn on the changed callback after the update */
+ g_signal_handler_unblock(g_tv_sensitive_sel, g_tv_sensitive_sel_hndlr);
+
GtkTextIter start_find;
gtk_text_buffer_get_start_iter(buffer, &start_find);
GtkTextIter end_find;
@@ -2247,6 +2326,7 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
start_find,
end_find
);
+
for (GList *w = result; w; w = g_list_next(w))
{
search_item_t *item = (search_item_t *)w->data;
@@ -2270,48 +2350,32 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
*/
result = g_list_sort(result, (GCompareFunc)sitem_compare);
- /* Put words of the buffer at the correct place */
- if (after_buffer == g_search_result_list)
+ GList *search_result = result;
+ for ( ; search_result != NULL; search_result = g_list_next(search_result))
{
- /*
- * The original list:
- * (buffer, after buffer)
- */
- g_search_result_list = g_list_concat(result, after_buffer);
- }
- else
- {
- /*
- * The original:
- * (before buffer, buffer, after buffer)
- * After removing buffer's words:
- * (before buffer, after buffer)
- */
- if (after_buffer && after_buffer->prev)
- {
- /* split to two lists (before buffer) and (after buffer) */
- after_buffer->prev->next = NULL;
- after_buffer->prev = NULL;
- }
+ search_item_t *word = (search_item_t *)search_result->data;
- /* create (before buffer, buffer) */
- g_search_result_list = g_list_concat(g_search_result_list, result);
+ const gchar *file_name = gtk_label_get_text(GTK_LABEL(tab_lbl));
+
+ /* Create a new row */
+ GtkTreeIter new_row;
+ if (valid)
+ /* iter variable is valid GtkTreeIter and it means that the results */
+ /* need to be inserted before this iterator, in this case iter points */
+ /* to the first word of another GtkTextView */
+ gtk_list_store_insert_before(g_ls_sensitive_list, &new_row, &iter);
+ else
+ /* the GtkTextView is the last one or the only one, insert the results */
+ /* at the end of the list store */
+ gtk_list_store_append(g_ls_sensitive_list, &new_row);
- if (after_buffer)
- /* create (before buffer, buffer, after buffer) */
- g_search_result_list = g_list_concat(g_search_result_list, after_buffer);
+ /* Assign values to the new row */
+ search_item_to_list_store_item(g_ls_sensitive_list, &new_row, file_name, word);
}
}
- /* The bufferpos variable greater than 0 means that current word was in
- * the buffer or the currently highlighted word was after all buffer's
- * words, therefore we have to decrease the index of the currently
- * highlighted word. If any word was found the highlighting process
- * will start from the beginning of the buffer. If no word was found
- * the currently highlighted word will be the first word in a next buffer.
- */
- if (bufferpos >= 0)
- g_current_highlighted_word -= (bufferpos + (result == NULL));
+ g_list_free_full(ignored_words_in_buffer, free);
+ g_list_free(result);
return result != NULL;
}
@@ -2320,11 +2384,6 @@ static gboolean highligh_words_in_tabs(GList *forbidden_words, GList *allowed_w
{
gboolean found = false;
- list_free_with_free(g_search_result_list);
- g_search_result_list = NULL;
- g_current_highlighted_word = 0;
- g_first_highlight = true;
-
gint n_pages = gtk_notebook_get_n_pages(g_notebook);
int page = 0;
for (page = 0; page < n_pages; page++)
@@ -2340,21 +2399,24 @@ static gboolean highligh_words_in_tabs(GList *forbidden_words, GList *allowed_w
found |= highligh_words_in_textview(page, tev, forbidden_words, allowed_words);
}
+ GtkTreeIter iter;
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_sensitive_list), &iter))
+ gtk_tree_selection_select_iter(g_tv_sensitive_sel, &iter);
+
return found;
}
-static void highlight_forbidden(void)
+static gboolean highlight_forbidden(void)
{
GList *forbidden_words = load_words_from_file(FORBIDDEN_WORDS_BLACKLLIST);
GList *allowed_words = load_words_from_file(FORBIDDEN_WORDS_WHITELIST);
- if (highligh_words_in_tabs(forbidden_words, allowed_words)) {
- add_sensitive_data_warning();
- show_warnings();
- }
+ const gboolean result = highligh_words_in_tabs(forbidden_words, allowed_words);
list_free_with_free(forbidden_words);
list_free_with_free(allowed_words);
+
+ return result;
}
static gint select_next_page_no(gint current_page_no, gpointer data);
@@ -2492,7 +2554,15 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
if (pages[PAGENO_EDIT_ELEMENTS].page_widget == page)
{
- highlight_forbidden();
+ if (highlight_forbidden())
+ {
+ add_sensitive_data_warning();
+ show_warnings();
+ gtk_expander_set_expanded(g_exp_search, TRUE);
+ }
+ else
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_rb_custom_search), TRUE);
+
show_warnings();
}
@@ -2769,18 +2839,6 @@ static gint select_next_page_no(gint current_page_no, gpointer data)
return current_page_no;
}
-
-
-static void highlight_widget(GtkWidget *widget, gpointer *user_data)
-{
- gtk_drag_highlight(widget);
-}
-
-static void unhighlight_widget(GtkWidget *widget, gpointer *user_data)
-{
- gtk_drag_unhighlight(widget);
-}
-
static void rehighlight_forbidden_words(int page, GtkTextView *tev)
{
GList *forbidden_words = load_words_from_file(FORBIDDEN_WORDS_BLACKLLIST);
@@ -2788,75 +2846,57 @@ static void rehighlight_forbidden_words(int page, GtkTextView *tev)
highligh_words_in_textview(page, tev, forbidden_words, allowed_words);
list_free_with_free(forbidden_words);
list_free_with_free(allowed_words);
-
- /* Don't increment resp. decrement in search_down() resp. search_up() */
- g_first_highlight = true;
}
-static void unhighlight_current_word(void)
+static void on_sensitive_word_selection_changed(GtkTreeSelection *sel, gpointer user_data)
{
- search_item_t *word = NULL;
- word = (search_item_t *)g_list_nth_data(g_search_result_list, g_current_highlighted_word);
- if (word)
- {
- if (gtk_text_buffer_get_modified(word->buffer))
- rehighlight_forbidden_words(word->page, word->tev);
- else
- gtk_text_buffer_remove_tag_by_name(word->buffer, "current_result_bg", &(word->start), &(word->end));
- }
-}
+ search_item_t *old_word = g_current_highlighted_word;
+ g_current_highlighted_word = NULL;
-static void highlight_current_word(void)
-{
- search_item_t *word = NULL;
- word = (search_item_t *)g_list_nth_data(g_search_result_list, g_current_highlighted_word);
- if (word)
+ if (old_word && FALSE == gtk_text_buffer_get_modified(old_word->buffer))
+ gtk_text_buffer_remove_tag_by_name(old_word->buffer, "current_result_bg", &(old_word->start), &(old_word->end));
+
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+ return;
+
+ search_item_t *new_word;
+ gtk_tree_model_get(model, &iter,
+ SEARCH_COLUMN_ITEM, &new_word,
+ -1);
+
+ if (gtk_text_buffer_get_modified(new_word->buffer))
{
- if (gtk_text_buffer_get_modified(word->buffer))
+ if (g_search_text == NULL)
+ rehighlight_forbidden_words(new_word->page, new_word->tev);
+ else
{
- rehighlight_forbidden_words(word->page, word->tev);
- highlight_current_word();
- return;
+ log_notice("searching again: '%s'", g_search_text);
+ GList *searched_words = g_list_append(NULL, (gpointer)g_search_text);
+ highligh_words_in_textview(new_word->page, new_word->tev, searched_words, NULL);
+ g_list_free(searched_words);
}
- gtk_notebook_set_current_page(g_notebook, word->page);
- gtk_text_buffer_apply_tag_by_name(word->buffer, "current_result_bg", &(word->start), &(word->end));
- gtk_text_buffer_place_cursor(word->buffer, &(word->start));
- gtk_text_view_scroll_to_iter(word->tev, &(word->start), 0.0, false, 0, 0);
+ return;
}
-}
-static void search_down(GtkWidget *widget, gpointer user_data)
-{
- if (g_current_highlighted_word + !g_first_highlight < g_list_length(g_search_result_list))
- {
- unhighlight_current_word();
- if (!g_first_highlight)
- g_current_highlighted_word++;
- g_first_highlight = false;
- highlight_current_word();
- }
-}
+ g_current_highlighted_word = new_word;
-static void search_up(GtkWidget *widget, gpointer user_data)
-{
- if (g_current_highlighted_word + g_first_highlight > 0)
- {
- unhighlight_current_word();
- if (!g_first_highlight)
- g_current_highlighted_word--;
- g_first_highlight = false;
- highlight_current_word();
- }
+ gtk_notebook_set_current_page(g_notebook, new_word->page);
+ gtk_text_buffer_apply_tag_by_name(new_word->buffer, "current_result_bg", &(new_word->start), &(new_word->end));
+ gtk_text_buffer_place_cursor(new_word->buffer, &(new_word->start));
+ gtk_text_view_scroll_to_iter(new_word->tev, &(new_word->start), 0.0, false, 0, 0);
}
static gboolean highlight_search(gpointer user_data)
{
GtkEntry *entry = GTK_ENTRY(user_data);
- log_notice("searching: '%s'", gtk_entry_get_text(entry));
+ g_search_text = gtk_entry_get_text(entry);
- GList *words = g_list_append(NULL, (gpointer)gtk_entry_get_text(entry));
+ log_notice("searching: '%s'", g_search_text);
+ GList *words = g_list_append(NULL, (gpointer)g_search_text);
highligh_words_in_tabs(words, NULL);
g_list_free(words);
@@ -2876,6 +2916,22 @@ static void search_timeout(GtkEntry *entry)
g_timeout = g_timeout_add(500, &highlight_search, (gpointer)entry);
}
+static void on_forbidden_words_toggled(GtkToggleButton *btn, gpointer user_data)
+{
+ g_search_text = NULL;
+ log_notice("nothing to search for, highlighting forbidden words instead");
+ highlight_forbidden();
+}
+
+static void on_custom_search_toggled(GtkToggleButton *btn, gpointer user_data)
+{
+ const gboolean custom_search = gtk_toggle_button_get_active(btn);
+ gtk_widget_set_sensitive(GTK_WIDGET(g_search_entry_bt), custom_search);
+
+ if (custom_search)
+ highlight_search(g_search_entry_bt);
+}
+
static void save_edited_one_liner(GtkCellRendererText *renderer,
gchar *tree_path,
gchar *new_text,
@@ -3045,7 +3101,6 @@ static gint on_key_press_event_in_item_list(GtkTreeView *treeview, GdkEventKey *
return FALSE;
}
-
/* Initialization */
/* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */
@@ -3069,15 +3124,15 @@ static void add_pages(void)
g_builder = gtk_builder_new();
if (!g_glade_file)
{
- /* Load pages from internal string */
+ /* load additional widgets from glade */
gtk_builder_add_objects_from_string(g_builder,
WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
- (gchar**)page_names,
+ (gchar**)misc_widgets,
&error);
- /* load additional widgets from glade */
+ /* Load pages from internal string */
gtk_builder_add_objects_from_string(g_builder,
WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
- (gchar**)misc_widgets,
+ (gchar**)page_names,
&error);
if (error != NULL)
error_msg_and_die("Error loading glade data: %s", error->message);
@@ -3118,8 +3173,12 @@ static void add_pages(void)
g_btn_add_file = GTK_BUTTON( gtk_builder_get_object(g_builder, "btn_add_file"));
g_lbl_size = GTK_LABEL( gtk_builder_get_object(g_builder, "lbl_size"));
g_notebook = GTK_NOTEBOOK( gtk_builder_get_object(g_builder, "notebook_edit"));
- g_ev_search_up = GTK_EVENT_BOX( gtk_builder_get_object(g_builder, "ev_search_up"));
- g_ev_search_down = GTK_EVENT_BOX( gtk_builder_get_object(g_builder, "ev_search_down"));
+ g_ls_sensitive_list = GTK_LIST_STORE( gtk_builder_get_object(g_builder, "ls_sensitive_words"));
+ g_tv_sensitive_list = GTK_TREE_VIEW( gtk_builder_get_object(g_builder, "tv_sensitive_words"));
+ g_tv_sensitive_sel = GTK_TREE_SELECTION( gtk_builder_get_object(g_builder, "tv_sensitive_words_selection"));
+ g_rb_forbidden_words = GTK_RADIO_BUTTON( gtk_builder_get_object(g_builder, "rb_forbidden_words"));
+ g_rb_custom_search = GTK_RADIO_BUTTON( gtk_builder_get_object(g_builder, "rb_custom_search"));
+ g_exp_search = GTK_EXPANDER( gtk_builder_get_object(g_builder, "expander_search"));
g_spinner_event_log = GTK_SPINNER( gtk_builder_get_object(g_builder, "spinner_event_log"));
g_img_process_fail = GTK_IMAGE( gtk_builder_get_object(g_builder, "img_process_fail"));
g_btn_startcast = GTK_BUTTON( gtk_builder_get_object(g_builder, "btn_startcast"));
@@ -3142,14 +3201,8 @@ static void add_pages(void)
g_signal_connect(g_cb_no_comment, "toggled", G_CALLBACK(on_no_comment_toggled), NULL);
- /* hook up the search arrows */
- g_signal_connect(G_OBJECT(g_ev_search_up), "enter-notify-event", G_CALLBACK(highlight_widget), NULL);
- g_signal_connect(G_OBJECT(g_ev_search_up), "leave-notify-event", G_CALLBACK(unhighlight_widget), NULL);
- g_signal_connect(G_OBJECT(g_ev_search_up), "button-press-event", G_CALLBACK(search_up), NULL);
-
- g_signal_connect(G_OBJECT(g_ev_search_down), "enter-notify-event", G_CALLBACK(highlight_widget), NULL);
- g_signal_connect(G_OBJECT(g_ev_search_down), "leave-notify-event", G_CALLBACK(unhighlight_widget), NULL);
- g_signal_connect(G_OBJECT(g_ev_search_down), "button-press-event", G_CALLBACK(search_down), NULL);
+ g_signal_connect(g_rb_forbidden_words, "toggled", G_CALLBACK(on_forbidden_words_toggled), NULL);
+ g_signal_connect(g_rb_custom_search, "toggled", G_CALLBACK(on_custom_search_toggled), NULL);
/* Set color of the comment evenbox */
GdkRGBA color;
@@ -3157,6 +3210,7 @@ static void add_pages(void)
gtk_widget_override_color(GTK_WIDGET(g_eb_comment), GTK_STATE_FLAG_NORMAL, &color);
g_signal_connect(g_tv_details, "key-press-event", G_CALLBACK(on_key_press_event_in_item_list), NULL);
+ g_tv_sensitive_sel_hndlr = g_signal_connect(g_tv_sensitive_sel, "changed", G_CALLBACK(on_sensitive_word_selection_changed), NULL);
}
static void create_details_treeview(void)
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
index 9fddf2b..9a179f4 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -6,6 +6,16 @@
<property name="can_focus">False</property>
<property name="icon_name">media-record</property>
</object>
+ <object class="GtkListStore" id="ls_sensitive_words">
+ <columns>
+ <!-- column-name file -->
+ <column type="gchararray"/>
+ <!-- column-name data -->
+ <column type="gchararray"/>
+ <!-- column-name search_item -->
+ <column type="gpointer"/>
+ </columns>
+ </object>
<object class="GtkWindow" id="sensitiveDataWarning_w">
<property name="can_focus">False</property>
<child>
@@ -36,9 +46,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
- <property name="margin_top">6</property>
- <property name="margin_bottom">6</property>
- <property name="label" translatable="yes">Possible sensitive data detected</property>
+ <property name="margin_top">3</property>
+ <property name="margin_bottom">3</property>
+ <property name="label" translatable="yes">Possible sensitive data detected, feel free to edit the report and remove them.</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -469,7 +479,8 @@
<object class="GtkVBox" id="page_3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">10</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label8">
@@ -487,106 +498,185 @@
</packing>
</child>
<child>
- <object class="GtkNotebook" id="notebook_edit">
+ <object class="GtkPaned" id="paned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="scrollable">True</property>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="search_hbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkEntry" id="entry_search_bt">
+ <object class="GtkNotebook" id="notebook_edit">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
- <property name="secondary_icon_name">edit-find</property>
- <property name="primary_icon_activatable">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="scrollable">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="resize">True</property>
+ <property name="shrink">True</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkExpander" id="expander_search">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">1</property>
<child>
- <object class="GtkEventBox" id="ev_search_up">
+ <object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkArrow" id="arr_search_up">
+ <object class="GtkBox" id="box8">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="arrow_type">up</property>
+ <child>
+ <object class="GtkRadioButton" id="rb_forbidden_words">
+ <property name="label" translatable="yes">Forbidden words</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="rb_custom_search">
+ <property name="label" translatable="yes">Custom</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rb_forbidden_words</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_search_bt">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="secondary_icon_name">edit-find</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_tooltip_text" translatable="yes">Clear the search bar to see the list of security sensitive words.</property>
+ <property name="secondary_icon_tooltip_markup" translatable="yes">Clear the search bar to see the list of security sensitive words.</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEventBox" id="ev_search_down">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
- <object class="GtkArrow" id="arr_search_down">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">down</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="tv_sensitive_words">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">ls_sensitive_words</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="enable_search">False</property>
+ <property name="search_column">0</property>
+ <property name="enable_grid_lines">both</property>
+ <property name="enable_tree_lines">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="tv_sensitive_words_selection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">file</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">data</property>
+ <child>
+ <object class="GtkCellRendererText" id="crt_sensitive_word_value"/>
+ <attributes>
+ <attribute name="markup">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Search</property>
+ </object>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="resize">True</property>
+ <property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
--
1.8.3.1

View File

@ -0,0 +1,187 @@
From 6cf4c34ea589698c3c4b9a2a6b708ca66f446844 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 24 Jun 2014 16:25:30 +0200
Subject: [LIBREPORT PATCH 45/93] wizard: use a tab for Advanced opts instead
of an expander

GtkExpander containing wrapped labels breaks GTK3's algorithm computing
the window size when expanding/folding.

A tab page seems to be more modern approach which does not causes any
problems.

The tab pages are filled with GtkScrolledWindow in order to prevent
enlarging the configuration window behind screen limits.

The worfklow window also uses tab pages but on the left side because
two vertical tab page lines are strange.

Resolves rhbz#965963

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gtk-helpers/event_config_dialog.c | 59 ++++++++++++++++++++------------
src/gtk-helpers/workflow_config_dialog.c | 25 +++++++++-----
2 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index 1ed5196..9d442d6 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -189,19 +189,18 @@ static void add_option_to_table(gpointer data, gpointer user_data)
free(option_label);
}
-config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWidget *content)
+static GtkWidget *create_event_config_grid()
{
- INITIALIZE_LIBREPORT();
-
- if (content == NULL)
- content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ GtkWidget *option_table = gtk_grid_new();
- //event_config_t *event = get_event_config(event_name);
+ gtk_widget_set_margin_left(option_table, 5);
+ gtk_widget_set_margin_top(option_table, 5);
+ gtk_widget_set_margin_right(option_table, 5);
+ gtk_widget_set_margin_bottom(option_table, 5);
- GtkWidget *option_table = gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(option_table), FALSE);
gtk_grid_set_column_homogeneous(GTK_GRID(option_table), FALSE);
- gtk_grid_set_row_spacing(GTK_GRID(option_table), 2);
+ gtk_grid_set_row_spacing(GTK_GRID(option_table), 10);
g_object_set_data(G_OBJECT(option_table), "n-rows", (gpointer)-1);
gtk_widget_set_hexpand(option_table, TRUE);
@@ -209,21 +208,28 @@ config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWi
gtk_widget_set_halign(option_table, GTK_ALIGN_FILL);
gtk_widget_set_valign(option_table, GTK_ALIGN_FILL);
+ return option_table;
+}
+
+config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWidget *content)
+{
+ INITIALIZE_LIBREPORT();
+
+ if (content == NULL)
+ content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+
+ //event_config_t *event = get_event_config(event_name);
+ GtkWidget *notebook_layout = gtk_notebook_new();
+ gtk_box_pack_start(GTK_BOX(content), notebook_layout, TRUE, TRUE, 0);
+
+ GtkWidget *option_table = create_event_config_grid();
+
/* table to hold advanced options
* hidden in expander which is visible only if there's at least
* one advanced option
*/
+ GtkWidget *adv_option_table = create_event_config_grid();
- GtkWidget *adv_option_table = gtk_grid_new();
- gtk_grid_set_row_homogeneous(GTK_GRID(adv_option_table), FALSE);
- gtk_grid_set_column_homogeneous(GTK_GRID(adv_option_table), FALSE);
- gtk_grid_set_row_spacing(GTK_GRID(adv_option_table), 2);
- g_object_set_data(G_OBJECT(adv_option_table), "n-rows", (gpointer)-1);
-
- GtkWidget *adv_expander = gtk_expander_new(_("Advanced"));
- /* resize the toplevel widget containing the expander upon resizing and collapsing. */
- gtk_expander_set_resize_toplevel(GTK_EXPANDER(adv_expander), TRUE);
- gtk_container_add(GTK_CONTAINER(adv_expander), adv_option_table);
g_object_set_data(G_OBJECT(option_table), "advanced-options", adv_option_table);
has_password_option = false;
@@ -250,11 +256,22 @@ config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWi
g_signal_connect(pass_store_cb, "toggled", G_CALLBACK(on_show_pass_store_cb), NULL);
}
- gtk_box_pack_start(GTK_BOX(content), option_table, false, false, 20);
+ GtkWidget *option_table_lbl = gtk_label_new_with_mnemonic(_("Basic"));
+ GtkWidget *option_table_scrl = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(option_table_scrl), option_table);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook_layout), option_table_scrl, option_table_lbl);
/* add the adv_option_table to the dialog only if there is some adv option */
if (g_list_length(gtk_container_get_children(GTK_CONTAINER(adv_option_table))) > 0)
- gtk_box_pack_start(GTK_BOX(content), adv_expander, false, false, 0);
+ {
+ GtkWidget *adv_option_table_lbl = gtk_label_new_with_mnemonic(_("Advanced"));
+ GtkWidget *adv_option_table_scrl = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(adv_option_table_scrl), adv_option_table);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook_layout), adv_option_table_scrl, adv_option_table_lbl);
+ }
+ else
+ /* Do not show single tab 'Basic' */
+ gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook_layout), FALSE);
/* add warning if secrets service is not available showing the nagging dialog
* is considered "too heavy UI" be designers
@@ -311,7 +328,7 @@ config_dialog_t *create_event_config_dialog(const char *event_name, GtkWindow *p
* line wrapped.
*/
gtk_window_set_resizable(GTK_WINDOW(dialog), true);
- gtk_window_set_default_size(GTK_WINDOW(dialog), 450, -1);
+ gtk_window_set_default_size(GTK_WINDOW(dialog), 450, 310);
if (parent_window != NULL)
{
diff --git a/src/gtk-helpers/workflow_config_dialog.c b/src/gtk-helpers/workflow_config_dialog.c
index 7c399e4..45d7fb6 100644
--- a/src/gtk-helpers/workflow_config_dialog.c
+++ b/src/gtk-helpers/workflow_config_dialog.c
@@ -29,15 +29,23 @@ enum
static GtkWindow *g_parent_window;
static GHashTable *g_events_options = NULL;
-static void create_event_config_dialog_content_cb(event_config_t *ec, gpointer content)
+static void create_event_config_dialog_content_cb(event_config_t *ec, gpointer notebook)
{
- if (ec->options)
- {
- GtkWidget *ev_lbl = gtk_label_new(ec_get_screen_name(ec));
- gtk_box_pack_start(GTK_BOX(content), ev_lbl, false, false, 0);
- }
+ if (!ec->options)
+ return;
+
+ GtkWidget *ev_lbl = gtk_label_new(ec_get_screen_name(ec));
+
+ GtkWidget *content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_margin_left(content, 10);
+ gtk_widget_set_margin_top(content, 5);
+ gtk_widget_set_margin_right(content, 10);
+ gtk_widget_set_margin_bottom(content, 10);
config_dialog_t *cdialog = create_event_config_dialog_content(ec, (GtkWidget *)content);
+
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), content, ev_lbl);
+
if (g_events_options == NULL)
{
g_events_options = g_hash_table_new_full(
@@ -46,8 +54,8 @@ static void create_event_config_dialog_content_cb(event_config_t *ec, gpointer c
/*key_destroy_func:*/ g_free,
/*value_destroy_func:*/ NULL);
}
- g_hash_table_insert(g_events_options, ec, cdialog);
+ g_hash_table_insert(g_events_options, ec, cdialog);
}
static void save_event_config_data_foreach(event_config_t *ec,
@@ -91,7 +99,8 @@ config_dialog_t *create_workflow_config_dialog(const char *workflow_name, GtkWin
}
GtkWidget *scrolled = gtk_scrolled_window_new(NULL, NULL);
- GtkWidget *content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ GtkWidget *content = gtk_notebook_new();
+ gtk_notebook_set_tab_pos(GTK_NOTEBOOK(content), GTK_POS_LEFT);
#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 7) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 7 && GTK_MICRO_VERSION < 8))
/* http://developer.gnome.org/gtk3/unstable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport */
--
1.8.3.1

View File

@ -0,0 +1,56 @@
From 49815024636c6ca7cc6ebe45b42d7ae33db20127 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 18 Jul 2014 12:20:06 +0200
Subject: [LIBREPORT PATCH 46/93] gui: apply configuration dialogues changes on
Enter key

Related to rhbz#1067123

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/gtk-helpers/event_config_dialog.c
src/gtk-helpers/workflow_config_dialog.c
---
src/gtk-helpers/event_config_dialog.c | 4 ++++
src/gtk-helpers/workflow_config_dialog.c | 2 ++
2 files changed, 6 insertions(+)

diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index 9d442d6..659f563 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -122,6 +122,7 @@ static void add_option_to_table(gpointer data, gpointer user_data)
/*left,top:*/ 0, last_row,
/*width,height:*/ 1, 1);
option_input = gtk_entry_new();
+ gtk_entry_set_activates_default(GTK_ENTRY(option_input), TRUE);
gtk_widget_set_hexpand(option_input, TRUE);
if (option->eo_value != NULL)
gtk_entry_set_text(GTK_ENTRY(option_input), option->eo_value);
@@ -323,6 +324,9 @@ config_dialog_t *create_event_config_dialog(const char *event_name, GtkWindow *p
GTK_RESPONSE_APPLY,
NULL);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
+
/* Allow resize?
* W/o resize, e.g. upload configuration hint looks awfully
* line wrapped.
diff --git a/src/gtk-helpers/workflow_config_dialog.c b/src/gtk-helpers/workflow_config_dialog.c
index 45d7fb6..7b7fe32 100644
--- a/src/gtk-helpers/workflow_config_dialog.c
+++ b/src/gtk-helpers/workflow_config_dialog.c
@@ -89,6 +89,8 @@ config_dialog_t *create_workflow_config_dialog(const char *workflow_name, GtkWin
GTK_RESPONSE_APPLY,
NULL);
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
+
gtk_window_set_resizable(GTK_WINDOW(dialog), true);
gtk_window_set_default_size(GTK_WINDOW(dialog), 450, 450);
--
1.8.3.1

View File

@ -0,0 +1,66 @@
From 251d1783834f2da5f5219f6102d69b74636772bd Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 18 Jul 2014 13:44:53 +0200
Subject: [LIBREPORT PATCH 47/93] gui: close ask dialogues on Enter key

Related to rhbz#1067123

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/gui-wizard-gtk/wizard.c
---
src/gtk-helpers/ask_dialogs.c | 7 ++++++-
src/gui-wizard-gtk/wizard.c | 3 +++
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gtk-helpers/ask_dialogs.c b/src/gtk-helpers/ask_dialogs.c
index d188dc5..81beea4 100644
--- a/src/gtk-helpers/ask_dialogs.c
+++ b/src/gtk-helpers/ask_dialogs.c
@@ -81,8 +81,11 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
/* let's try to use the text as markup
* this allows us to use hyperlinks to man pages */
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), message);
- gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Yes"), GTK_RESPONSE_YES);
+ /* Follow GTK3's yes-no-buttons order:
+ * [No] [Yes]
+ */
GtkWidget *no_button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("_No"), GTK_RESPONSE_NO);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Yes"), GTK_RESPONSE_YES);
gint response = GTK_RESPONSE_NO;
g_signal_connect(G_OBJECT(dialog), "response",
@@ -101,6 +104,8 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
G_CALLBACK(on_toggle_ask_yes_no_yesforever_cb), (gpointer)no_button);
}
+ /* Esc -> No, Enter -> Yes */
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
gtk_widget_show(ask_yes_no_cb);
gtk_dialog_run(GTK_DIALOG(dialog));
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 197492a..1fbe290 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1635,6 +1635,7 @@ static char *ask_helper(const char *msg, void *args, bool password)
GTK_BUTTONS_OK_CANCEL,
"%s", msg);
char *tagged_msg = tag_url(msg, "\n");
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), tagged_msg);
free(tagged_msg);
@@ -1687,6 +1688,8 @@ static int run_event_gtk_ask_yes_no(const char *msg, void *args)
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), tagged_msg);
free(tagged_msg);
+ /* Esc -> No, Enter -> Yes */
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
const int ret = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES;
gtk_widget_destroy(dialog);
--
1.8.3.1

View File

@ -0,0 +1,240 @@
From 88ff2fcdf75ee9a44605847dc7e718cb7b5dedb2 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 30 Jul 2014 09:33:54 +0200
Subject: [LIBREPORT PATCH 48/93] gui: conver report-gtk to GtkApplication

- improves compatibility with GNOME
- allows us to move "Preferences" to the application menu

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/main.c | 60 ++++++++++++++++++++++++++++++++++++-----
src/gui-wizard-gtk/wizard.c | 26 ++++--------------
src/gui-wizard-gtk/wizard.glade | 39 ---------------------------
src/gui-wizard-gtk/wizard.h | 2 +-
4 files changed, 60 insertions(+), 67 deletions(-)

diff --git a/src/gui-wizard-gtk/main.c b/src/gui-wizard-gtk/main.c
index 0bfa45c..697b91f 100644
--- a/src/gui-wizard-gtk/main.c
+++ b/src/gui-wizard-gtk/main.c
@@ -72,6 +72,55 @@ void problem_data_reload_from_dump_dir(void)
g_cd = new_cd;
}
+static void
+preferences_activated(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ GtkApplication *app = GTK_APPLICATION(data);
+ show_config_list_dialog(GTK_WINDOW(gtk_application_get_active_window(app)));
+}
+
+static void
+quit_activated(GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ g_application_quit(G_APPLICATION(data));
+}
+
+static GActionEntry app_entries[] =
+{
+ { "preferences", preferences_activated, NULL, NULL, NULL },
+ { "quit", quit_activated, NULL, NULL, NULL }
+};
+
+static void
+startup_wizard(GApplication *app,
+ gpointer user_data)
+{
+ g_action_map_add_action_entries(G_ACTION_MAP (app),
+ app_entries, G_N_ELEMENTS (app_entries),
+ app);
+
+ GMenu *app_menu = g_menu_new();
+ g_menu_append(app_menu, _("Preferences"), "app.preferences");
+
+ GMenu *service_app_menu_sec = g_menu_new();
+ g_menu_append(service_app_menu_sec, _("Quit"), "app.quit");
+ g_menu_append_section(app_menu, /*no title*/NULL, G_MENU_MODEL(service_app_menu_sec));
+
+ gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL(app_menu));
+}
+
+static void
+activate_wizard(GApplication *app,
+ gpointer user_data)
+{
+ create_assistant(GTK_APPLICATION(app), (bool)user_data);
+ update_gui_state_from_problem_data(UPDATE_SELECTED_EVENT);
+}
+
int main(int argc, char **argv)
{
bool expert_mode = false;
@@ -166,14 +215,13 @@ int main(int argc, char **argv)
problem_data_reload_from_dump_dir();
- create_assistant(expert_mode);
-
g_custom_logger = &show_error_as_msgbox;
-
- update_gui_state_from_problem_data(UPDATE_SELECTED_EVENT);
-
+ GtkApplication *app = gtk_application_new("org.freedesktop.libreport.report", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect(app, "activate", G_CALLBACK(activate_wizard), (gpointer)expert_mode);
+ g_signal_connect(app, "startup", G_CALLBACK(startup_wizard), NULL);
/* Enter main loop */
- gtk_main();
+ g_application_run(G_APPLICATION(app), argc, argv);
+ g_object_unref(app);
if (opts & OPT_d)
delete_dump_dir_possibly_using_abrtd(g_dump_dir_name);
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 1fbe290..7cdd88b 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -2128,12 +2128,6 @@ static void on_log_changed(GtkTextBuffer *buffer, gpointer user_data)
gtk_widget_show(GTK_WIDGET(g_exp_report_log));
}
-
-static void on_show_event_list_cb(GtkWidget *button, gpointer user_data)
-{
- show_config_list_dialog(GTK_WINDOW(g_wnd_assistant));
-}
-
#if 0
static void log_ready_state(void)
{
@@ -3192,16 +3186,6 @@ static void add_pages(void)
gtk_widget_override_font(GTK_WIDGET(g_tv_event_log), g_monospace_font);
fix_all_wrapped_labels(GTK_WIDGET(g_assistant));
- /* Configure btn on select analyzers page */
- GtkWidget *img_config_btn = gtk_image_new_from_icon_name("preferences-system", GTK_ICON_SIZE_BUTTON);
- GtkWidget *config_btn = GTK_WIDGET(gtk_builder_get_object(g_builder, "button_cfg1"));
- if (config_btn)
- {
- g_signal_connect(G_OBJECT(config_btn), "clicked", G_CALLBACK(on_show_event_list_cb), NULL);
- gtk_button_set_image(GTK_BUTTON(config_btn), img_config_btn);
- gtk_button_set_image_position(GTK_BUTTON(config_btn), GTK_POS_RIGHT);
- }
-
g_signal_connect(g_cb_no_comment, "toggled", G_CALLBACK(on_no_comment_toggled), NULL);
g_signal_connect(g_rb_forbidden_words, "toggled", G_CALLBACK(on_forbidden_words_toggled), NULL);
@@ -3297,7 +3281,7 @@ static void assistant_quit_cb(void *obj, void *data)
g_loaded_texts = NULL;
}
- gtk_main_quit();
+ gtk_widget_destroy(GTK_WIDGET(data));
}
static void on_btn_startcast(GtkWidget *btn, gpointer user_data)
@@ -3353,7 +3337,7 @@ static bool is_screencast_available()
return status == 0;
}
-void create_assistant(bool expert_mode)
+void create_assistant(GtkApplication *app, bool expert_mode)
{
g_loaded_texts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
@@ -3429,7 +3413,7 @@ void create_assistant(bool expert_mode)
gtk_widget_hide(g_btn_onfail);
gtk_widget_show(g_btn_next);
- g_wnd_assistant = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
+ g_wnd_assistant = GTK_WINDOW(gtk_application_window_new(app));
gtk_container_add(GTK_CONTAINER(g_wnd_assistant), GTK_WIDGET(g_box_assistant));
gtk_window_set_default_size(g_wnd_assistant, DEFAULT_WIDTH, DEFAULT_HEIGHT);
@@ -3444,12 +3428,12 @@ void create_assistant(bool expert_mode)
create_details_treeview();
- g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), NULL);
+ g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
g_signal_connect(g_btn_stop, "clicked", G_CALLBACK(on_btn_cancel_event), NULL);
g_signal_connect(g_btn_onfail, "clicked", G_CALLBACK(on_btn_failed_cb), NULL);
g_signal_connect(g_btn_next, "clicked", G_CALLBACK(on_next_btn_cb), NULL);
- g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), NULL);
+ g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
g_signal_connect(g_assistant, "switch-page", G_CALLBACK(on_page_prepare), NULL);
g_signal_connect(g_tb_approve_bt, "toggled", G_CALLBACK(on_bt_approve_toggle), NULL);
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
index 9a179f4..9296bca 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -430,45 +430,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="button_cfg1">
- <property name="label">_Preferences</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
</child>
</object>
diff --git a/src/gui-wizard-gtk/wizard.h b/src/gui-wizard-gtk/wizard.h
index a6d8b5d..4c891dc 100644
--- a/src/gui-wizard-gtk/wizard.h
+++ b/src/gui-wizard-gtk/wizard.h
@@ -21,7 +21,7 @@
#include "internal_libreport_gtk.h"
-void create_assistant(bool expert_mode);
+void create_assistant(GtkApplication *app, bool expert_mode);
enum
{
--
1.8.3.1

View File

@ -0,0 +1,54 @@
From 567dd27e9b3e9098927923bf8c0c4c3a71307660 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 30 Jul 2014 13:44:02 +0200
Subject: [LIBREPORT PATCH 49/93] gui: clear the sensitive cache between two
event runs

Was causing a SIGSEGV.

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 7cdd88b..3dcc756 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1166,6 +1166,31 @@ static void remove_tabs_from_notebook(GtkNotebook *notebook)
*/
gtk_notebook_remove_page(notebook, 0); //we need to always the page 0
}
+
+ /* Turn off the changed callback during the update */
+ g_signal_handler_block(g_tv_sensitive_sel, g_tv_sensitive_sel_hndlr);
+
+ g_current_highlighted_word = NULL;
+
+ GtkTreeIter iter;
+ gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_sensitive_list), &iter);
+ while (valid)
+ {
+ char *text = NULL;
+ search_item_t *word = NULL;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(g_ls_sensitive_list), &iter,
+ SEARCH_COLUMN_TEXT, &text,
+ SEARCH_COLUMN_ITEM, &word,
+ -1);
+
+ free(text);
+ free(word);
+
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(g_ls_sensitive_list), &iter);
+ }
+ gtk_list_store_clear(g_ls_sensitive_list);
+ g_signal_handler_unblock(g_tv_sensitive_sel, g_tv_sensitive_sel_hndlr);
}
static void append_item_to_ls_details(gpointer name, gpointer value, gpointer data)
--
1.8.3.1

View File

@ -0,0 +1,55 @@
From 66abae485c6028345f21e80803e093a4dda292b3 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 30 Jul 2014 13:46:57 +0200
Subject: [LIBREPORT PATCH 50/93] gui: don't remove already removed
GTimeoutSource

Was causing a GLib warning

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 3dcc756..492feed 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -2911,17 +2911,20 @@ static void on_sensitive_word_selection_changed(GtkTreeSelection *sel, gpointer
gtk_text_view_scroll_to_iter(new_word->tev, &(new_word->start), 0.0, false, 0, 0);
}
-static gboolean highlight_search(gpointer user_data)
+static void highlight_search(GtkEntry *entry)
{
- GtkEntry *entry = GTK_ENTRY(user_data);
-
g_search_text = gtk_entry_get_text(entry);
log_notice("searching: '%s'", g_search_text);
GList *words = g_list_append(NULL, (gpointer)g_search_text);
highligh_words_in_tabs(words, NULL);
g_list_free(words);
+}
+static gboolean highlight_search_on_timeout(gpointer user_data)
+{
+ g_timeout = 0;
+ highlight_search(GTK_ENTRY(user_data));
/* returning false will make glib to remove this event */
return false;
}
@@ -2935,7 +2938,7 @@ static void search_timeout(GtkEntry *entry)
*/
if (g_timeout != 0)
g_source_remove(g_timeout);
- g_timeout = g_timeout_add(500, &highlight_search, (gpointer)entry);
+ g_timeout = g_timeout_add(500, &highlight_search_on_timeout, (gpointer)entry);
}
static void on_forbidden_words_toggled(GtkToggleButton *btn, gpointer user_data)
--
1.8.3.1

View File

@ -0,0 +1,130 @@
From 3abbb4c7324fff37189b632f7522385a001e16a0 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 30 Jul 2014 13:48:59 +0200
Subject: [LIBREPORT PATCH 51/93] gui: reload destroyed sensitive data warn
widgets from the galde

clear_warnings() destroys the warning widgets. The sensitive data
widgets needs to be reloaded as GtkBuilder does not return clones of
object but the instances from its cache.

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 75 +++++++++++++++++++++++++++------------------
1 file changed, 46 insertions(+), 29 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 492feed..d7d1a78 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -229,6 +229,45 @@ static bool check_minimal_bt_rating(const char *event_name);
static char *get_next_processed_event(GList **events_list);
static void on_next_btn_cb(GtkWidget *btn, gpointer user_data);
+/* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */
+#include "wizard_glade.c"
+
+static GtkBuilder *make_builder()
+{
+ GError *error = NULL;
+ GtkBuilder *builder = gtk_builder_new();
+ if (!g_glade_file)
+ {
+ /* load additional widgets from glade */
+ gtk_builder_add_objects_from_string(builder,
+ WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
+ (gchar**)misc_widgets,
+ &error);
+ if (error != NULL)
+ error_msg_and_die("Error loading glade data: %s", error->message);
+ /* Load pages from internal string */
+ gtk_builder_add_objects_from_string(builder,
+ WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
+ (gchar**)page_names,
+ &error);
+ if (error != NULL)
+ error_msg_and_die("Error loading glade data: %s", error->message);
+ }
+ else
+ {
+ /* -g FILE: load UI from it */
+ /* load additional widgets from glade */
+ gtk_builder_add_objects_from_file(builder, g_glade_file, (gchar**)misc_widgets, &error);
+ if (error != NULL)
+ error_msg_and_die("Can't load %s: %s", g_glade_file, error->message);
+ gtk_builder_add_objects_from_file(builder, g_glade_file, (gchar**)page_names, &error);
+ if (error != NULL)
+ error_msg_and_die("Can't load %s: %s", g_glade_file, error->message);
+ }
+
+ return builder;
+}
+
static void label_wrapper(GtkWidget *widget, gpointer data_unused)
{
if (GTK_IS_CONTAINER(widget))
@@ -2062,11 +2101,15 @@ static void on_sensitive_ticket_clicked_cb(GtkWidget *button, gpointer user_data
static void add_sensitive_data_warning(void)
{
- GtkWidget *sens_data_warn = GTK_WIDGET(gtk_builder_get_object(g_builder, SENSITIVE_DATA_WARN));
- GtkButton *sens_ticket_cb = GTK_BUTTON(gtk_builder_get_object(g_builder, PRIVATE_TICKET_CB));
+ GtkBuilder *builder = make_builder();
+
+ GtkWidget *sens_data_warn = GTK_WIDGET(gtk_builder_get_object(builder, SENSITIVE_DATA_WARN));
+ GtkButton *sens_ticket_cb = GTK_BUTTON(gtk_builder_get_object(builder, PRIVATE_TICKET_CB));
g_signal_connect(sens_ticket_cb, "toggled", G_CALLBACK(on_sensitive_ticket_clicked_cb), NULL);
add_widget_to_warning_area(GTK_WIDGET(sens_data_warn));
+
+ g_object_unref(builder);
}
static void show_warnings(void)
@@ -3128,9 +3171,6 @@ static gint on_key_press_event_in_item_list(GtkTreeView *treeview, GdkEventKey *
/* Initialization */
-/* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */
-#include "wizard_glade.c"
-
static void on_next_btn_cb(GtkWidget *btn, gpointer user_data)
{
gint current_page_no = gtk_notebook_get_current_page(g_assistant);
@@ -3145,30 +3185,7 @@ static void on_next_btn_cb(GtkWidget *btn, gpointer user_data)
static void add_pages(void)
{
- GError *error = NULL;
- g_builder = gtk_builder_new();
- if (!g_glade_file)
- {
- /* load additional widgets from glade */
- gtk_builder_add_objects_from_string(g_builder,
- WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
- (gchar**)misc_widgets,
- &error);
- /* Load pages from internal string */
- gtk_builder_add_objects_from_string(g_builder,
- WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
- (gchar**)page_names,
- &error);
- if (error != NULL)
- error_msg_and_die("Error loading glade data: %s", error->message);
- }
- else
- {
- /* -g FILE: load IU from it */
- gtk_builder_add_objects_from_file(g_builder, g_glade_file, (gchar**)page_names, &error);
- if (error != NULL)
- error_msg_and_die("Can't load %s: %s", g_glade_file, error->message);
- }
+ g_builder = make_builder();
int i;
int page_no = 0;
--
1.8.3.1

View File

@ -0,0 +1,249 @@
From b801cc0c8b951534990ed884360d13a6f27154e0 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 30 Jul 2014 13:53:02 +0200
Subject: [LIBREPORT PATCH 52/93] gui: add "Repeat" button

If an event run fails, the button allows users to modify the
configuration and re-run the event.

v2:
- add a help text explaining what to do before clicking "Repeat" button

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/gui-wizard-gtk/wizard.c
---
src/gui-wizard-gtk/wizard.c | 80 +++++++++++++++++++++++++++++++++++----------
1 file changed, 62 insertions(+), 18 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index d7d1a78..d62ac04 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -68,6 +68,7 @@ static GtkWidget *g_btn_stop;
static GtkWidget *g_btn_close;
static GtkWidget *g_btn_next;
static GtkWidget *g_btn_onfail;
+static GtkWidget *g_btn_repeat;
static GtkBox *g_box_events;
static GtkBox *g_box_workflows;
@@ -1602,7 +1603,7 @@ static void hide_next_step_button()
/* 1. hide next button */
gtk_widget_hide(g_btn_next);
/* 2. move close button to the last position */
- gtk_box_reorder_child(g_box_buttons, g_btn_close, 3);
+ gtk_box_reorder_child(g_box_buttons, g_btn_close, 4);
}
static void show_next_step_button()
@@ -1611,24 +1612,31 @@ static void show_next_step_button()
gtk_widget_show(g_btn_next);
}
-static void terminate_event_chain()
+enum {
+ TERMINATE_NOFLAGS = 0,
+ TERMINATE_WITH_RERUN = 1 << 0,
+};
+
+static void terminate_event_chain(int flags)
{
if (g_expert_mode)
return;
+ hide_next_step_button();
+ if ((flags & TERMINATE_WITH_RERUN))
+ return;
+
free(g_event_selected);
g_event_selected = NULL;
g_list_free_full(g_auto_event_list, free);
g_auto_event_list = NULL;
-
- hide_next_step_button();
}
-static void cancel_processing(GtkLabel *status_label, const char *message)
+static void cancel_processing(GtkLabel *status_label, const char *message, int terminate_flags)
{
gtk_label_set_text(status_label, message ? message : _("Processing was canceled"));
- terminate_event_chain();
+ terminate_event_chain(terminate_flags);
}
static void update_command_run_log(const char* message, struct analyze_event_data *evd)
@@ -1793,6 +1801,25 @@ static void on_btn_failed_cb(GtkButton *button)
gtk_widget_hide(GTK_WIDGET(button));
}
+static gint select_next_page_no(gint current_page_no, gpointer data);
+static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer user_data);
+
+static void on_btn_repeat_cb(GtkButton *button)
+{
+ g_auto_event_list = g_list_prepend(g_auto_event_list, g_event_selected);
+ g_event_selected = NULL;
+
+ show_next_step_button();
+ clear_warnings();
+
+ const gint current_page_no = gtk_notebook_get_current_page(g_assistant);
+ const int next_page_no = select_next_page_no(pages[PAGENO_SUMMARY].page_no, NULL);
+ if (current_page_no == next_page_no)
+ on_page_prepare(g_assistant, gtk_notebook_get_nth_page(g_assistant, next_page_no), NULL);
+ else
+ gtk_notebook_set_current_page(g_assistant, next_page_no);
+}
+
static void on_failed_event(const char *event_name)
{
/* Don't show the 'on failure' button if the processed event
@@ -1802,9 +1829,20 @@ static void on_failed_event(const char *event_name)
return;
add_warning(
-_("Processing of the problem failed. This can have many reasons but there are two most common:\n"\
+_("Processing of the problem failed. This can have many reasons but there are three most common:\n"\
"\t▫ <b>network connection problems</b>\n"\
-"\t▫ <b>corrupted problem data</b>\n"));
+"\t▫ <b>corrupted problem data</b>\n"\
+"\t▫ <b>invalid configuration</b>"
+));
+
+ if (!g_expert_mode)
+ {
+ add_warning(
+_("If you want to update the configuration and try to report again, please open <b>Preferences</b> item\n"
+"in the application menu and after applying the configuration changes click <b>Repeat</b> button."));
+
+ gtk_widget_show(g_btn_repeat);
+ }
show_warnings();
}
@@ -1829,7 +1867,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
retval = 0;
run_state->process_status = 0;
stop_requested = true;
- terminate_event_chain();
+ terminate_event_chain(TERMINATE_NOFLAGS);
}
unexport_event_config(evd->env_list);
@@ -1918,17 +1956,17 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
gtk_widget_show(GTK_WIDGET(g_img_process_fail));
/* 256 means NOT_REPORTABLE */
if (retval == 256)
- cancel_processing(g_lbl_event_log, _("Processing was interrupted because the problem is not reportable."));
+ cancel_processing(g_lbl_event_log, _("Processing was interrupted because the problem is not reportable."), TERMINATE_NOFLAGS);
else
{
/* We use SIGTERM to stop event processing on user's request.
* So SIGTERM is not a failure.
*/
if (retval == EXIT_CANCEL_BY_USER || WTERMSIG(run_state->process_status) == SIGTERM)
- cancel_processing(g_lbl_event_log, /* default message */ NULL);
+ cancel_processing(g_lbl_event_log, /* default message */ NULL, TERMINATE_NOFLAGS);
else
{
- cancel_processing(g_lbl_event_log, _("Processing failed."));
+ cancel_processing(g_lbl_event_log, _("Processing failed."), TERMINATE_WITH_RERUN);
on_failed_event(evd->event_name);
}
}
@@ -1995,7 +2033,7 @@ static void start_event_run(const char *event_name)
char *msg = xasprintf(_("No processing for event '%s' is defined"), event_name);
append_to_textview(g_tv_event_log, msg);
free(msg);
- cancel_processing(g_lbl_event_log, _("Processing failed."));
+ cancel_processing(g_lbl_event_log, _("Processing failed."), TERMINATE_NOFLAGS);
return;
}
@@ -2006,7 +2044,7 @@ static void start_event_run(const char *event_name)
free_run_event_state(state);
if (!g_expert_mode)
{
- cancel_processing(g_lbl_event_log, _("Processing interrupted: can't continue without writable directory."));
+ cancel_processing(g_lbl_event_log, _("Processing interrupted: can't continue without writable directory."), TERMINATE_NOFLAGS);
}
return; /* user refused to steal, or write error, etc... */
}
@@ -2484,8 +2522,6 @@ static gboolean highlight_forbidden(void)
return result;
}
-static gint select_next_page_no(gint current_page_no, gpointer data);
-
static char *get_next_processed_event(GList **events_list)
{
if (!events_list || !*events_list)
@@ -2597,6 +2633,8 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
}
gtk_widget_hide(g_btn_onfail);
+ if (!g_expert_mode)
+ gtk_widget_hide(g_btn_repeat);
/* Save text fields if changed */
/* Must be called before any GUI operation because the following two
* functions causes recreating of the text items tabs, thus all updates to
@@ -2815,7 +2853,7 @@ static gint select_next_page_no(gint current_page_no, gpointer data)
{
free(event);
- cancel_processing(g_lbl_event_log, /* default message */ NULL);
+ cancel_processing(g_lbl_event_log, /* default message */ NULL, TERMINATE_NOFLAGS);
current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1;
goto again;
}
@@ -2828,7 +2866,7 @@ static gint select_next_page_no(gint current_page_no, gpointer data)
"(it is likely a known problem). %s"),
problem_data_get_content_or_NULL(g_cd, FILENAME_NOT_REPORTABLE)
);
- cancel_processing(g_lbl_event_log, msg);
+ cancel_processing(g_lbl_event_log, msg, TERMINATE_NOFLAGS);
free(msg);
current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1;
goto again;
@@ -3408,6 +3446,9 @@ void create_assistant(GtkApplication *app, bool expert_mode)
g_btn_onfail = gtk_button_new_with_label(_("Upload for analysis"));
gtk_button_set_image(GTK_BUTTON(g_btn_onfail), gtk_image_new_from_icon_name("go-up", GTK_ICON_SIZE_BUTTON));
gtk_widget_set_no_show_all(g_btn_onfail, true); /* else gtk_widget_hide won't work */
+ g_btn_repeat = gtk_button_new_with_label(_("Repeat"));
+ gtk_button_set_image(GTK_BUTTON(g_btn_repeat), gtk_image_new_from_icon_name("view-refresh", GTK_ICON_SIZE_BUTTON));
+ gtk_widget_set_no_show_all(g_btn_repeat, true); /* else gtk_widget_hide won't work */
g_btn_next = gtk_button_new_with_mnemonic(_("_Forward"));
gtk_button_set_image(GTK_BUTTON(g_btn_next), gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_BUTTON));
gtk_widget_set_no_show_all(g_btn_next, true); /* else gtk_widget_hide won't work */
@@ -3416,6 +3457,7 @@ void create_assistant(GtkApplication *app, bool expert_mode)
gtk_box_pack_start(g_box_buttons, g_btn_close, false, false, 5);
gtk_box_pack_start(g_box_buttons, g_btn_stop, false, false, 5);
gtk_box_pack_start(g_box_buttons, g_btn_onfail, false, false, 5);
+ gtk_box_pack_start(g_box_buttons, g_btn_repeat, false, false, 5);
/* Btns above are to the left, the rest are to the right: */
GtkWidget *w = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
gtk_box_pack_start(g_box_buttons, w, true, true, 5);
@@ -3456,6 +3498,7 @@ void create_assistant(GtkApplication *app, bool expert_mode)
gtk_widget_show_all(GTK_WIDGET(g_box_buttons));
gtk_widget_hide(g_btn_stop);
gtk_widget_hide(g_btn_onfail);
+ gtk_widget_hide(g_btn_repeat);
gtk_widget_show(g_btn_next);
g_wnd_assistant = GTK_WINDOW(gtk_application_window_new(app));
@@ -3476,6 +3519,7 @@ void create_assistant(GtkApplication *app, bool expert_mode)
g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
g_signal_connect(g_btn_stop, "clicked", G_CALLBACK(on_btn_cancel_event), NULL);
g_signal_connect(g_btn_onfail, "clicked", G_CALLBACK(on_btn_failed_cb), NULL);
+ g_signal_connect(g_btn_repeat, "clicked", G_CALLBACK(on_btn_repeat_cb), NULL);
g_signal_connect(g_btn_next, "clicked", G_CALLBACK(on_next_btn_cb), NULL);
g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 12b5ce27389c9adc3c3fdfb82a66b849954f8712 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 26 Aug 2014 12:51:19 +0200
Subject: [LIBREPORT PATCH 53/93] wizard: terminate event chain after the
emergency analysis

Resolves rhbz#1133549
Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index d62ac04..caae1d2 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1790,6 +1790,16 @@ static bool event_need_review(const char *event_name)
static void on_btn_failed_cb(GtkButton *button)
{
+ /* Since the Repeat button has been introduced, the event chain isn't
+ * terminated upon a failure in order to be able to continue in processing
+ * in the retry action.
+ *
+ * Now, user decided to run the emergency analysis instead of trying to
+ * reconfigure libreport, so we have to terminate the event chain.
+ */
+ gtk_widget_hide(g_btn_repeat);
+ terminate_event_chain(TERMINATE_NOFLAGS);
+
/* Show detailed log */
gtk_expander_set_expanded(g_exp_report_log, TRUE);
--
1.8.3.1

View File

@ -0,0 +1,113 @@
From 112707bca6fe720422248f74127cf301d0adb799 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 28 Aug 2014 12:22:39 +0200
Subject: [LIBREPORT PATCH 54/93] wizard: don't work with destroyed widgets

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/gui-wizard-gtk/wizard.c
---
src/gui-wizard-gtk/wizard.c | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index caae1d2..71964a9 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -57,6 +57,7 @@ static char *g_event_selected;
static unsigned g_black_event_count = 0;
static pid_t g_event_child_pid = 0;
+static guint g_event_source_id = 0;
static bool g_expert_mode;
@@ -1586,10 +1587,18 @@ static void update_event_log_on_disk(const char *str)
dd_close(dd);
}
+static bool cancel_event_run()
+{
+ if (g_event_child_pid <= 0)
+ return false;
+
+ kill(- g_event_child_pid, SIGTERM);
+ return true;
+}
+
static void on_btn_cancel_event(GtkButton *button)
{
- if (g_event_child_pid > 0)
- kill(- g_event_child_pid, SIGTERM);
+ cancel_event_run();
}
static bool is_processing_finished()
@@ -1987,8 +1996,10 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
: _("Processing finished, please proceed to the next step."));
}
- /*g_source_remove(evd->event_source_id);*/
+ g_source_remove(g_event_source_id);
+ g_event_source_id = 0;
close(evd->fd);
+ g_io_channel_unref(evd->channel);
free_run_event_state(evd->run_state);
strbuf_free(evd->event_log);
free(evd->event_name);
@@ -2085,7 +2096,7 @@ static void start_event_run(const char *event_name)
ndelay_on(evd->fd);
evd->channel = g_io_channel_unix_new(evd->fd);
- /*evd->event_source_id = */ g_io_add_watch(evd->channel,
+ g_event_source_id = g_io_add_watch(evd->channel,
G_IO_IN | G_IO_ERR | G_IO_HUP, /* need HUP to detect EOF w/o any data */
consume_cmd_output,
evd
@@ -3368,13 +3379,23 @@ static void init_pages(void)
static void assistant_quit_cb(void *obj, void *data)
{
+ /* Suppress execution of consume_cmd_output() */
+ if (g_event_source_id != 0)
+ {
+ g_source_remove(g_event_source_id);
+ g_event_source_id = 0;
+ }
+
+ cancel_event_run();
+
if (g_loaded_texts)
{
g_hash_table_destroy(g_loaded_texts);
g_loaded_texts = NULL;
}
- gtk_widget_destroy(GTK_WIDGET(data));
+ gtk_widget_destroy(GTK_WIDGET(g_wnd_assistant));
+ g_wnd_assistant = (void *)0xdeadbeaf;
}
static void on_btn_startcast(GtkWidget *btn, gpointer user_data)
@@ -3526,13 +3547,13 @@ void create_assistant(GtkApplication *app, bool expert_mode)
create_details_treeview();
- g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
+ g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), NULL);
g_signal_connect(g_btn_stop, "clicked", G_CALLBACK(on_btn_cancel_event), NULL);
g_signal_connect(g_btn_onfail, "clicked", G_CALLBACK(on_btn_failed_cb), NULL);
g_signal_connect(g_btn_repeat, "clicked", G_CALLBACK(on_btn_repeat_cb), NULL);
g_signal_connect(g_btn_next, "clicked", G_CALLBACK(on_next_btn_cb), NULL);
- g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
+ g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), NULL);
g_signal_connect(g_assistant, "switch-page", G_CALLBACK(on_page_prepare), NULL);
g_signal_connect(g_tb_approve_bt, "toggled", G_CALLBACK(on_bt_approve_toggle), NULL);
--
1.8.3.1

View File

@ -0,0 +1,130 @@
From 2ca8777fa697d5beed91a7b7f2bdc2bb9b5578ce Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 23 Jul 2014 10:59:55 +0200
Subject: [LIBREPORT PATCH 55/93] report: parse release/version from os-release

Related to rhbz#1101240

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/report-python/__init__.py | 69 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 61 insertions(+), 8 deletions(-)

diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
index c11b000..b434672 100644
--- a/src/report-python/__init__.py
+++ b/src/report-python/__init__.py
@@ -23,6 +23,9 @@ import os
SYSTEM_RELEASE_PATHS = ["/etc/system-release","/etc/redhat-release"]
SYSTEM_RELEASE_DEPS = ["system-release", "redhat-release"]
+SYSTEM_OS_RELEASE_FILE = "/etc/os-release"
+OS_RELEASE_PRODUCT_FIELDS = ["REDHAT_BUGZILLA_PRODUCT", "REDHAT_SUPPORT_PRODUCT", "NAME"]
+OS_RELEASE_VERSION_FIELDS = ["REDHAT_BUGZILLA_VERSION", "REDHAT_SUPPORT_VERSION", "NAME"]
_hardcoded_default_product = ""
_hardcoded_default_version = ""
@@ -57,6 +60,57 @@ def getVersion_fromRPM():
return ""
"""
+def parse_os_release_lines(osreleaselines):
+ osrel = {}
+
+ for line in osreleaselines:
+ kvp = line.split('=')
+ if len(kvp) < 2:
+ continue
+
+ key = kvp[0]
+ value = kvp[1]
+ if len(kvp) > 2:
+ value = "=".join(kvp[1:])
+
+ if value:
+ osrel[key] = value.strip('"')
+ else:
+ osrel[key] = value
+
+ return osrel
+
+# /etc/os-release file parser
+# see man os-release
+def parse_os_release_file(filepath):
+ osrel = {}
+ try:
+ with open(filepath) as osrelfil:
+ osrel = parse_os_release_lines(osrelfil)
+ except IOError as ex:
+ # I am sorry, but we do not support logging here :(
+ pass
+
+ return osrel
+
+def getProduct_fromOSRELEASE(file_path=SYSTEM_OS_RELEASE_FILE):
+ osrel = parse_os_release_file(file_path)
+
+ for pf in OS_RELEASE_PRODUCT_FIELDS:
+ if pf in osrel:
+ return osrel[pf]
+
+ return None
+
+def getVersion_fromOSRELEASE(file_path=SYSTEM_OS_RELEASE_FILE):
+ osrel = parse_os_release_file(file_path)
+
+ for vf in OS_RELEASE_VERSION_FIELDS:
+ if vf in osrel:
+ return osrel[vf]
+
+ return None
+
def getProduct_fromFILE():
for each_path in SYSTEM_RELEASE_PATHS:
if os.path.exists(each_path):
@@ -69,7 +123,6 @@ def getProduct_fromFILE():
content = file.read()
if content.startswith("Red Hat Enterprise Linux"):
return "Red Hat Enterprise Linux"
-
if content.startswith("Fedora"):
return "Fedora"
@@ -92,11 +145,11 @@ def getVersion_fromFILE():
if content.find("Rawhide") > -1:
return "rawhide"
- clist = content.split(" ")
- i = clist.index("release")
- return clist[i+1]
- else:
- return ""
+ i = content.find(" release")
+ if i > -1:
+ return content[i + len(" release"):]
+
+ return ""
def getProduct_fromPRODUCT():
try:
@@ -127,7 +180,7 @@ def getProduct():
asking anaconda
Always return as a string.
"""
- for getter in (getProduct_fromFILE, getProduct_fromPRODUCT):
+ for getter in (getProduct_fromOSRELEASE, getProduct_fromFILE, getProduct_fromPRODUCT):
product = getter()
if product:
return product
@@ -140,7 +193,7 @@ def getVersion():
asking anaconda
Always return as a string.
"""
- for getter in (getVersion_fromFILE, getVersion_fromPRODUCT):
+ for getter in (getVersion_fromOSRELEASE, getVersion_fromFILE, getVersion_fromPRODUCT):
version = getter()
if version:
return version
--
1.8.3.1

View File

@ -0,0 +1,162 @@
From e1a064810f56b34d78ca9d000120b8a93323b501 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 23 Jul 2014 11:00:28 +0200
Subject: [LIBREPORT PATCH 56/93] testsuite: report python sanity tests

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
tests/Makefile.am | 3 ++-
tests/local.at | 13 +++++++++++++
tests/osinfo.at | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/report_python.at | 33 ++++++++++++++++++++++++++++++++
tests/testsuite.at | 1 +
5 files changed, 101 insertions(+), 1 deletion(-)
create mode 100644 tests/report_python.at

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8ec40e1..750fa16 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -38,7 +38,8 @@ TESTSUITE_AT = \
reported_to.at \
make_description.at \
libreport_types.at \
- xml_definition.at
+ xml_definition.at \
+ report_python.at
EXTRA_DIST += $(TESTSUITE_AT)
TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/local.at b/tests/local.at
index 758906d..b5fae97 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -24,4 +24,17 @@ AT_COMPILE([$1])
AT_CHECK([./$1], 0, [ignore], [ignore])
AT_CLEANUP])
+# ------------------------
+# AT_PYTESTFUN(NAME, SOURCE)
+# ------------------------
+
+# Create a test named NAME by running Python file with contents SOURCE. The
+# stdout and stderr output of the Python program is ignored by Autotest.
+
+m4_define([AT_PYTESTFUN],
+[AT_SETUP([$1])
+AT_DATA([$1], [$2])
+AT_CHECK([PYTHONPATH=../../../src python ./$1], 0, [ignore], [ignore])
+AT_CLEANUP])
+
AT_INIT
diff --git a/tests/osinfo.at b/tests/osinfo.at
index 529ca13..b57452d 100644
--- a/tests/osinfo.at
+++ b/tests/osinfo.at
@@ -393,3 +393,55 @@ int main(void)
return 0;
}
]])
+
+## ------------------- ##
+## parse_osinfo_python ##
+## ------------------- ##
+
+AT_PYTESTFUN([parse_osinfo_python],
+[[import sys
+
+sys.path.insert(0, "../../../src/report-python/.libs")
+
+report = __import__("report-python", globals(), locals(), [], -1)
+sys.modules["report"] = report
+
+lines = [
+ 'NAME=fedora',
+ 'VERSION="20 (Heisenbug)"',
+ 'ID=fedora',
+ 'VERSION_ID=20',
+ 'PRETTY_NAME="Fedora 20 (Heisenbug)"',
+ 'ANSI_COLOR="0;34"',
+ 'CPE_NAME="cpe:/o:fedoraproject:fedora:20"',
+ 'HOME_URL="https://fedoraproject.org/"',
+ 'BUG_REPORT_URL="https://bugzilla.redhat.com/"',
+ 'REDHAT_BUGZILLA_PRODUCT="Fedora"',
+ 'REDHAT_BUGZILLA_PRODUCT_VERSION=20',
+ 'REDHAT_SUPPORT_PRODUCT="Fedora"',
+ 'REDHAT_SUPPORT_PRODUCT_VERSION=20',
+]
+
+expected = {
+ 'NAME':'fedora',
+ 'VERSION':'20 (Heisenbug)',
+ 'ID':'fedora',
+ 'VERSION_ID':'20',
+ 'PRETTY_NAME':'Fedora 20 (Heisenbug)',
+ 'ANSI_COLOR':'0;34',
+ 'CPE_NAME':'cpe:/o:fedoraproject:fedora:20',
+ 'HOME_URL':'https://fedoraproject.org/',
+ 'BUG_REPORT_URL':'https://bugzilla.redhat.com/',
+ 'REDHAT_BUGZILLA_PRODUCT':'Fedora',
+ 'REDHAT_BUGZILLA_PRODUCT_VERSION':'20',
+ 'REDHAT_SUPPORT_PRODUCT':'Fedora',
+ 'REDHAT_SUPPORT_PRODUCT_VERSION':'20'
+}
+
+osrel = report.parse_os_release_lines(lines)
+
+print sorted(expected.items())
+print sorted(osrel.items())
+
+sys.exit(not bool(osrel == expected))
+]])
diff --git a/tests/report_python.at b/tests/report_python.at
new file mode 100644
index 0000000..17e4fb3
--- /dev/null
+++ b/tests/report_python.at
@@ -0,0 +1,33 @@
+# -*- Autotest -*-
+
+AT_BANNER([report_python])
+
+## ----------------------- ##
+## get_from_etc_os_release ##
+## ----------------------- ##
+
+AT_PYTESTFUN([get_from_etc_os_release],
+[[import sys
+
+sys.path.insert(0, "../../../src/report-python/.libs")
+
+report = __import__("report-python", globals(), locals(), [], -1)
+sys.modules["report"] = report
+
+import os
+
+if not os.path.exists("/etc/os-release"):
+ print "Cannot run the test: '/etc/os-release' does not exist"
+ sys.exit(1)
+
+exit_code = 0
+if report.getProduct_fromOSRELEASE() != report.getProduct():
+ print "getProduct() did not return PRODUCT from /etc/os-release"
+ exit_code += 1
+
+if report.getVersion_fromOSRELEASE() != report.getVersion():
+ print "getVersion() did not return PRODUCT from /etc/os-release"
+ exit_code += 1
+
+sys.exit(exit_code)
+]])
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 97b2442..a569457 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -13,3 +13,4 @@ m4_include([reported_to.at])
m4_include([make_description.at])
m4_include([libreport_types.at])
m4_include([xml_definition.at])
+m4_include([report_python.at])
--
1.8.3.1

View File

@ -0,0 +1,64 @@
From 3fb19efcf2d64ab628c706c08f536f4cac72fb70 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 3 Sep 2014 13:38:46 +0200
Subject: [LIBREPORT PATCH 57/93] testsuite: work around the issue with
'report-python'

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/report-python/__init__.py
---
src/report-python/__init__.py | 10 +++++++++-
tests/osinfo.at | 1 +
tests/report_python.at | 1 +
3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
index b434672..b0ba497 100644
--- a/src/report-python/__init__.py
+++ b/src/report-python/__init__.py
@@ -13,7 +13,15 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from _pyreport import *
-from report.io import TextIO, GTKIO, NewtIO
+
+try:
+ from report.io import TextIO, GTKIO, NewtIO
+except ImportError:
+ # Support testing
+ _temp = __import__("io", globals(), locals(), ["TextIO", "GTKIO", "NewtIO"], -1)
+ TextIO = _temp.TextIO
+ GTKIO = _temp.GTKIO
+ NewtIO = _temp.NewtIO
#Compatibility with report package:
# Author(s): Gavin Romig-Koch <gavin@redhat.com>
diff --git a/tests/osinfo.at b/tests/osinfo.at
index b57452d..868a9a2 100644
--- a/tests/osinfo.at
+++ b/tests/osinfo.at
@@ -401,6 +401,7 @@ int main(void)
AT_PYTESTFUN([parse_osinfo_python],
[[import sys
+sys.path.insert(0, "../../../src/report-python")
sys.path.insert(0, "../../../src/report-python/.libs")
report = __import__("report-python", globals(), locals(), [], -1)
diff --git a/tests/report_python.at b/tests/report_python.at
index 17e4fb3..5569b1f 100644
--- a/tests/report_python.at
+++ b/tests/report_python.at
@@ -9,6 +9,7 @@ AT_BANNER([report_python])
AT_PYTESTFUN([get_from_etc_os_release],
[[import sys
+sys.path.insert(0, "../../../src/report-python")
sys.path.insert(0, "../../../src/report-python/.libs")
report = __import__("report-python", globals(), locals(), [], -1)
--
1.8.3.1

View File

@ -0,0 +1,59 @@
From 095336cfcca370a4d49e0d22049420019c72f25f Mon Sep 17 00:00:00 2001
From: Matej Habrnal <matejhabrnal@gmail.com>
Date: Thu, 4 Sep 2014 05:19:41 -0400
Subject: [LIBREPORT PATCH 58/93] testsuite: add test not-reportable

Testing make_description to print not-reportable.
---
tests/make_description.at | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

diff --git a/tests/make_description.at b/tests/make_description.at
index 87c1fd4..7415cf8 100644
--- a/tests/make_description.at
+++ b/tests/make_description.at
@@ -188,3 +188,41 @@ int main(int argc, char **argv)
return 0;
}
]])
+
+## -------------- ##
+## not_reportable ##
+## -------------- ##
+
+AT_TESTFUN([not_reportable],
+[[
+
+#include "internal_libreport.h"
+#include <assert.h>
+int main(int argc, char **argv)
+{
+ g_verbose = 3;
+
+ problem_data_t *pd = problem_data_new();
+
+ problem_data_add_text_noteditable(pd, FILENAME_NOT_REPORTABLE, "not-reportable");
+
+ char *description = make_description(pd, /*skipped names*/NULL, CD_MAX_TEXT_SIZE,
+ MAKEDESC_SHOW_URLS);
+
+ char *expected = xasprintf("%s: %*s%s\n",
+ "Reported", 14 - strlen("Reported"), "", "cannot be reported");
+
+ if (strstr(description, expected) == NULL)
+ {
+ printf("E:\n'%s'\n\nC:\n'%s'\n", expected, description);
+ assert(!"The description for not-reportable do not matches the expected description");
+ }
+
+ free(description);
+ free(expected);
+ problem_data_free(pd);
+
+ return 0;
+}
+
+]])
--
1.8.3.1

View File

@ -0,0 +1,79 @@
From 2c4f3128fe66634f0239e307ed686f87340f0655 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <matejhabrnal@gmail.com>
Date: Thu, 4 Sep 2014 05:27:42 -0400
Subject: [LIBREPORT PATCH 59/93] lib: make_description show not-reportable

When the flag from desc_flags is set to MAKEDESC_SHOW_URLS and problem is
not-reportable. The abrt-cli shows not-reportable in listing.

Resolves: rhbz#1066520
---
src/lib/make_descr.c | 45 +++++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index d183ac1..7f5c10b 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -101,33 +101,38 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip,
if (desc_flags & MAKEDESC_SHOW_URLS)
{
- const char *reported_to = problem_data_get_content_or_NULL(problem_data, FILENAME_REPORTED_TO);
- if (reported_to != NULL)
+ if (problem_data_get_content_or_NULL(problem_data, FILENAME_NOT_REPORTABLE) != NULL)
+ strbuf_append_strf(buf_dsc, "%s%*s%s\n", _("Reported:"), 16 - strlen(_("Reported:")), "" , _("cannot be reported"));
+ else
{
- GList *reports = read_entire_reported_to_data(reported_to);
-
- /* The value part begins on 17th column */
- /* 0123456789ABCDEF*/
- const char *pad_prefix = " ";
- char *first_prefix = xasprintf("%s%*s", _("Reported:"), 16 - strlen(_("Reported:")), "");
- const char *prefix = first_prefix;
- for (GList *iter = reports; iter != NULL; iter = g_list_next(iter))
+ const char *reported_to = problem_data_get_content_or_NULL(problem_data, FILENAME_REPORTED_TO);
+ if (reported_to != NULL)
{
- const report_result_t *const report = (report_result_t *)iter->data;
+ GList *reports = read_entire_reported_to_data(reported_to);
+
+ /* The value part begins on 17th column */
+ /* 0123456789ABCDEF*/
+ const char *pad_prefix = " ";
+ char *first_prefix = xasprintf("%s%*s", _("Reported:"), 16 - strlen(_("Reported:")), "");
+ const char *prefix = first_prefix;
+ for (GList *iter = reports; iter != NULL; iter = g_list_next(iter))
+ {
+ const report_result_t *const report = (report_result_t *)iter->data;
- if (report->url == NULL)
- continue;
+ if (report->url == NULL)
+ continue;
- strbuf_append_strf(buf_dsc, "%s%s\n", prefix, report->url);
+ strbuf_append_strf(buf_dsc, "%s%s\n", prefix, report->url);
- if (prefix == first_prefix)
- { /* Only the first URL is prefixed by 'Reported:' */
- empty = false;
- prefix = pad_prefix;
+ if (prefix == first_prefix)
+ { /* Only the first URL is prefixed by 'Reported:' */
+ empty = false;
+ prefix = pad_prefix;
+ }
}
+ free(first_prefix);
+ g_list_free_full(reports, (GDestroyNotify)free_report_result);
}
- free(first_prefix);
- g_list_free_full(reports, (GDestroyNotify)free_report_result);
}
}
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From 07e1d9a93310046193f30734bed97161dbaf402a Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 9 Sep 2014 10:55:43 +0200
Subject: [LIBREPORT PATCH 60/93] wizard: make report-gtk's application
nonunique

Related to rhbz#1069917

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/gui-wizard-gtk/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gui-wizard-gtk/main.c b/src/gui-wizard-gtk/main.c
index 697b91f..44918ec 100644
--- a/src/gui-wizard-gtk/main.c
+++ b/src/gui-wizard-gtk/main.c
@@ -216,7 +216,7 @@ int main(int argc, char **argv)
problem_data_reload_from_dump_dir();
g_custom_logger = &show_error_as_msgbox;
- GtkApplication *app = gtk_application_new("org.freedesktop.libreport.report", G_APPLICATION_FLAGS_NONE);
+ GtkApplication *app = gtk_application_new("org.freedesktop.libreport.report", G_APPLICATION_NON_UNIQUE);
g_signal_connect(app, "activate", G_CALLBACK(activate_wizard), (gpointer)expert_mode);
g_signal_connect(app, "startup", G_CALLBACK(startup_wizard), NULL);
/* Enter main loop */
--
1.8.3.1

View File

@ -0,0 +1,277 @@
From 1dc5d9f838b23451e74063c022e4c6291feb024a Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 10 Sep 2014 12:08:40 +0200
Subject: [LIBREPORT PATCH 61/93] ureport: enabled inclusion of Authentication
data

Resolves rhbz#1139557

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/plugins/ureport.c
---
doc/reporter-ureport.txt | 17 +++++++++++++++++
src/lib/json.c | 32 +++++++++++++++++++++++++++++++-
src/lib/ureport.h | 14 ++++++++++++++
src/plugins/ureport.c | 31 ++++++++++++++++++++++++++++++-
src/plugins/ureport.conf | 8 ++++++++
5 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index 54823ae..9264cda 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -44,6 +44,14 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
'ContactEmail'::
Email address attached to a bthash on the server.
+'IncludeAuthData'::
+ If this option is set to 'yes', uploaded uReport will contain 'auth' object
+ consisting from key value pairs made from CSV list stored in 'AuthDataItems'
+ option. Keys are file names and values are bites of these files.
+
+'AuthDataItems'::
+ CSV list of files included in the 'auth' uReport object.
+
Parameters can be overridden via $uReport_PARAM environment variables.
OPTIONS
@@ -85,6 +93,9 @@ OPTIONS
-u, --url URL::
Specify server URL
+-i AUTH_DATA_ITEMS::
+ List of dump dir files included in the 'auth' uReport object.
+
ENVIRONMENT VARIABLES
---------------------
Environment variables take precedence over values provided in
@@ -99,6 +110,12 @@ the configuration file.
'uReport_ContactEmail'::
Email address attached to a bthash on the server.
+'uReport_IncludeAuthData'::
+ See IncludeAuthData configuration option for details.
+
+'uReport_AuthDataItems'::
+ See AuthDataItems configuration option for details.
+
SEE ALSO
--------
ureport.conf(5)
diff --git a/src/lib/json.c b/src/lib/json.c
index 66db537..8935ef8 100644
--- a/src/lib/json.c
+++ b/src/lib/json.c
@@ -37,7 +37,7 @@ static void ureport_add_str(struct json_object *ur, const char *key,
json_object_object_add(ur, key, jstring);
}
-char *ureport_from_dump_dir(const char *dump_dir_path)
+char *ureport_from_dump_dir_ext(const char *dump_dir_path, const struct ureport_preferences *preferences)
{
char *error_message;
struct sr_report *report = sr_abrt_report_from_dir(dump_dir_path,
@@ -46,12 +46,42 @@ char *ureport_from_dump_dir(const char *dump_dir_path)
if (!report)
error_msg_and_die("%s", error_message);
+ if (preferences != NULL && preferences->urp_auth_items != NULL)
+ {
+ struct dump_dir *dd = dd_opendir(dump_dir_path, DD_OPEN_READONLY);
+ if (!dd)
+ xfunc_die(); /* dd_opendir() already printed an error message */
+
+ GList *iter = preferences->urp_auth_items;
+ for ( ; iter != NULL; iter = g_list_next(iter))
+ {
+ const char *key = (const char *)iter->data;
+ char *value = dd_load_text_ext(dd, key,
+ DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE | DD_FAIL_QUIETLY_ENOENT);
+
+ if (value == NULL)
+ {
+ perror_msg("Cannot include '%s' in 'auth'", key);
+ continue;
+ }
+
+ sr_report_add_auth(report, key, value);
+ }
+
+ dd_close(dd);
+ }
+
char *json_ureport = sr_report_to_json(report);
sr_report_free(report);
return json_ureport;
}
+char *ureport_from_dump_dir(const char *dump_dir_path)
+{
+ return ureport_from_dump_dir_ext(dump_dir_path, /*no preferences*/NULL);
+}
+
char *new_json_attachment(const char *bthash, const char *type, const char *data)
{
struct json_object *attachment = json_object_new_object();
diff --git a/src/lib/ureport.h b/src/lib/ureport.h
index 16f40f1..ca1d538 100644
--- a/src/lib/ureport.h
+++ b/src/lib/ureport.h
@@ -26,6 +26,14 @@ extern "C" {
#endif
/*
+ * uReport generation configuration
+ */
+struct ureport_preferences
+{
+ GList *urp_auth_items; ///< list of file names included in 'auth' key
+};
+
+/*
* uReport server configuration
*/
struct ureport_server_config
@@ -35,6 +43,8 @@ struct ureport_server_config
char *ur_client_cert; ///< Path to certificate used for client
///< authentication (or NULL)
char *ur_client_key; ///< Private key for the certificate
+
+ struct ureport_preferences ur_prefs; ///< configuration for uReport generation
};
struct abrt_post_state;
@@ -54,6 +64,10 @@ struct post_state *ureport_attach_email(const char *bthash, const char *email,
#define ureport_from_dump_dir libreport_ureport_from_dump_dir
char *ureport_from_dump_dir(const char *dump_dir_path);
+#define ureport_from_dump_dir_ext libreport_ureport_from_dump_dir_ext
+char *ureport_from_dump_dir_ext(const char *dump_dir_path,
+ const struct ureport_preferences *preferences);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index 59554f4..d23cc79 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -108,6 +108,19 @@ static void load_ureport_server_config(struct ureport_server_config *config, map
VALUE_FROM_CONF("URL", config->ur_url, (const char *));
VALUE_FROM_CONF("SSLVerify", config->ur_ssl_verify, string_to_bool);
+ bool include_auth = false;
+ VALUE_FROM_CONF("IncludeAuthData", include_auth, string_to_bool);
+
+ if (include_auth)
+ {
+ const char *auth_items = NULL;
+ VALUE_FROM_CONF("AuthDataItems", auth_items, (const char *));
+ config->ur_prefs.urp_auth_items = parse_list(auth_items);
+
+ if (config->ur_prefs.urp_auth_items == NULL)
+ log_warning("IncludeAuthData set to 'yes' but AuthDataItems is empty.");
+ }
+
const char *client_auth = NULL;
VALUE_FROM_CONF("SSLClientAuth", client_auth, (const char *));
parse_client_auth_paths(config, client_auth);
@@ -413,6 +426,9 @@ int main(int argc, char **argv)
.ur_ssl_verify = true,
.ur_client_cert = NULL,
.ur_client_key = NULL,
+ {
+ .urp_auth_items = NULL,
+ },
};
enum {
@@ -421,6 +437,7 @@ int main(int argc, char **argv)
OPT_u = 1 << 2,
OPT_k = 1 << 3,
OPT_t = 1 << 4,
+ OPT_i = 1 << 5,
};
int ret = 1; /* "failure" (for now) */
@@ -428,6 +445,7 @@ int main(int argc, char **argv)
const char *conf_file = CONF_FILE_PATH;
const char *arg_server_url = NULL;
const char *client_auth = NULL;
+ GList *auth_items = NULL;
const char *dump_dir_path = ".";
const char *ureport_hash = NULL;
bool ureport_hash_from_rt = false;
@@ -443,6 +461,7 @@ int main(int argc, char **argv)
OPT_BOOL('k', "insecure", &insecure,
_("Allow insecure connection to ureport server")),
OPT_STRING('t', "auth", &client_auth, "SOURCE", _("Use client authentication")),
+ OPT_LIST('i', "auth_items", &auth_items, "AUTH_ITEMS", _("Additional files included in 'auth' key")),
OPT_STRING('c', NULL, &conf_file, "FILE", _("Configuration file")),
OPT_STRING('a', "attach", &ureport_hash, "BTHASH",
_("bthash of uReport to attach (conflicts with -A)")),
@@ -461,6 +480,8 @@ int main(int argc, char **argv)
const char *program_usage_string = _(
"& [-v] [-c FILE] [-u URL] [-k] [-t SOURCE] [-A -a bthash -B -b bug-id -E -e email] [-d DIR]\n"
+ "& [-v] [-c FILE] [-u URL] [-k] [-t SOURCE] [-i AUTH_ITEMS]\\\n"
+ " [-A -a bthash -B -b bug-id -E -e email] [-d DIR]\n"
"\n"
"Upload micro report or add an attachment to a micro report\n"
"\n"
@@ -480,6 +501,11 @@ int main(int argc, char **argv)
config.ur_ssl_verify = !insecure;
if (opts & OPT_t)
parse_client_auth_paths(&config, client_auth);
+ if (opts & OPT_i)
+ {
+ g_list_free_full(config.ur_prefs.urp_auth_items, free);
+ config.ur_prefs.urp_auth_items = auth_items;
+ }
if (!config.ur_url)
error_msg_and_die("You need to specify server URL");
@@ -572,7 +598,7 @@ int main(int argc, char **argv)
char *dest_url = concat_path_file(config.ur_url, REPORT_URL_SFX);
config.ur_url = dest_url;
- char *json_ureport = ureport_from_dump_dir(dump_dir_path);
+ char *json_ureport = ureport_from_dump_dir_ext(dump_dir_path, &(config.ur_prefs));
if (!json_ureport)
{
error_msg(_("Not uploading an empty uReport"));
@@ -648,6 +674,9 @@ format_err:
free(dest_url);
finalize:
+ if (config.ur_prefs.urp_auth_items != auth_items)
+ g_list_free_full(config.ur_prefs.urp_auth_items, free);
+
free_map_string(settings);
free(config.ur_client_cert);
free(config.ur_client_key);
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index 407fbca..8abeb26 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -7,6 +7,14 @@ URL = http://bug-report.itos.redhat.com
# Contact email attached to an uploaded uReport if required
# ContactEmail = foo@example.com
+# yes means that uReport will contain 'auth' object consisting
+# from key value pairs made from AuthDataItems
+# IncludeAuthData = yes
+
+# If IncludeAuthData is set to yes, these fields will be included
+# in 'auth' object
+AuthDataItems = hostname, machineid
+
# Client-side authentication
# None (default):
# SSLClientAuth =
--
1.8.3.1

View File

@ -0,0 +1,61 @@
From 952d080dfd832ecc3e5c31dde7c24077193aaec6 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 11 Sep 2014 12:29:49 +0200
Subject: [LIBREPORT PATCH 62/93] lib: add xstrdup_between(str, open, close)

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/internal_libreport.h | 2 ++
src/lib/xfuncs.c | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+)

diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index f9670b0..9ff89b2 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -327,6 +327,8 @@ void* xzalloc(size_t size);
char* xstrdup(const char *s);
#define xstrndup libreport_xstrndup
char* xstrndup(const char *s, int n);
+#define xstrdup_between libreport_xstrdup_between
+char* xstrdup_between(const char *s, const char *open, const char *close);
#define xpipe libreport_xpipe
void xpipe(int filedes[2]);
diff --git a/src/lib/xfuncs.c b/src/lib/xfuncs.c
index b5f04e2..1ce44aa 100644
--- a/src/lib/xfuncs.c
+++ b/src/lib/xfuncs.c
@@ -107,6 +107,27 @@ char* xstrndup(const char *s, int n)
return (char*) memcpy(t, s, n);
}
+char *xstrdup_between(const char *src, const char *open, const char *close)
+{
+ const char *start = strstr(src, open);
+ if (start == NULL)
+ {
+ log_debug("Open tag not found: '%s'", open);
+ return NULL;
+ }
+
+ start += strlen(open);
+
+ const char *stop = strstr(start, close);
+ if (stop == NULL)
+ {
+ log_debug("Close tag not found: '%s'", close);
+ return NULL;
+ }
+
+ return xstrndup(start, stop - start);
+}
+
void xpipe(int filedes[2])
{
if (pipe(filedes))
--
1.8.3.1

View File

@ -0,0 +1,107 @@
From 043c763822b5198c692750fda290385e93caee27 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 11 Sep 2014 15:32:38 +0200
Subject: [LIBREPORT PATCH 63/93] testsuite: add test for xstrdup_between(src,
open, close)

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
tests/Makefile.am | 3 ++-
tests/testsuite.at | 1 +
tests/xfuncs.at | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 tests/xfuncs.at

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 750fa16..664c43f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -39,7 +39,8 @@ TESTSUITE_AT = \
make_description.at \
libreport_types.at \
xml_definition.at \
- report_python.at
+ report_python.at \
+ xfuncs.at
EXTRA_DIST += $(TESTSUITE_AT)
TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/testsuite.at b/tests/testsuite.at
index a569457..92129d8 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,6 +1,7 @@
# Test suite for abrt.
# See http://www.gnu.org/software/hello/manual/autoconf/Writing-Testsuites.html
+m4_include([xfuncs.at])
m4_include([strbuf.at])
m4_include([osrelease.at])
m4_include([osinfo.at])
diff --git a/tests/xfuncs.at b/tests/xfuncs.at
new file mode 100644
index 0000000..d7e947a
--- /dev/null
+++ b/tests/xfuncs.at
@@ -0,0 +1,56 @@
+# -*- Autotest -*-
+
+AT_BANNER([xfuncs])
+
+## --------------- ##
+## xstrdup_between ##
+## --------------- ##
+
+AT_TESTFUN([xstrdup_between],
+[[#include "internal_libreport.h"
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+
+#define DEBUG_PRINT(e, r, o, c, s) \
+ fprintf(stderr, "Expected: '%s'\nFound: '%s'\nOpen: '%s'\nClose: '%s'\nSource: '%s'\n", e, r, o, c, s)
+
+void test(const char *src, const char *open, const char *close, const char *exp)
+{
+ char *res = xstrdup_between(src, open, close);
+
+ if (exp == NULL && res != NULL)
+ {
+ DEBUG_PRINT("NULL", res, open, close, src);
+ assert(!"Found non-existing section.");
+ }
+ else if (exp != NULL && res == NULL)
+ {
+ DEBUG_PRINT(exp, "NULL", open, close, src);
+ assert(!"Didn't find section.");
+ }
+ else if (exp == NULL && res == NULL)
+ return;
+ else if (strcmp(res, exp) != 0)
+ {
+ DEBUG_PRINT(exp, res, open, close, src);
+ assert(!"Invalid selection.");
+ }
+
+ free(res);
+}
+
+
+int main(void)
+{
+ g_verbose=3;
+
+ test("<a>foo blah</a>", "<?>", "</a>", NULL);
+ test("<a>foo blah</a>", "<a>", "</?>", NULL);
+ test("<a></a>", "<a>", "</a>", "");
+ test("@.$.@GOOD.$.", "@.$.@", ".$.", "GOOD");
+
+ return 0;
+}
+
+]])
--
1.8.3.1

View File

@ -0,0 +1,35 @@
From d02894ce9d1a88f103203684fc6d9f7ab87ceafa Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 11 Sep 2014 12:30:43 +0200
Subject: [LIBREPORT PATCH 64/93] lib: add wrapper for g_hash_table_size()

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/libreport_types.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/src/include/libreport_types.h b/src/include/libreport_types.h
index d61c2e7..41ed5d7 100644
--- a/src/include/libreport_types.h
+++ b/src/include/libreport_types.h
@@ -33,6 +33,15 @@ typedef GHashTable map_string_t;
map_string_t *new_map_string(void);
#define free_map_string libreport_free_map_string
void free_map_string(map_string_t *ms);
+#define size_map_string libreport_size_map_string
+static inline
+unsigned size_map_string(map_string_t *ms)
+{
+ if (ms == NULL)
+ return 0;
+
+ return g_hash_table_size(ms);
+}
#define insert_map_string_item libreport_insert_map_string_item
static inline
void insert_map_string(map_string_t *ms, char *key, char *value)
--
1.8.3.1

View File

@ -0,0 +1,56 @@
From efcf993b68fdad24f60e3f4bfbe0a94f8ef666fe Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 12 Sep 2014 14:37:45 +0200
Subject: [LIBREPORT PATCH 65/93] lib: add strremovech(str, ch)

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/internal_libreport.h | 2 ++
src/lib/strbuf.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)

diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index 9ff89b2..52f466f 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -111,6 +111,8 @@ int suffixcmp(const char *str, const char *suffix);
char *strtrim(char *str);
#define strtrimch libreport_strtrimch
char *strtrimch(char *str, int ch);
+#define strremovech libreport_strremovech
+char *strremovech(char *str, int ch);
#define append_to_malloced_string libreport_append_to_malloced_string
char *append_to_malloced_string(char *mstr, const char *append);
#define skip_whitespace libreport_skip_whitespace
diff --git a/src/lib/strbuf.c b/src/lib/strbuf.c
index 8bad558..ef8bda8 100644
--- a/src/lib/strbuf.c
+++ b/src/lib/strbuf.c
@@ -86,6 +86,22 @@ char *strtrimch(char *str, int ch)
return str;
}
+/*
+ * Removes character from a string.
+ * Modifies the string in-place. Returns the updated string.
+ */
+char *strremovech(char *str, int ch)
+{
+ char *ret = str;
+ char *res = str;
+ for ( ; *str != '\0'; ++str)
+ if (*str != ch)
+ *(res++) = *str;
+
+ *res = '\0';
+ return ret;
+}
+
struct strbuf *strbuf_new(void)
{
--
1.8.3.1

View File

@ -0,0 +1,46 @@
From 57ef3de7bed1dbe3028e9589063b7ee2a373630d Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 12 Sep 2014 16:09:06 +0200
Subject: [LIBREPORT PATCH 66/93] testsuite: add test for strremovech(str, ch)

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
tests/strbuf.at | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/tests/strbuf.at b/tests/strbuf.at
index 9f1d6ef..a548044 100644
--- a/tests/strbuf.at
+++ b/tests/strbuf.at
@@ -71,3 +71,26 @@ int main(void)
return 0;
}
]])
+
+
+## ----------- ##
+## strremovech ##
+## ----------- ##
+
+AT_TESTFUN([strremovech],
+[[
+#include "internal_libreport.h"
+#include <assert.h>
+int main(void)
+{
+ char test[] = "Hello , world!";
+
+ if (strcmp(strremovech(test, ' '), "Hello,world!") != 0)
+ {
+ fprintf(stderr, "Expected: 'Hello,world!'\nResult : '%s'", test);
+ assert(!"Failed to remove space");
+ }
+
+ return 0;
+}
+]])
--
1.8.3.1

View File

@ -0,0 +1,239 @@
From 4f61f5d9eec75e471c8176dac0c21f4361e40ee6 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 11 Sep 2014 12:33:05 +0200
Subject: [LIBREPORT PATCH 67/93] ureport: use additional HTTP headers with
'rhsm-entitlement' cert auth

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
src/plugins/ureport.conf
---
src/lib/json.c | 29 +++++++++++----
src/lib/ureport.h | 1 +
src/plugins/ureport.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++-
src/plugins/ureport.conf | 4 ++-
4 files changed, 119 insertions(+), 9 deletions(-)

diff --git a/src/lib/json.c b/src/lib/json.c
index 8935ef8..6fbbf39 100644
--- a/src/lib/json.c
+++ b/src/lib/json.c
@@ -113,14 +113,25 @@ struct post_state *post_ureport(const char *json, struct ureport_server_config *
post_state->client_key_path = config->ur_client_key;
}
- static const char *headers[] = {
- "Accept: application/json",
- "Connection: close",
- NULL,
- };
+ char **headers = xmalloc(sizeof(char *) * (3 + size_map_string(config->ur_http_headers)));
+ headers[0] = (char *)"Accept: application/json";
+ headers[1] = (char *)"Connection: close";
+ headers[2] = NULL;
+
+ if (config->ur_http_headers != NULL)
+ {
+ unsigned i = 2;
+ const char *header;
+ const char *value;
+ map_string_iter_t iter;
+ init_map_string_iter(&iter, config->ur_http_headers);
+ while (next_map_string_iter(&iter, &header, &value))
+ headers[i++] = xasprintf("%s: %s", header, value);
+ headers[i] = NULL;
+ }
post_string_as_form_data(post_state, config->ur_url, "application/json",
- headers, json);
+ (const char **)headers, json);
/* Client authentication failed. Try again without client auth.
* CURLE_SSL_CONNECT_ERROR - cert not found/server doesnt trust the CA
@@ -135,10 +146,14 @@ struct post_state *post_ureport(const char *json, struct ureport_server_config *
post_state = new_post_state(flags);
post_string_as_form_data(post_state, config->ur_url, "application/json",
- headers, json);
+ (const char **)headers, json);
}
+ for (unsigned i = size_map_string(config->ur_http_headers); i != 0; --i)
+ free(headers[i + 1]);
+ free(headers);
+
return post_state;
}
diff --git a/src/lib/ureport.h b/src/lib/ureport.h
index ca1d538..319aca9 100644
--- a/src/lib/ureport.h
+++ b/src/lib/ureport.h
@@ -43,6 +43,7 @@ struct ureport_server_config
char *ur_client_cert; ///< Path to certificate used for client
///< authentication (or NULL)
char *ur_client_key; ///< Private key for the certificate
+ map_string_t *ur_http_headers; ///< Additional HTTP headers
struct ureport_preferences ur_prefs; ///< configuration for uReport generation
};
diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index d23cc79..9c69cad 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -31,6 +31,12 @@
#define RHSM_CERT_PATH "/etc/pki/consumer/cert.pem"
#define RHSM_KEY_PATH "/etc/pki/consumer/key.pem"
+#define RHAP_PEM_DIR_PATH "/etc/pki/entitlement"
+#define RHAP_ENT_DATA_BEGIN_TAG "-----BEGIN ENTITLEMENT DATA-----"
+#define RHAP_ENT_DATA_END_TAG "-----END ENTITLEMENT DATA-----"
+#define RHAP_SIG_DATA_BEGIN_TAG "-----BEGIN RSA SIGNATURE-----"
+#define RHAP_SIG_DATA_END_TAG "-----END RSA SIGNATURE-----"
+
#define VALUE_FROM_CONF(opt, var, tr) do { const char *value = getenv("uReport_"opt); \
if (!value) { value = get_map_string_item_or_NULL(settings, opt); } if (value) { var = tr(value); } \
} while(0)
@@ -72,6 +78,88 @@ static void parse_client_auth_paths(struct ureport_server_config *config, const
config->ur_client_cert = xstrdup(RHSM_CERT_PATH);
config->ur_client_key = xstrdup(RHSM_KEY_PATH);
}
+ else if (strcmp(client_auth, "rhsm-entitlement") == 0)
+ {
+ GList *certs = get_file_list(RHAP_PEM_DIR_PATH, "pem");
+ if (g_list_length(certs) != 2)
+ {
+ log_notice(RHAP_PEM_DIR_PATH" does not contain unique cert-key files pair");
+ log_notice("Not using client authentication");
+ return;
+ }
+
+ const char *cert = NULL;
+ const char *key = NULL;
+
+ file_obj_t *fst = (file_obj_t *)certs->data;
+ file_obj_t *scn = (file_obj_t *)certs->next->data;
+
+ if (strlen(fo_get_filename(fst)) < strlen(fo_get_filename(scn)))
+ {
+ cert = fo_get_filename(fst);
+ key = fo_get_filename(scn);
+
+ config->ur_client_cert = xstrdup(fo_get_fullpath(fst));
+ config->ur_client_key = xstrdup(fo_get_fullpath(scn));
+ }
+ else
+ {
+ cert = fo_get_filename(scn);
+ key = fo_get_filename(fst);
+
+ config->ur_client_cert = xstrdup(fo_get_fullpath(scn));
+ config->ur_client_key = xstrdup(fo_get_fullpath(fst));
+ }
+
+ const bool iscomplement = prefixcmp(key, cert) != 0 || strcmp("-key", key + strlen(cert)) != 0;
+ g_list_free_full(certs, (GDestroyNotify)free_file_obj);
+
+ if (iscomplement)
+ {
+ log_notice("Key file '%s' isn't complement to cert file '%s'",
+ config->ur_client_key, config->ur_client_cert);
+ log_notice("Not using client authentication");
+
+ free(config->ur_client_cert);
+ free(config->ur_client_key);
+ config->ur_client_cert = NULL;
+ config->ur_client_key = NULL;
+
+ return;
+ }
+
+ char *certdata = xmalloc_open_read_close(config->ur_client_cert, /*no size limit*/NULL);
+ if (certdata != NULL)
+ {
+ char *ent_data = xstrdup_between(certdata,
+ RHAP_ENT_DATA_BEGIN_TAG, RHAP_ENT_DATA_END_TAG);
+
+ char *sig_data = xstrdup_between(certdata,
+ RHAP_SIG_DATA_BEGIN_TAG, RHAP_SIG_DATA_END_TAG);
+
+ if (ent_data != NULL && sig_data != NULL)
+ {
+ ent_data = strremovech(ent_data, '\n');
+ insert_map_string(config->ur_http_headers,
+ xstrdup("X-RH-Entitlement-Data"),
+ xasprintf(RHAP_ENT_DATA_BEGIN_TAG"%s"RHAP_ENT_DATA_END_TAG, ent_data));
+
+ sig_data = strremovech(sig_data, '\n');
+ insert_map_string(config->ur_http_headers,
+ xstrdup("X-RH-Entitlement-Sig"),
+ xasprintf(RHAP_SIG_DATA_BEGIN_TAG"%s"RHAP_SIG_DATA_END_TAG, sig_data));
+ }
+ else
+ {
+ log_notice("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
+ log_notice("Not using HTTP authentication headers");
+ }
+
+ free(sig_data);
+ free(ent_data);
+ free(certdata);
+ }
+ }
else if (strcmp(client_auth, "puppet") == 0)
{
config->ur_client_cert = puppet_config_print("hostcert");
@@ -83,7 +171,6 @@ static void parse_client_auth_paths(struct ureport_server_config *config, const
config->ur_client_cert = xstrdup(strtok(scratch, ":"));
config->ur_client_key = xstrdup(strtok(NULL, ":"));
free(scratch);
-
if (config->ur_client_cert == NULL || config->ur_client_key == NULL)
error_msg_and_die("Invalid client authentication specification");
}
@@ -426,11 +513,14 @@ int main(int argc, char **argv)
.ur_ssl_verify = true,
.ur_client_cert = NULL,
.ur_client_key = NULL,
+ .ur_http_headers = NULL,
{
.urp_auth_items = NULL,
},
};
+ config.ur_http_headers = new_map_string();
+
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
@@ -677,6 +767,8 @@ finalize:
if (config.ur_prefs.urp_auth_items != auth_items)
g_list_free_full(config.ur_prefs.urp_auth_items, free);
+ free_map_string(config.ur_http_headers);
+
free_map_string(settings);
free(config.ur_client_cert);
free(config.ur_client_key);
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index 8abeb26..fc0dc21 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -19,7 +19,9 @@ AuthDataItems = hostname, machineid
# None (default):
# SSLClientAuth =
# Using RH subscription management certificate:
-SSLClientAuth = rhsm
+# SSLClientAuth = rhsm
+# Using RH subscription management entitlement certificate:
+# SSLClientAuth = rhsm-entitlement
# Using Puppet certificate:
# SSLClientAuth = puppet
# Using custom certificate:
--
1.8.3.1

View File

@ -0,0 +1,48 @@
From 1e15ffd07101d090925995b6287d1e745d0aca2c Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Thu, 11 Sep 2014 08:34:43 +0200
Subject: [LIBREPORT PATCH 68/93] lib: add function index_of_string_in_list

Related:rhbz#1067440

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/include/internal_libreport.h | 3 +++
src/lib/is_in_string_list.c | 10 ++++++++++
2 files changed, 13 insertions(+)

diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index 52f466f..585b807 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -287,6 +287,9 @@ char *run_in_shell_and_save_output(int flags,
#define is_in_string_list libreport_is_in_string_list
bool is_in_string_list(const char *name, char **v);
+#define index_of_string_in_list libreport_index_of_string_in_list
+int index_of_string_in_list(const char *name, char **v);
+
#define is_in_comma_separated_list libreport_is_in_comma_separated_list
bool is_in_comma_separated_list(const char *value, const char *list);
#define is_in_comma_separated_list_of_glob_patterns libreport_is_in_comma_separated_list_of_glob_patterns
diff --git a/src/lib/is_in_string_list.c b/src/lib/is_in_string_list.c
index 663edff..e0ee26b 100644
--- a/src/lib/is_in_string_list.c
+++ b/src/lib/is_in_string_list.c
@@ -28,3 +28,13 @@ bool is_in_string_list(const char *name, char **v)
}
return false;
}
+
+int index_of_string_in_list(const char *name, char **v)
+{
+ for(int i = 0; v[i]; ++i)
+ {
+ if (strcmp(v[i], name) == 0)
+ return i;
+ }
+ return -1;
+}
--
1.8.3.1

View File

@ -0,0 +1,89 @@
From 879b15857cdc5b4442f5c9cda6bd58bd8613fcc3 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Thu, 11 Sep 2014 08:39:48 +0200
Subject: [LIBREPORT PATCH 69/93] testsuite: add a test for
index_of_string_in_list

Testing index_of_string_in_list to get right result.

Related:rhbz#1067440

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>

Conflicts:
tests/Makefile.am
---
tests/Makefile.am | 3 ++-
tests/string_list.at | 36 ++++++++++++++++++++++++++++++++++++
tests/testsuite.at | 1 +
3 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 tests/string_list.at

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 664c43f..4731bad 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -40,7 +40,8 @@ TESTSUITE_AT = \
libreport_types.at \
xml_definition.at \
report_python.at \
- xfuncs.at
+ xfuncs.at \
+ string_list.at
EXTRA_DIST += $(TESTSUITE_AT)
TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/string_list.at b/tests/string_list.at
new file mode 100644
index 0000000..f66f5fa
--- /dev/null
+++ b/tests/string_list.at
@@ -0,0 +1,36 @@
+# -*- Autotest -*-
+
+AT_BANNER([string_list])
+
+## ----------------------- ##
+## index_of_string_in_list ##
+## ----------------------- ##
+
+AT_TESTFUN([index_of_string_in_list],
+[[
+#include "internal_libreport.h"
+#include <assert.h>
+int main(void)
+{
+ static const char *const list_order[] = {
+ FILENAME_REASON ,
+ FILENAME_TIME ,
+ FILENAME_CMDLINE ,
+ FILENAME_PACKAGE ,
+ FILENAME_UID ,
+ FILENAME_COUNT ,
+ NULL
+ };
+
+ int index = index_of_string_in_list(FILENAME_REASON, (char**) list_order);
+ assert(index == 0);
+
+ index = index_of_string_in_list(FILENAME_COUNT, (char**) list_order);
+ assert(index == 5);
+
+ index = index_of_string_in_list("other", (char**) list_order);
+ assert(index < 0);
+
+ return 0;
+}
+]])
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 92129d8..60b2e94 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -15,3 +15,4 @@ m4_include([make_description.at])
m4_include([libreport_types.at])
m4_include([xml_definition.at])
m4_include([report_python.at])
+m4_include([string_list.at])
--
1.8.3.1

View File

@ -0,0 +1,80 @@
From b663631fe2a6b31a3dcc1f1dfaeef8377ff07612 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Tue, 16 Sep 2014 01:37:19 +0200
Subject: [LIBREPORT PATCH 70/93] testsuite: change test for make_description

Change test for make_description because of new order its items.

Related to rhbz#1067440

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
tests/make_description.at | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tests/make_description.at b/tests/make_description.at
index 7415cf8..e606065 100644
--- a/tests/make_description.at
+++ b/tests/make_description.at
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
const int list_flags = CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE | CD_FLAG_LIST;
problem_data_add(pd, FILENAME_PACKAGE, "libreport", list_flags);
- problem_data_add(pd, FILENAME_EXECUTABLE, "/usr/bin/sh", list_flags);
+ problem_data_add(pd, FILENAME_REASON, "will_segfault killed by SIGSEGV", list_flags);
problem_data_add(pd, FILENAME_COUNT, "0", list_flags);
problem_data_add_text_noteditable(pd,
@@ -103,9 +103,9 @@ int main(int argc, char **argv)
"Reported: https://bugzilla.redhat.com/1000000\n"
" https://access.redhat.com/home\n"
" https://bug-report.itos.redhat.com\n",
- FILENAME_COUNT, 14 - strlen(FILENAME_COUNT), "", "0",
- FILENAME_EXECUTABLE, 14 - strlen(FILENAME_EXECUTABLE), "", "/usr/bin/sh",
- FILENAME_PACKAGE, 14 - strlen(FILENAME_PACKAGE), "", "libreport");
+ FILENAME_REASON, 14 - strlen(FILENAME_REASON), "", "will_segfault killed by SIGSEGV",
+ FILENAME_PACKAGE, 14 - strlen(FILENAME_PACKAGE), "", "libreport",
+ FILENAME_COUNT, 14 - strlen(FILENAME_COUNT), "", "0");
if (strcmp(expected, description) != 0)
{
@@ -133,10 +133,10 @@ int main(int argc, char **argv)
"\n"
"%s: %*sText file, %llu bytes\n"
"%s: %*sText file, %llu bytes\n",
- FILENAME_BACKTRACE, 14 - strlen(FILENAME_BACKTRACE), "", backtrace,
- FILENAME_COUNT, 14 - strlen(FILENAME_COUNT), "", "0",
- FILENAME_EXECUTABLE, 14 - strlen(FILENAME_EXECUTABLE), "", "/usr/bin/sh",
+ FILENAME_REASON, 14 - strlen(FILENAME_REASON), "", "will_segfault killed by SIGSEGV",
FILENAME_PACKAGE, 14 - strlen(FILENAME_PACKAGE), "", "libreport",
+ FILENAME_COUNT, 14 - strlen(FILENAME_COUNT), "", "0",
+ FILENAME_BACKTRACE, 14 - strlen(FILENAME_BACKTRACE), "", backtrace,
FILENAME_BACKTRACE, 14 - strlen(FILENAME_BACKTRACE), "", (long long unsigned)strlen(backtrace),
FILENAME_REPORTED_TO,14 - strlen(FILENAME_REPORTED_TO),"", (long long unsigned)strlen(problem_data_get_content_or_NULL(pd, FILENAME_REPORTED_TO))
);
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
pd = problem_data_new();
problem_data_add(pd, FILENAME_PACKAGE, "libreport", list_flags);
- problem_data_add(pd, FILENAME_EXECUTABLE, "/usr/bin/sh", list_flags);
+ problem_data_add(pd, FILENAME_REASON, "will_segfault killed by SIGSEGV", list_flags);
problem_data_add(pd, FILENAME_COUNT, "0", list_flags);
problem_data_add(pd, FILENAME_BACKTRACE, backtrace, CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE);
@@ -168,10 +168,10 @@ int main(int argc, char **argv)
"%s: %*s%s\n"
"\n"
"%s: %*sText file, %llu bytes\n",
- FILENAME_BACKTRACE, 14 - strlen(FILENAME_BACKTRACE), "", backtrace,
- FILENAME_COUNT, 14 - strlen(FILENAME_COUNT), "", "0",
- FILENAME_EXECUTABLE, 14 - strlen(FILENAME_EXECUTABLE), "", "/usr/bin/sh",
+ FILENAME_REASON, 14 - strlen(FILENAME_REASON), "", "will_segfault killed by SIGSEGV",
FILENAME_PACKAGE, 14 - strlen(FILENAME_PACKAGE), "", "libreport",
+ FILENAME_COUNT, 14 - strlen(FILENAME_COUNT), "", "0",
+ FILENAME_BACKTRACE, 14 - strlen(FILENAME_BACKTRACE), "", backtrace,
FILENAME_BACKTRACE, 14 - strlen(FILENAME_BACKTRACE), "", (long long unsigned)strlen(backtrace)
);
--
1.8.3.1

View File

@ -0,0 +1,66 @@
From 15b4d3e8b516009bab878b7279f549fa61824c74 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Tue, 16 Sep 2014 05:11:40 +0200
Subject: [LIBREPORT PATCH 71/93] lib: use user-friendly order in
make_description()

The reason, time, cmd_line, package, uid, count are always sorted in this
order. The other items are sorted alphabetically and added to the the end of
the list.

Related to rhbz#1067440

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/lib/make_descr.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index 7f5c10b..dcf517e 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -48,6 +48,32 @@ char *make_description_item_multiline(const char *name, const char *content)
return strbuf_free_nobuf(buf);
}
+static int list_cmp(const char *s1, const char *s2)
+{
+ static const char *const list_order[] = {
+ FILENAME_REASON ,
+ FILENAME_TIME ,
+ FILENAME_CMDLINE ,
+ FILENAME_PACKAGE ,
+ FILENAME_UID ,
+ FILENAME_COUNT ,
+ NULL
+ };
+ int s1_index = index_of_string_in_list(s1, (char**) list_order);
+ int s2_index = index_of_string_in_list(s2, (char**) list_order);
+
+ if(s1_index < 0 && s2_index < 0)
+ return strcmp(s1, s2);
+
+ if(s1_index < 0)
+ return 1;
+
+ if(s2_index < 0)
+ return -1;
+
+ return s1_index - s2_index;
+}
+
char *make_description(problem_data_t *problem_data, char **names_to_skip,
unsigned max_text_size, unsigned desc_flags)
{
@@ -59,7 +85,7 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip,
FILENAME_ANALYZER);
GList *list = g_hash_table_get_keys(problem_data);
- list = g_list_sort(list, (GCompareFunc)strcmp);
+ list = g_list_sort(list, (GCompareFunc)list_cmp);
GList *l;
/* Print one-liners. Format:
--
1.8.3.1

View File

@ -0,0 +1,66 @@
From 602457c6b4de8d4147bea2ab2264b360f7807636 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Tue, 16 Sep 2014 05:30:28 +0200
Subject: [LIBREPORT PATCH 72/93] make_desc: add reason to the list

Add reason in format "crash-function: reason". Add hostname to the uid line and
add cmdline. Remove executable line.

Related to rhbz#1067440

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/lib/make_descr.c | 20 +++++++++++++++++++-
src/lib/problem_data.c | 3 ++-
2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index dcf517e..2bcbebd 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -119,7 +119,25 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip,
char *output = formatted ? formatted : item->content;
int pad = 16 - (strlen(key) + 2);
if (pad < 0) pad = 0;
- strbuf_append_strf(buf_dsc, "%s: %*s%s\n", key, pad, "", output);
+ bool done = false;
+ if (strcmp(FILENAME_REASON, key) == 0)
+ {
+ const char *crash_func = problem_data_get_content_or_NULL(problem_data,
+ FILENAME_CRASH_FUNCTION);
+ if((done = (bool)crash_func))
+ strbuf_append_strf(buf_dsc, "%s: %*s%s(): %s\n", key, pad, "", crash_func, output);
+ }
+ else if (strcmp(FILENAME_UID, key) == 0)
+ {
+ const char *username = problem_data_get_content_or_NULL(problem_data,
+ FILENAME_USERNAME);
+ if((done = (bool)username))
+ strbuf_append_strf(buf_dsc, "%s: %*s%s (%s)\n", key, pad, "", output, username);
+ }
+
+ if (!done)
+ strbuf_append_strf(buf_dsc, "%s: %*s%s\n", key, pad, "", output);
+
empty = false;
free(formatted);
}
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
index 18d9541..fc07288 100644
--- a/src/lib/problem_data.c
+++ b/src/lib/problem_data.c
@@ -450,9 +450,10 @@ void problem_data_load_from_dump_dir(problem_data_t *problem_data, struct dump_d
static const char *const list_files[] = {
FILENAME_UID ,
FILENAME_PACKAGE ,
- FILENAME_EXECUTABLE,
+ FILENAME_CMDLINE ,
FILENAME_TIME ,
FILENAME_COUNT ,
+ FILENAME_REASON ,
NULL
};
if (is_in_string_list(short_name, (char**)list_files))
--
1.8.3.1

View File

@ -0,0 +1,77 @@
From c362b6a9c4abb2f4185f5c88b90aecfebd6c67cb Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 24 Jul 2014 13:34:50 +0200
Subject: [LIBREPORT PATCH 73/93] logging: test log level at first step

Return from the logger immediately if message's log level is not
sufficient to write it to the log.

This patch is a workaround for rhbz#1122690 where we try to log a
'post'ed string which has 18MB of size. It is not worth to try to fix it
properly. We do not log such a big amount of data in non-debug mode, we
need to have the logging extremely fast and we can live with crashes in
debug mode.

Resolves: #1142380

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/logging.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/lib/logging.c b/src/lib/logging.c
index 259a634..4b9dd87 100644
--- a/src/lib/logging.c
+++ b/src/lib/logging.c
@@ -66,7 +66,7 @@ static void log_handler(int level,
int line,
const char *func)
{
- if (!logmode)
+ if (!logmode || !should_log(level))
return;
/* This is ugly and costs +60 bytes compared to multiple
@@ -122,29 +122,25 @@ static void log_handler(int level,
strcpy(&msg[used], msg_eol);
if (flags & LOGMODE_STDIO) {
- if(should_log(level))
- full_write(STDERR_FILENO, msg, used + msgeol_len);
+ full_write(STDERR_FILENO, msg, used + msgeol_len);
}
msg[used] = '\0'; /* remove msg_eol (usually "\n") */
if (flags & LOGMODE_SYSLOG) {
- if(should_log(level))
- syslog(level, "%s", msg + prefix_len);
+ syslog(level, "%s", msg + prefix_len);
}
if ((flags & LOGMODE_CUSTOM) && g_custom_logger) {
- if(should_log(level))
- g_custom_logger(msg + prefix_len);
+ g_custom_logger(msg + prefix_len);
}
if (flags & LOGMODE_JOURNAL) {
- if(should_log(level))
- sd_journal_send("MESSAGE=%s", msg + prefix_len,
- "PRIORITY=%d", level,
- "CODE_FILE=%s", file,
- "CODE_LINE=%d", line,
- "CODE_FUNC=%s", func,
- "SYSLOG_FACILITY=1",
- NULL);
+ sd_journal_send("MESSAGE=%s", msg + prefix_len,
+ "PRIORITY=%d", level,
+ "CODE_FILE=%s", file,
+ "CODE_LINE=%d", line,
+ "CODE_FUNC=%s", func,
+ "SYSLOG_FACILITY=1",
+ NULL);
}
}
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From cd91665c5604b2b4999f2f1d0aeaf02dec32aa64 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 18 Sep 2014 11:25:15 +0200
Subject: [LIBREPORT PATCH 74/93] augeas: exclude bugzilla format
configurations

Resolves: #1139922

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
augeas/libreport.aug | 1 +
1 file changed, 1 insertion(+)

diff --git a/augeas/libreport.aug b/augeas/libreport.aug
index 3eba157..0e1e5e5 100644
--- a/augeas/libreport.aug
+++ b/augeas/libreport.aug
@@ -24,6 +24,7 @@ module Libreport =
. (incl (Sys.getenv("HOME") . "/.config/abrt/settings/*"))
. (incl (Sys.getenv("XDG_CACHE_HOME") . "/abrt/events/*"))
. (incl (Sys.getenv("HOME") . "/.cache/abrt/events/*"))
+ . (excl "/etc/libreport/plugins/bugzilla_format*")
. Util.stdexcl
let xfm = transform lns filter
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From 489348e485c93d819cc8569eac85c5d46396c22a Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 23 Sep 2014 10:48:36 +0200
Subject: [LIBREPORT PATCH 75/93] make dist: use tar-ustar due to long
filenames

Thanks Richard Marko <rmarko@redhat.com>!

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1c9c7ce..df88240 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ AC_INIT([libreport],
[crash-catcher@fedorahosted.org])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([-Wall foreign])
+AM_INIT_AUTOMAKE([-Wall foreign tar-ustar])
# Support silent build rules. Disable by either passing --disable-silent-rules
# to ./configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
--
1.8.3.1

View File

@ -0,0 +1,431 @@
From 23116ec906199af1106edcc70fa8280730416d0f Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 17 Sep 2014 05:54:30 +0200
Subject: [LIBREPORT PATCH 76/93] workflow: add new workflows

Add workflow for logger, mailx and reportuploader. These workflows are disabled
because the plugins that ships these workflows are installed by default but we
don't want to offer users these workflows in report-cli/report-gtk by default.

Resolves rhbz#1094203

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
doc/Makefile.am | 3 ++
doc/report_logger.conf.txt | 47 ++++++++++++++++++++++++++++++++
doc/report_mailx.conf.txt | 46 +++++++++++++++++++++++++++++++
doc/report_uploader.conf.txt | 46 +++++++++++++++++++++++++++++++
po/POTFILES.in | 5 ++++
src/workflows/Makefile.am | 24 ++++++++++++----
src/workflows/report_logger.conf | 6 ++++
src/workflows/report_mailx.conf | 6 ++++
src/workflows/report_uploader.conf | 6 ++++
src/workflows/workflow_Logger.xml.in | 11 ++++++++
src/workflows/workflow_LoggerCCpp.xml.in | 12 ++++++++
src/workflows/workflow_Mailx.xml.in | 11 ++++++++
src/workflows/workflow_MailxCCpp.xml.in | 12 ++++++++
src/workflows/workflow_Upload.xml.in | 3 +-
src/workflows/workflow_UploadCCpp.xml.in | 12 ++++++++
15 files changed, 243 insertions(+), 7 deletions(-)
create mode 100644 doc/report_logger.conf.txt
create mode 100644 doc/report_mailx.conf.txt
create mode 100644 doc/report_uploader.conf.txt
create mode 100644 src/workflows/report_logger.conf
create mode 100644 src/workflows/report_mailx.conf
create mode 100644 src/workflows/report_uploader.conf
create mode 100644 src/workflows/workflow_Logger.xml.in
create mode 100644 src/workflows/workflow_LoggerCCpp.xml.in
create mode 100644 src/workflows/workflow_Mailx.xml.in
create mode 100644 src/workflows/workflow_MailxCCpp.xml.in
create mode 100644 src/workflows/workflow_UploadCCpp.xml.in

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 7eb3065..da4785e 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -48,6 +48,9 @@ MAN5_TXT += report_fedora.conf.txt
MAN5_TXT += report_Logger.conf.txt
MAN5_TXT += report_rhel.conf.txt
MAN5_TXT += report_rhel_bugzilla.conf.txt
+MAN5_TXT += report_logger.conf.txt
+MAN5_TXT += report_mailx.conf.txt
+MAN5_TXT += report_uploader.conf.txt
MAN5_TXT += rhtsupport.conf.txt
MAN5_TXT += rhtsupport_event.conf.txt
MAN5_TXT += uploader_event.conf.txt
diff --git a/doc/report_logger.conf.txt b/doc/report_logger.conf.txt
new file mode 100644
index 0000000..7912e2c
--- /dev/null
+++ b/doc/report_logger.conf.txt
@@ -0,0 +1,47 @@
+report_logger.conf(5)
+=====================
+
+NAME
+----
+report_logger.conf - configuration file for libreport.
+
+DESCRIPTION
+-----------
+This configuration file specifies which of the work flow definitions
+are applicable to analyzing problems and export the problem data information to
+a text file.
+
+All applicable work flows are presented to users in User Interface as
+possibilities for processing of any problems. A particular work flow becomes
+applicable if its conditions are satisfied.
+
+This configuration file consists from condition lines. Each condition line must
+start with EVENT=workflow_NAME where "workflow_" is constant prefix and
+"workflow_NAME" is base name of path to reporting work flow configuration file.
+
+The rest of condition line has form VAR=VAL, VAR!=VAL or VAL~=REGEX, where VAR
+is a name of problem directory element to be checked (for example,
+"executable", "package", hostname" etc). The condition may consists from as
+many element checks as it is necessary.
+
+All condition lines in this configuration file are commented out by default.
+Therefore all applicable work flows from this file are not presented to users in
+User Interface. For enable this extension uncomment all condition line in this
+configuration file.
+
+EXAMPLES
+--------
+Condition line::
+ EVENT=workflow_LoggerCCpp analyzer=CCpp
+
+The condition line above expects existence of
+/usr/share/libreport/workflows/workflow_LoggerCCpp.xml
+
+SEE ALSO
+--------
+report-gtk(1)
+
+AUTHOR
+------
+* ABRT team
+
diff --git a/doc/report_mailx.conf.txt b/doc/report_mailx.conf.txt
new file mode 100644
index 0000000..9a5e8cb
--- /dev/null
+++ b/doc/report_mailx.conf.txt
@@ -0,0 +1,46 @@
+report_mailx.conf(5)
+====================
+
+NAME
+----
+report_mailx.conf - configuration file for libreport.
+
+DESCRIPTION
+-----------
+This configuration file specifies which of the work flow definitions
+are applicable to analyzing problems and send information via email.
+
+All applicable work flows are presented to users in User Interface as
+possibilities for processing of any problems. A particular work flow becomes
+applicable if its conditions are satisfied.
+
+This configuration file consists from condition lines. Each condition line must
+start with EVENT=workflow_NAME where "workflow_" is constant prefix and
+"workflow_NAME" is base name of path to reporting work flow configuration file.
+
+The rest of condition line has form VAR=VAL, VAR!=VAL or VAL~=REGEX, where VAR
+is a name of problem directory element to be checked (for example,
+"executable", "package", hostname" etc). The condition may consists
+from as many element checks as it is necessary.
+
+All condition lines in this configuration file are commented out by default.
+Therefore all applicable work flows from this file are not presented to users in
+User Interface. For enable this extension uncomment all condition line in this
+configuration file.
+
+EXAMPLES
+--------
+Condition line::
+ EVENT=workflow_MailxCCpp analyzer=CCpp
+
+The condition line above expects existence of
+/usr/share/libreport/workflows/workflow_MailxCCpp.xml
+
+SEE ALSO
+--------
+report-gtk(1)
+
+AUTHOR
+------
+* ABRT team
+
diff --git a/doc/report_uploader.conf.txt b/doc/report_uploader.conf.txt
new file mode 100644
index 0000000..975ea02
--- /dev/null
+++ b/doc/report_uploader.conf.txt
@@ -0,0 +1,46 @@
+report_uploader.conf(5)
+=======================
+
+NAME
+----
+report_uploader.conf - configuration file for libreport.
+
+DESCRIPTION
+-----------
+This configuration file specifies which of the work flow definitions
+are applicable to analyzing problems and upload the data via scp or ftp.
+
+All applicable work flows are presented to users in User Interface as
+possibilities for processing of any problems. A particular work flow becomes
+applicable if its conditions are satisfied.
+
+This configuration file consists from condition lines. Each condition line must
+start with EVENT=workflow_NAME where "workflow_" is constant prefix and
+"workflow_NAME" is base name of path to reporting work flow configuration file.
+
+The rest of condition line has form VAR=VAL, VAR!=VAL or VAL~=REGEX, where VAR
+is a name of problem directory element to be checked (for example,
+"executable", "package", hostname" etc). The condition may consists
+from as many element checks as it is necessary.
+
+All condition lines in this configuration file are commented out by default.
+Therefore all applicable work flows from this file are not presented to users in
+User Interface. For enable this extension uncomment all condition line in this
+configuration file.
+
+EXAMPLES
+--------
+Condition line::
+ EVENT=workflow_UploadCCpp analyzer=CCpp
+
+The condition line above expects existence of
+/usr/share/libreport/workflows/workflow_UploadCCpp.xml
+
+SEE ALSO
+--------
+report-gtk(1)
+
+AUTHOR
+------
+* ABRT team
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 26acba1..7ba080c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -55,6 +55,11 @@ src/workflows/workflow_FedoraVmcore.xml.in
src/workflows/workflow_FedoraXorg.xml.in
src/workflows/workflow_FedoraLibreport.xml.in
src/workflows/workflow_FedoraJava.xml.in
+src/workflows/workflow_LoggerCCpp.xml.in
+src/workflows/workflow_Logger.xml.in
+src/workflows/workflow_MailxCCpp.xml.in
+src/workflows/workflow_Mailx.xml.in
+src/workflows/workflow_UploadCCpp.xml.in
src/workflows/workflow_Upload.xml.in
src/workflows/workflow_RHELCCpp.xml.in
src/workflows/workflow_RHELKerneloops.xml.in
diff --git a/src/workflows/Makefile.am b/src/workflows/Makefile.am
index 54a6f31..0fc1019 100644
--- a/src/workflows/Makefile.am
+++ b/src/workflows/Makefile.am
@@ -8,14 +8,19 @@ dist_workflows_DATA = \
workflow_FedoraXorg.xml \
workflow_FedoraLibreport.xml \
workflow_FedoraJava.xml \
- workflow_Upload.xml \
workflow_RHELCCpp.xml \
workflow_RHELKerneloops.xml \
workflow_RHELPython.xml \
workflow_RHELvmcore.xml \
workflow_RHELxorg.xml \
workflow_RHELLibreport.xml \
- workflow_RHELJava.xml
+ workflow_RHELJava.xml \
+ workflow_Mailx.xml \
+ workflow_MailxCCpp.xml \
+ workflow_Upload.xml \
+ workflow_UploadCCpp.xml \
+ workflow_Logger.xml \
+ workflow_LoggerCCpp.xml
if BUILD_BUGZILLA
dist_workflows_DATA += \
@@ -36,7 +41,10 @@ workflowsdefdir = $(WORKFLOWS_DEFINITION_DIR)
dist_workflowsdef_DATA =\
report_fedora.conf \
- report_rhel.conf
+ report_rhel.conf \
+ report_mailx.conf \
+ report_logger.conf \
+ report_uploader.conf
if BUILD_BUGZILLA
dist_workflowsdef_DATA += \
@@ -54,14 +62,20 @@ EXTRA_DIST = \
workflow_FedoraXorg.xml.in \
workflow_FedoraLibreport.xml.in \
workflow_FedoraJava.xml.in \
- workflow_Upload.xml.in \
workflow_RHELCCpp.xml.in \
workflow_RHELKerneloops.xml.in \
workflow_RHELPython.xml.in \
workflow_RHELvmcore.xml.in \
workflow_RHELxorg.xml.in \
workflow_RHELLibreport.xml.in \
- workflow_RHELJava.xml.in
+ workflow_RHELJava.xml.in \
+ workflow_Mailx.xml.in \
+ workflow_MailxCCpp.xml.in \
+ workflow_Upload.xml.in \
+ workflow_UploadCCpp.xml.in \
+ workflow_Logger.xml.in \
+ workflow_LoggerCCpp.xml.in
+
if BUILD_BUGZILLA
EXTRA_DIST += \
diff --git a/src/workflows/report_logger.conf b/src/workflows/report_logger.conf
new file mode 100644
index 0000000..15b9e65
--- /dev/null
+++ b/src/workflows/report_logger.conf
@@ -0,0 +1,6 @@
+# EVENT=workflow_LoggerCCpp analyzer=CCpp
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
+
+# EVENT=workflow_Logger analyzer!=CCpp
+# this must be changed with new workflow
diff --git a/src/workflows/report_mailx.conf b/src/workflows/report_mailx.conf
new file mode 100644
index 0000000..fef2192
--- /dev/null
+++ b/src/workflows/report_mailx.conf
@@ -0,0 +1,6 @@
+# EVENT=workflow_MailxCCpp analyzer=CCpp
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
+
+# EVENT=workflow_Mailx analyzer!=CCpp
+# this must be changed with new workflow
diff --git a/src/workflows/report_uploader.conf b/src/workflows/report_uploader.conf
new file mode 100644
index 0000000..7f17f52
--- /dev/null
+++ b/src/workflows/report_uploader.conf
@@ -0,0 +1,6 @@
+# EVENT=workflow_UploadCCpp analyzer=CCpp
+# this is just a meta event which consists of other events
+# the list is defined in the xml file
+
+# EVENT=workflow_Upload analyzer!=CCpp
+# this must be changed with new workflow
diff --git a/src/workflows/workflow_Logger.xml.in b/src/workflows/workflow_Logger.xml.in
new file mode 100644
index 0000000..3ffe878
--- /dev/null
+++ b/src/workflows/workflow_Logger.xml.in
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+ <_name>Export the problem data information to a text file</_name>
+ <_description>Analyze the problem locally and export the problem data information to a text file</_description>
+ <priority>-99</priority>
+
+ <events>
+ <event>collect_*</event>
+ <event>report_Logger</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_LoggerCCpp.xml.in b/src/workflows/workflow_LoggerCCpp.xml.in
new file mode 100644
index 0000000..5dce9f0
--- /dev/null
+++ b/src/workflows/workflow_LoggerCCpp.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+ <_name>Export the problem data information to a text file</_name>
+ <_description>Analyze the problem locally and export the problem data information to a text file</_description>
+ <priority>-99</priority>
+
+ <events>
+ <event>collect_*</event>
+ <event>analyze_CCpp</event>
+ <event>report_Logger</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_Mailx.xml.in b/src/workflows/workflow_Mailx.xml.in
new file mode 100644
index 0000000..63bd576
--- /dev/null
+++ b/src/workflows/workflow_Mailx.xml.in
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+ <_name>Send the problem data via email</_name>
+ <_description>Analyze the problem locally and send information via email</_description>
+ <priority>-99</priority>
+
+ <events>
+ <event>collect_*</event>
+ <event>report_Mailx</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_MailxCCpp.xml.in b/src/workflows/workflow_MailxCCpp.xml.in
new file mode 100644
index 0000000..3dd3bba
--- /dev/null
+++ b/src/workflows/workflow_MailxCCpp.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+ <_name>Send the problem data via email</_name>
+ <_description>Analyze the problem locally and send information via email</_description>
+ <priority>-99</priority>
+
+ <events>
+ <event>collect_*</event>
+ <event>analyze_CCpp</event>
+ <event>report_Mailx</event>
+ </events>
+</workflow>
diff --git a/src/workflows/workflow_Upload.xml.in b/src/workflows/workflow_Upload.xml.in
index 3965f99..a0bc658 100644
--- a/src/workflows/workflow_Upload.xml.in
+++ b/src/workflows/workflow_Upload.xml.in
@@ -5,7 +5,6 @@
<events>
<event>collect_*</event>
- <event>analyze_CCpp</event>
<event>report_Uploader</event>
</events>
-</workflow>
\ No newline at end of file
+</workflow>
diff --git a/src/workflows/workflow_UploadCCpp.xml.in b/src/workflows/workflow_UploadCCpp.xml.in
new file mode 100644
index 0000000..7f22cb8
--- /dev/null
+++ b/src/workflows/workflow_UploadCCpp.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+ <_name>Upload the problem data to a server</_name>
+ <_description>Analyze the problem locally and upload the data via scp or ftp</_description>
+ <priority>-99</priority>
+
+ <events>
+ <event>collect_*</event>
+ <event>analyze_CCpp</event>
+ <event>report_Uploader</event>
+ </events>
+</workflow>
--
1.8.3.1

View File

@ -0,0 +1,161 @@
From 230a615a13012876f820e47f6be583bf32bca95b Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Thu, 18 Sep 2014 23:12:45 +0200
Subject: [LIBREPORT PATCH 78/93] doc: updated manpages reporter-*

Added section FILES to reporter-* manpages and updated section SEE ALSO.

Resolves rhbz#1067143

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>

reporter-upload does not have configuration file on rhel7

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
doc/reporter-bugzilla.txt | 13 ++++++++++++-
doc/reporter-kerneloops.txt | 4 ++++
doc/reporter-mailx.txt | 12 ++++++++++++
doc/reporter-print.txt | 4 ++++
doc/reporter-rhtsupport.txt | 10 +++++++++-
doc/reporter-upload.txt | 5 +++++
doc/reporter-ureport.txt | 8 ++++++++
7 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/doc/reporter-bugzilla.txt b/doc/reporter-bugzilla.txt
index 2feb922..48afb03 100644
--- a/doc/reporter-bugzilla.txt
+++ b/doc/reporter-bugzilla.txt
@@ -191,9 +191,20 @@ the configuration file.
'HTTPS_PROXY'::
the proxy server to use for HTTPS
+FILES
+-----
+/usr/share/libreport/conf.d/plugins/bugzilla.conf::
+ Readonly default configuration files.
+
+/etc/libreport/plugins/bugzilla.conf::
+ Configuration file.
+
+/etc/libreport/plugins/bugzilla_format.conf::
+ Configure formating for reporting.
+
SEE ALSO
--------
-report_event.conf, bugzilla_format.conf
+report_event.conf(5), bugzilla_format.conf(5)
AUTHORS
-------
diff --git a/doc/reporter-kerneloops.txt b/doc/reporter-kerneloops.txt
index 57b0983..b23d517 100644
--- a/doc/reporter-kerneloops.txt
+++ b/doc/reporter-kerneloops.txt
@@ -63,6 +63,10 @@ the configuration file.
'KerneloopsReporter_SubmitURL'::
The URL of the kerneloops tracker.
+SEE ALSO
+--------
+koops_event.conf(5)
+
AUTHORS
-------
* ABRT team
diff --git a/doc/reporter-mailx.txt b/doc/reporter-mailx.txt
index f946653..bd0c63e 100644
--- a/doc/reporter-mailx.txt
+++ b/doc/reporter-mailx.txt
@@ -86,6 +86,18 @@ the configuration file.
Use yes/true/on/1 to attach all binary files from the problem
directory to the email.
+FILES
+-----
+/usr/share/libreport/conf.d/plugins/mailx.conf::
+ Readonly default configuration files.
+
+/etc/libreport/plugins/mailx.conf::
+ Configuration files.
+
+SEE ALSO
+--------
+mailx_event.conf(5), mailx.conf(5), report_mailx.conf(5)
+
AUTHORS
-------
* ABRT team
diff --git a/doc/reporter-print.txt b/doc/reporter-print.txt
index 5a39673..6e35000 100644
--- a/doc/reporter-print.txt
+++ b/doc/reporter-print.txt
@@ -59,6 +59,10 @@ Elements which have more than one line are printed in the form
Output may contain empty lines for better readability.
+SEE ALSO
+--------
+print_event.conf(5)
+
AUTHORS
-------
* ABRT team
diff --git a/doc/reporter-rhtsupport.txt b/doc/reporter-rhtsupport.txt
index 6ac8eff..b018906 100644
--- a/doc/reporter-rhtsupport.txt
+++ b/doc/reporter-rhtsupport.txt
@@ -71,6 +71,14 @@ OPTIONS
-t[ID]::
Upload FILEs to the already created case on RHTSupport site.
+FILES
+-----
+/usr/share/libreport/conf.d/plugins/rhtsupport.conf::
+ Readonly default configuration files.
+
+/etc/libreport/plugins/rhtsupport.conf::
+ Configuration file.
+
SEE ALSO
--------
-abrt_event.conf
+abrt_event.conf(5), rhtsupport.conf(5), rhtsupport_event.conf(5)
diff --git a/doc/reporter-upload.txt b/doc/reporter-upload.txt
index 1464054..8df7ea2 100644
--- a/doc/reporter-upload.txt
+++ b/doc/reporter-upload.txt
@@ -68,6 +68,11 @@ the configuration file.
'Upload_URL'::
The URL where should be the tarball uploaded.
+
+SEE ALSO
+--------
+uploader_event.conf(5)
+
AUTHORS
-------
* ABRT team
diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index 9264cda..fbdb6e9 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -116,6 +116,14 @@ the configuration file.
'uReport_AuthDataItems'::
See AuthDataItems configuration option for details.
+FILES
+-----
+/usr/share/libreport/conf.d/plugins/ureport.conf::
+ Readonly default configuration files.
+
+/etc/libreport/plugins/ureport.conf::
+ Configuration file.
+
SEE ALSO
--------
ureport.conf(5)
--
1.8.3.1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,138 @@
From 2725a768826f832a2b37ee21fa306d6ec02472b9 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 16 Sep 2014 12:57:49 +0200
Subject: [LIBREPORT PATCH 82/93] ureport: support HTTP Basic authentication

Relate to rhbz#1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/ureport.h | 16 ++++++++++++++++
src/lib/ureport.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)

diff --git a/src/include/ureport.h b/src/include/ureport.h
index 3fffed7..3ee12cd 100644
--- a/src/include/ureport.h
+++ b/src/include/ureport.h
@@ -23,6 +23,8 @@
extern "C" {
#endif
+#include "internal_libreport.h"
+
#define UREPORT_CONF_FILE_PATH PLUGINS_CONF_DIR"/ureport.conf"
#define UREPORT_OPTION_VALUE_FROM_CONF(settings, opt, var, tr) do { const char *value = getenv("uReport_"opt); \
@@ -50,6 +52,8 @@ struct ureport_server_config
char *ur_client_cert; ///< Path to certificate used for client
///< authentication (or NULL)
char *ur_client_key; ///< Private key for the certificate
+ char *ur_username; ///< username for basic HTTP auth
+ char *ur_password; ///< password for basic HTTP auth
map_string_t *ur_http_headers; ///< Additional HTTP headers
struct ureport_preferences ur_prefs; ///< configuration for uReport generation
@@ -99,6 +103,18 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
const char *client_auth);
/*
+ * Configure user name and password for HTTP Basic authentication
+ *
+ * @param config Configured structure
+ * @param username User name
+ * @param password Password
+ */
+#define ureport_server_config_set_basic_auth libreport_ureport_server_config_set_basic_auth
+void
+ureport_server_config_set_basic_auth(struct ureport_server_config *config,
+ const char *username, const char *password);
+
+/*
* uReport server response
*/
struct ureport_server_response
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index e1816ef..5453a37 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -70,8 +70,12 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
if (strcmp(client_auth, "") == 0)
{
+ free(config->ur_client_cert);
config->ur_client_cert = NULL;
+
+ free(config->ur_client_key);
config->ur_client_key = NULL;
+
log_notice("Not using client authentication");
}
else if (strcmp(client_auth, "rhsm") == 0)
@@ -181,10 +185,29 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
{
log_notice("Using client certificate: %s", config->ur_client_cert);
log_notice("Using client private key: %s", config->ur_client_key);
+
+ free(config->ur_username);
+ config->ur_username = NULL;
+
+ free(config->ur_password);
+ config->ur_password = NULL;
}
}
void
+ureport_server_config_set_basic_auth(struct ureport_server_config *config,
+ const char *login, const char *password)
+{
+ ureport_server_config_set_client_auth(config, "");
+
+ free(config->ur_username);
+ config->ur_username = xstrdup(login);
+
+ free(config->ur_password);
+ config->ur_password = xstrdup(password);
+}
+
+void
ureport_server_config_load(struct ureport_server_config *config,
map_string_t *settings)
{
@@ -216,6 +239,8 @@ ureport_server_config_init(struct ureport_server_config *config)
config->ur_ssl_verify = true;
config->ur_client_cert = NULL;
config->ur_client_key = NULL;
+ config->ur_username = NULL;
+ config->ur_password = NULL;
config->ur_http_headers = new_map_string();
config->ur_prefs.urp_auth_items = NULL;
}
@@ -229,6 +254,12 @@ ureport_server_config_destroy(struct ureport_server_config *config)
free(config->ur_client_key);
config->ur_client_key = DESTROYED_POINTER;
+ free(config->ur_username);
+ config->ur_username = DESTROYED_POINTER;
+
+ free(config->ur_password);
+ config->ur_password = DESTROYED_POINTER;
+
g_list_free_full(config->ur_prefs.urp_auth_items, free);
config->ur_prefs.urp_auth_items = DESTROYED_POINTER;
@@ -619,6 +650,11 @@ ureport_do_post(const char *json, struct ureport_server_config *config,
post_state->client_cert_path = config->ur_client_cert;
post_state->client_key_path = config->ur_client_key;
}
+ else if (config->ur_username && config->ur_password)
+ {
+ post_state->username = config->ur_username;
+ post_state->password = config->ur_password;
+ }
char **headers = xmalloc(sizeof(char *) * (3 + size_map_string(config->ur_http_headers)));
headers[0] = (char *)"Accept: application/json";
--
1.8.3.1

View File

@ -0,0 +1,379 @@
From c25092c8a9b5fa42cd5388313b1db4d8ad81034f Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 16 Sep 2014 13:34:28 +0200
Subject: [LIBREPORT PATCH 83/93] rhtsupport: submit ureport and attach case ID
to ureport

ABRT Server for RHEL provides an authenticated way of uReport
submission. The authentication can be done via client certificates or
HTTP Basic auth. ABRT client uses the client certificates for
Auto-reporting, but when user wants to report a problem manually he
needs to have special permissions to work with the certificates or he
cannot use this way of authentication. Fortunately, RHEL ABRT Server can
authenticate user via RHTSupport user name an password, but we don't
want to ask users to provide/configure the Customer Portal credentials
twice, hence we will attach a case ID to a bthash from
reporter-rhtsupport.

This commit also addresses complaints about no evidences of sending
uReport to ABRT Server. This commit adds a log message
"Sending ABRT crash statistics data".

Relate to rhbz#1139987, rhbz#1084028

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
doc/reporter-rhtsupport.txt | 18 +++++-
src/include/ureport.h | 13 +++-
src/lib/ureport.c | 13 +++-
src/plugins/reporter-rhtsupport.c | 121 +++++++++++++++++++++++++++++++++++++-
src/plugins/reporter-ureport.c | 2 +-
5 files changed, 162 insertions(+), 5 deletions(-)

diff --git a/doc/reporter-rhtsupport.txt b/doc/reporter-rhtsupport.txt
index b018906..c4aa459 100644
--- a/doc/reporter-rhtsupport.txt
+++ b/doc/reporter-rhtsupport.txt
@@ -7,7 +7,7 @@ reporter-rhtsupport - Reports problem to RHTSupport.
SYNOPSIS
--------
-'reporter-rhtsupport' [-v] [-c CONFFILE] -d DIR
+'reporter-rhtsupport' [-v] [-c CONFFILE] [-u -C UR_CONFFILE] -d DIR
Or:
@@ -18,6 +18,9 @@ DESCRIPTION
The tool reads problem directory DIR. Then it logs in to RHTSupport
and creates a new case.
+The tool can be configured to submit an uReport to RHTSupport together with
+creating a new case.
+
The URL to new case is printed to stdout and recorded in 'reported_to'
element in DIR.
@@ -30,6 +33,9 @@ If problem data in DIR was never reported to RHTSupport, upload will fail.
Option -tCASE uploads FILEs to the case CASE on RHTSupport site.
-d DIR is ignored.
+Option -u uploads uReport along with creating a new case. uReport configuration
+is loaded from UR_CONFFILE which defaults to
+/etc/libreport/plugins/ureport.conf.
Configuration file
~~~~~~~~~~~~~~~~~~
@@ -47,6 +53,10 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
'SSLVerify'::
Use yes/true/on/1 to verify server's SSL certificate. (default: yes)
+'SubmitUReport'::
+ Use yes/true/on/1 to enable submitting uReport together wit creating a new
+ case. (default: no)
+
Parameters can be overridden via $RHTSupport_PARAM environment variables.
Integration with ABRT events
@@ -71,6 +81,12 @@ OPTIONS
-t[ID]::
Upload FILEs to the already created case on RHTSupport site.
+-u::
+ Submit uReport together with creating a new case.
+
+-C UR_CONFFILE::
+ Configuration file for submitting uReports.
+
FILES
-----
/usr/share/libreport/conf.d/plugins/rhtsupport.conf::
diff --git a/src/include/ureport.h b/src/include/ureport.h
index 3ee12cd..8bb1f6c 100644
--- a/src/include/ureport.h
+++ b/src/include/ureport.h
@@ -47,7 +47,7 @@ struct ureport_preferences
*/
struct ureport_server_config
{
- const char *ur_url; ///< Web service URL
+ char *ur_url; ///< Web service URL
bool ur_ssl_verify; ///< Verify HOST and PEER certificates
char *ur_client_cert; ///< Path to certificate used for client
///< authentication (or NULL)
@@ -91,6 +91,17 @@ ureport_server_config_load(struct ureport_server_config *config,
map_string_t *settings);
/*
+ * Configure HTTP(S) URL to server's index page
+ *
+ * @param config Where the url is stored
+ * @param server_url Index URL
+ */
+#define ureport_server_config_set_url libreport_ureport_server_config_set_url
+void
+ureport_server_config_set_url(struct ureport_server_config *config,
+ char *server_url);
+
+/*
* Configure client certificate paths
*
* @param config Where the paths are stored
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 5453a37..26f3562 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -62,6 +62,14 @@ error:
}
void
+ureport_server_config_set_url(struct ureport_server_config *config,
+ char *server_url)
+{
+ free(config->ur_url);
+ config->ur_url = server_url;
+}
+
+void
ureport_server_config_set_client_auth(struct ureport_server_config *config,
const char *client_auth)
{
@@ -211,7 +219,7 @@ void
ureport_server_config_load(struct ureport_server_config *config,
map_string_t *settings)
{
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", config->ur_url, (const char *));
+ UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", config->ur_url, xstrdup);
UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLVerify", config->ur_ssl_verify, string_to_bool);
bool include_auth = false;
@@ -248,6 +256,9 @@ ureport_server_config_init(struct ureport_server_config *config)
void
ureport_server_config_destroy(struct ureport_server_config *config)
{
+ free(config->ur_url);
+ config->ur_url = DESTROYED_POINTER;
+
free(config->ur_client_cert);
config->ur_client_cert = DESTROYED_POINTER;
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 55bcda6..cd72c87 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -17,6 +17,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <libtar.h>
+#include "ureport.h"
#include "internal_libreport.h"
#include "client.h"
#include "libreport_curl.h"
@@ -169,6 +170,51 @@ ret_clean:
}
static
+char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *conf)
+{
+ struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
+ if (dd == NULL)
+ return NULL;
+
+ report_result_t *rr_bthash = find_in_reported_to(dd, "uReport");
+ dd_close(dd);
+
+ if (rr_bthash != NULL)
+ {
+ log_notice("uReport has already been submitted.");
+ char *ret = xstrdup(rr_bthash->bthash);
+ free_report_result(rr_bthash);
+ return ret;
+ }
+
+ char *json = ureport_from_dump_dir(dump_dir_name);
+ if (json == NULL)
+ return NULL;
+
+ struct ureport_server_response *resp = ureport_submit(json, conf);
+ free(json);
+ if (resp == NULL)
+ return NULL;
+
+ char *bthash = NULL;
+ if (!resp->urr_is_error)
+ {
+ if (resp->urr_bthash != NULL)
+ bthash = xstrdup(resp->urr_bthash);
+
+ ureport_server_response_save_in_dump_dir(resp, dump_dir_name, conf);
+
+ if (resp->urr_message)
+ log(resp->urr_message);
+ }
+ else if (g_verbose > 2)
+ error_msg(_("Server responded with an error: '%s'"), resp->urr_value);
+
+ ureport_server_response_free(resp);
+ return bthash;
+}
+
+static
char *ask_rh_login(const char *message)
{
char *login = ask(message);
@@ -203,6 +249,40 @@ char *get_param_string(const char *name, map_string_t *settings, const char *dfl
return xstrdup(envvar ? envvar : (get_map_string_item_or_NULL(settings, name) ? : dflt));
}
+static
+void prepare_ureport_configuration(const char *urcfile,
+ map_string_t *settings, struct ureport_server_config *urconf,
+ const char *portal_url, const char *login, const char *password, bool ssl_verify)
+{
+ load_conf_file(urcfile, settings, false);
+ ureport_server_config_init(urconf);
+
+ char *url = NULL;
+ UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", url, xstrdup);
+ if (url == NULL)
+ {
+ ureport_server_config_set_url(urconf, concat_path_file(portal_url, "/telemetry/abrt"));
+ urconf->ur_ssl_verify = ssl_verify;
+ }
+ else
+ {
+ UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLVerify", urconf->ur_ssl_verify, string_to_bool);
+ ureport_server_config_set_url(urconf, url);
+ }
+
+ ureport_server_config_set_basic_auth(urconf, login, password);
+
+ bool include_auth = true;
+ UREPORT_OPTION_VALUE_FROM_CONF(settings, "IncludeAuthData", include_auth, string_to_bool);
+
+ if (include_auth)
+ {
+ const char *auth_items = NULL;
+ UREPORT_OPTION_VALUE_FROM_CONF(settings, "AuthDataItems", auth_items, (const char *));
+ urconf->ur_prefs.urp_auth_items = parse_list(auth_items);
+ }
+}
+
int main(int argc, char **argv)
{
abrt_init(argv);
@@ -217,13 +297,14 @@ int main(int argc, char **argv)
const char *dump_dir_name = ".";
const char *case_no = NULL;
GList *conf_file = NULL;
+ const char *urconf_file = UREPORT_CONF_FILE_PATH;
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"\n"
"& [-v] [-c CONFFILE] -d DIR\n"
"or:\n"
- "& [-v] [-c CONFFILE] [-d DIR] -t[ID] FILE...\n"
+ "& [-v] [-c CONFFILE] [-d DIR] -t[ID] [-u -C UR_CONFFILE] FILE...\n"
"\n"
"Reports a problem to RHTSupport.\n"
"\n"
@@ -240,6 +321,10 @@ int main(int argc, char **argv)
"\n"
"Option -tCASE uploads FILEs to the case CASE on RHTSupport site.\n"
"-d DIR is ignored."
+ "\n"
+ "Option -u sends ABRT crash statistics data (uReport) before creating a new case.\n"
+ "uReport configuration is loaded from UR_CONFFILE which defaults to\n"
+ UREPORT_CONF_FILE_PATH".\n"
);
enum {
OPT_v = 1 << 0,
@@ -247,6 +332,7 @@ int main(int argc, char **argv)
OPT_c = 1 << 2,
OPT_t = 1 << 3,
OPT_f = 1 << 4,
+ OPT_u = 1 << 5,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
@@ -255,6 +341,8 @@ int main(int argc, char **argv)
OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")),
OPT_OPTSTRING('t', NULL, &case_no , "ID" , _("Upload FILEs [to case with this ID]")),
OPT_BOOL( 'f', NULL, NULL , _("Force reporting even if this problem is already reported")),
+ OPT_BOOL( 'u', NULL, NULL , _("Submit uReport before creating a new case")),
+ OPT_STRING( 'C', NULL, &urconf_file , "FILE", _("Configuration file for uReport")),
OPT_END()
};
unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);
@@ -303,6 +391,12 @@ int main(int argc, char **argv)
/* RH has a 250m limit for web attachments (as of 2013) */
envvar ? envvar : (get_map_string_item_or_NULL(settings, "BigSizeMB") ? : "200")
);
+ envvar = getenv("RHTSupport_SubmitUReport");
+ bool submit_ur = string_to_bool(
+ envvar ? envvar :
+ (get_map_string_item_or_NULL(settings, "SubmitUReport") ? :
+ ((opts & OPT_u) ? "1" : "0"))
+ );
free_map_string(settings);
char *base_api_url = xstrdup(url);
@@ -484,6 +578,21 @@ int main(int argc, char **argv)
if (!(opts & OPT_t))
{
+ char *bthash = NULL;
+
+ map_string_t *ursettings = new_map_string();
+ struct ureport_server_config urconf;
+
+ prepare_ureport_configuration(urconf_file, ursettings, &urconf,
+ url, login, password, ssl_verify);
+
+ if (submit_ur)
+ {
+ log(_("Sending ABRT crash statistics data"));
+
+ bthash = submit_ureport(dump_dir_name, &urconf);
+ }
+
log(_("Creating a new case"));
char *product = NULL;
@@ -555,10 +664,20 @@ int main(int argc, char **argv)
}
/* else: error msg was already emitted by dd_opendir */
+ if (bthash)
+ {
+ log(_("Linking ABRT crash statistics record with the case"));
+ ureport_attach_string(bthash, "RHCID", result->url, &urconf);
+ }
+
url = result->url;
result->url = NULL;
free_rhts_result(result);
result = NULL;
+
+ ureport_server_config_destroy(&urconf);
+ free_map_string(ursettings);
+ free(bthash);
}
char *remote_filename = NULL;
diff --git a/src/plugins/reporter-ureport.c b/src/plugins/reporter-ureport.c
index 7bd3fb3..06b5341 100644
--- a/src/plugins/reporter-ureport.c
+++ b/src/plugins/reporter-ureport.c
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
ureport_server_config_load(&config, settings);
if (opts & OPT_u)
- config.ur_url = arg_server_url;
+ ureport_server_config_set_url(&config, xstrdup(arg_server_url));
if (opts & OPT_k)
config.ur_ssl_verify = !insecure;
if (opts & OPT_t)
--
1.8.3.1

View File

@ -0,0 +1,170 @@
From 5ff7f36c1a06f5317241b43999f4f03a21594c79 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 23 Sep 2014 13:54:51 +0200
Subject: [LIBREPORT PATCH 84/93] rhtsupport: check for hints only when
creating a new case

If the check for hints finds something, reporter-rhtsupport asks the
user whether he wants to continue in creating a new case. While it is a
useful feature, the reporter should ask that question only if the user
runs the reporter with option -t (create a new case).

We also want to receive as many uReports as possible, so we need to
submit uReport before checking for hints because the report might
interrupt the reporting process in case of positive hints results.

Related to rhbz#1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-rhtsupport.c | 120 ++++++++++++++++++++------------------
1 file changed, 63 insertions(+), 57 deletions(-)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index cd72c87..47e544d 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -215,6 +215,56 @@ char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *co
}
static
+bool check_for_hints(const char *url, const char *login, const char *password, bool ssl_verify, const char *tempfile)
+{
+ rhts_result_t *result = get_rhts_hints(url, login, password, ssl_verify, tempfile);
+#if 0 /* testing */
+ log("ERR:%d", result->error);
+ log("MSG:'%s'", result->msg);
+ log("BODY:'%s'", result->body);
+ result->error = 0;
+ result->body = xstrdup(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+ "<problems xmlns=\"http://www.redhat.com/gss/strata\">"
+ "<link uri=\"http://access.redhat.com/\" rel=\"help\">The main Red Hat Support web site</link>"
+ "<property name=\"content\">an ABRT report</property>"
+ "<problem>"
+ "<property name=\"source\">a backtrace in the ABRT report</property>"
+ "<link uri=\"https://avalon-ci.gss.redhat.com/kb/docs/DOC-22029\" rel=\"suggestion\">[RHEL 5.3] EVO autocompletion lookup hang</link>"
+ "</problem>"
+ "</problems>"
+ );
+#endif
+ if (result->error)
+ {
+ /* We don't use result->msg here because it looks like this:
+ * Error in file upload at 'URL', HTTP code: 404,
+ * server says: '<?xml...?><error...><code>404</code><message>...</message></error>'
+ * TODO: make server send bare textual msgs, not XML.
+ */
+ error_msg("Error in file upload at '%s', HTTP code: %d", url, result->http_resp_code);
+ }
+ else if (result->body)
+ {
+ /* The message might contain URLs to known solutions and such */
+ char *hint = parse_response_from_RHTS_hint_xml2txt(result->body);
+ if (hint)
+ {
+ hint = append_to_malloced_string(hint, " ");
+ hint = append_to_malloced_string(hint,
+ _("Do you still want to create a RHTSupport ticket?")
+ );
+ int create_ticket = ask_yes_no(hint);
+ free(hint);
+ if (!create_ticket)
+ return true;
+ }
+ }
+ free_rhts_result(result);
+ return false;
+}
+
+static
char *ask_rh_login(const char *message)
{
char *login = ask(message);
@@ -519,63 +569,6 @@ int main(int argc, char **argv)
off_t tempfile_size = stat_st_size_or_die(tempfile);
- if (tempfile_size <= QUERY_HINTS_IF_SMALLER_THAN)
- {
- /* Check for hints and show them if we have something */
- log(_("Checking for hints"));
- result = get_rhts_hints(base_api_url,
- login,
- password,
- ssl_verify,
- tempfile
- );
-#if 0 /* testing */
- log("ERR:%d", result->error);
- log("MSG:'%s'", result->msg);
- log("BODY:'%s'", result->body);
- result->error = 0;
- result->body = xstrdup(
- "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
- "<problems xmlns=\"http://www.redhat.com/gss/strata\">"
- "<link uri=\"http://access.redhat.com/\" rel=\"help\">The main Red Hat Support web site</link>"
- "<property name=\"content\">an ABRT report</property>"
- "<problem>"
- "<property name=\"source\">a backtrace in the ABRT report</property>"
- "<link uri=\"https://avalon-ci.gss.redhat.com/kb/docs/DOC-22029\" rel=\"suggestion\">[RHEL 5.3] EVO autocompletion lookup hang</link>"
- "</problem>"
- "</problems>"
- );
-#endif
- if (result->error)
- {
- /* We don't use result->msg here because it looks like this:
- * Error in file upload at 'URL', HTTP code: 404,
- * server says: '<?xml...?><error...><code>404</code><message>...</message></error>'
- * TODO: make server send bare textual msgs, not XML.
- */
- error_msg("Error in file upload at '%s', HTTP code: %d",
- base_api_url, result->http_resp_code);
- }
- if (result->error == 0 && result->body)
- {
- /* The message might contain URLs to known solutions and such */
- char *hint = parse_response_from_RHTS_hint_xml2txt(result->body);
- if (hint)
- {
- hint = append_to_malloced_string(hint, " ");
- hint = append_to_malloced_string(hint,
- _("Do you still want to create a RHTSupport ticket?")
- );
- int create_ticket = ask_yes_no(hint);
- free(hint);
- if (!create_ticket)
- goto ret;
- }
- }
- free_rhts_result(result);
- result = NULL;
- }
-
if (!(opts & OPT_t))
{
char *bthash = NULL;
@@ -593,6 +586,19 @@ int main(int argc, char **argv)
bthash = submit_ureport(dump_dir_name, &urconf);
}
+ if (tempfile_size <= QUERY_HINTS_IF_SMALLER_THAN)
+ {
+ /* Check for hints and show them if we have something */
+ log(_("Checking for hints"));
+ if (check_for_hints(base_api_url, login, password, ssl_verify, tempfile))
+ {
+ ureport_server_config_destroy(&urconf);
+ free_map_string(ursettings);
+ free(bthash);
+ goto ret;
+ }
+ }
+
log(_("Creating a new case"));
char *product = NULL;
--
1.8.3.1

View File

@ -0,0 +1,108 @@
From b4379865f019888e3e0c6480e7ba02711168b17a Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 23 Sep 2014 16:12:33 +0200
Subject: [LIBREPORT PATCH 85/93] ureport: provide default URLs

We have two general use cases:
1. Completely anonymous uReporting
2. Authenticated uReporting

For good security reasons, we have to use a standalone server for each of
these use cases and this requirement complicates the configuration.
Users would have to change two options to switch between these two
configurations.

The configuration can be simplified by providing default URL for both of
them and single out the URL according to state of the "SSLClientAuth"
configuration option.

1. Completely anonymous uReporting
- empty "SSLClientAuth"

2. Authenticated uReporting
- "rhsm" or "rhsm-entitlement" in "SSLClientAuth"

Related to rhbz#1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/ureport.c | 9 +++++++++
src/plugins/reporter-ureport.c | 4 +++-
src/plugins/ureport.conf | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 26f3562..1a1520a 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -30,6 +30,8 @@
#define BTHASH_URL_SFX "reports/bthash/"
+#define RHSM_WEB_SERVICE_URL "https://api.access.redhat.com/rs/telemetry/abrt"
+
#define RHSM_CERT_PATH "/etc/pki/consumer/cert.pem"
#define RHSM_KEY_PATH "/etc/pki/consumer/key.pem"
@@ -39,6 +41,7 @@
#define RHSMENT_SIG_DATA_BEGIN_TAG "-----BEGIN RSA SIGNATURE-----"
#define RHSMENT_SIG_DATA_END_TAG "-----END RSA SIGNATURE-----"
+
static char *
puppet_config_print(const char *key)
{
@@ -88,11 +91,17 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
}
else if (strcmp(client_auth, "rhsm") == 0)
{
+ if (config->ur_url == NULL)
+ ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
+
config->ur_client_cert = xstrdup(RHSM_CERT_PATH);
config->ur_client_key = xstrdup(RHSM_KEY_PATH);
}
else if (strcmp(client_auth, "rhsm-entitlement") == 0)
{
+ if (config->ur_url == NULL)
+ ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
+
GList *certs = get_file_list(RHSMENT_PEM_DIR_PATH, "pem");
if (g_list_length(certs) != 2)
{
diff --git a/src/plugins/reporter-ureport.c b/src/plugins/reporter-ureport.c
index 06b5341..f15d56d 100644
--- a/src/plugins/reporter-ureport.c
+++ b/src/plugins/reporter-ureport.c
@@ -22,6 +22,8 @@
#include "ureport.h"
#include "libreport_curl.h"
+#define DEFAULT_WEB_SERVICE_URL "http://bug-report.itos.redhat.com"
+
int main(int argc, char **argv)
{
setlocale(LC_ALL, "");
@@ -112,7 +114,7 @@ int main(int argc, char **argv)
}
if (!config.ur_url)
- error_msg_and_die("You need to specify server URL");
+ ureport_server_config_set_url(&config, xstrdup(DEFAULT_WEB_SERVICE_URL));
if (ureport_hash && ureport_hash_from_rt)
error_msg_and_die("You need to pass either -a bthash or -A");
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index fc0dc21..a20695d 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -1,5 +1,5 @@
# Base URL to uReport server
-URL = http://bug-report.itos.redhat.com
+# URL = http://bug-report.itos.redhat.com
# no means that ssl certificates will not be checked
# SSLVerify = no
--
1.8.3.1

View File

@ -0,0 +1,106 @@
From ed3b5cebd6b78da4f52d0c417f03550109262f5c Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 23 Sep 2014 20:55:48 +0200
Subject: [LIBREPORT PATCH 86/93] ureport: include AuthDataItems if
SSLClientAuth is configured

Forcing users to configure more than one configuration option to enable
Authenticated uReporting isn't good idea. So for sake of simplicity
reporter-ureport will add the AuthDataItems in to an uReport by default
if the SSLClientAuth is set to some value. Putting 'no' to
the IncludeAuthData configuration option, stops reporter-ureport from
including the AuthDataItems in uReports.

Related to rhbz#1139557

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
doc/reporter-ureport.txt | 9 +++++++--
src/lib/ureport.c | 11 ++++++-----
src/plugins/ureport.conf | 8 ++++++--
3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index fbdb6e9..551bbda 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -29,8 +29,10 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
'SSLClientAuth'::
If this option is set, client-side SSL certificate is used to authenticate
- to the server so that it knows which machine it came from. Possible values
- are:
+ to the server so that it knows which machine it came from. Assigning any value to
+ this option changes the default value of IncludeAuthData to yes.
+
+ Possible values are:
'rhsm';;
Uses the system certificate that is used for Red Hat subscription management.
@@ -49,6 +51,9 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
consisting from key value pairs made from CSV list stored in 'AuthDataItems'
option. Keys are file names and values are bites of these files.
+ The default value is no, unless you set SSLClientAuth to some value. In that
+ case, the default value is yes.
+
'AuthDataItems'::
CSV list of files included in the 'auth' uReport object.
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 1a1520a..f906f3e 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -231,7 +231,12 @@ ureport_server_config_load(struct ureport_server_config *config,
UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", config->ur_url, xstrdup);
UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLVerify", config->ur_ssl_verify, string_to_bool);
- bool include_auth = false;
+ const char *client_auth = NULL;
+ UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLClientAuth", client_auth, (const char *));
+ ureport_server_config_set_client_auth(config, client_auth);
+
+ /* If SSLClientAuth is configured, include the auth items by default. */
+ bool include_auth = !!config->ur_client_cert;
UREPORT_OPTION_VALUE_FROM_CONF(settings, "IncludeAuthData", include_auth, string_to_bool);
if (include_auth)
@@ -243,10 +248,6 @@ ureport_server_config_load(struct ureport_server_config *config,
if (config->ur_prefs.urp_auth_items == NULL)
log_warning("IncludeAuthData set to 'yes' but AuthDataItems is empty.");
}
-
- const char *client_auth = NULL;
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLClientAuth", client_auth, (const char *));
- ureport_server_config_set_client_auth(config, client_auth);
}
void
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index a20695d..e7bd66b 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -8,14 +8,18 @@
# ContactEmail = foo@example.com
# yes means that uReport will contain 'auth' object consisting
-# from key value pairs made from AuthDataItems
+# from key value pairs made from AuthDataItems.
+# The default value is 'no', unless you set 'SSLClientAuth' to some value.
+# In that case, the default value is 'yes'.
# IncludeAuthData = yes
# If IncludeAuthData is set to yes, these fields will be included
# in 'auth' object
AuthDataItems = hostname, machineid
-# Client-side authentication
+# Client-side authentication.
+# Assingning any value to 'SSLClientAuth' changes the default value of
+# 'IncludeAuthData' to 'yes'.
# None (default):
# SSLClientAuth =
# Using RH subscription management certificate:
--
1.8.3.1

View File

@ -0,0 +1,31 @@
From 69c1f48a09b991ea2ed078c977d4f35fd47f5878 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 25 Sep 2014 16:28:35 +0200
Subject: [LIBREPORT PATCH 87/93] report_RHTSupport: adapt event to the recent
changes

Resolves: rhbz#1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/rhtsupport_event.conf | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/plugins/rhtsupport_event.conf b/src/plugins/rhtsupport_event.conf
index 58261bb..f6a9d47 100644
--- a/src/plugins/rhtsupport_event.conf
+++ b/src/plugins/rhtsupport_event.conf
@@ -1,8 +1,3 @@
EVENT=report_RHTSupport
- # Uploads an ureport to update Crash Statistics used to identify the
- # hottest bugs that needs to be fixed first.
- # Failures of reporter-ureport must not prevent users from reporting
- # problems to Red Hat support engineers.
- reporter-ureport || true
- # Create a case in Red Hat Customer Portal
- reporter-rhtsupport
+ # Submit an uReport and create a case in Red Hat Customer Portal
+ reporter-rhtsupport -u
--
1.8.3.1

View File

@ -0,0 +1,136 @@
From 9a03b1ede8320c7cd82a1093f620ebcf4c3efb3d Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 26 Sep 2014 19:56:28 +0200
Subject: [LIBREPORT PATCH 88/93] bugzilla: add comment to closed bugs too

Resolves rhbz#1056101

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-bugzilla.c | 103 ++++++++++++++++++++++++----------------
1 file changed, 62 insertions(+), 41 deletions(-)

diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 45aa2cc..097924e 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -1266,54 +1266,75 @@ int main(int argc, char **argv)
}
}
- if (strcmp(bz->bi_status, "CLOSED") != 0)
+ /* We used to skip adding the comment to CLOSED bugs:
+ *
+ * if (strcmp(bz->bi_status, "CLOSED") != 0)
+ * {
+ *
+ * But that condition has been added without a good explanation of the
+ * reason for doing so:
+ *
+ * ABRT commit 1bf37ad93e87f065347fdb7224578d55cca8d384
+ *
+ * - if (bug_id > 0)
+ * + if (strcmp(bz.bug_status, "CLOSED") != 0)
+ *
+ *
+ * From my point of view, there is no good reason to not add the comment to
+ * such a bug. The reporter spent several minutes waiting for the backtrace
+ * and we don't want to make the reporters feel that they spent their time
+ * in vain and I think that adding comments to already closed bugs doesn't
+ * hurt the maintainers (at least not me).
+ *
+ * Plenty of new comments might convince the maintainer to reconsider the
+ * bug's status.
+ */
+
+ /* Add user's login to CC if not there already */
+ if (strcmp(bz->bi_reporter, rhbz.b_login) != 0
+ && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0)
+ ) {
+ log(_("Adding %s to CC list"), rhbz.b_login);
+ rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY);
+ }
+
+ /* Add comment and bt */
+ const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
+ if (comment && comment[0])
{
- /* Add user's login to CC if not there already */
- if (strcmp(bz->bi_reporter, rhbz.b_login) != 0
- && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0)
- ) {
- log(_("Adding %s to CC list"), rhbz.b_login);
- rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY);
- }
+ GList *comment_fmt_spec = load_bzrep_conf_file(fmt_file2);
+ struct strbuf *bzcomment_buf = strbuf_new();
+ generate_bz_comment(bzcomment_buf, problem_data, comment_fmt_spec);
+ char *bzcomment = strbuf_free_nobuf(bzcomment_buf);
+//TODO: free_comment_fmt_spec(comment_fmt_spec);
- /* Add comment and bt */
- const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
- if (comment && comment[0])
+ int dup_comment = is_comment_dup(bz->bi_comments, bzcomment);
+ if (!dup_comment)
{
- GList *comment_fmt_spec = load_bzrep_conf_file(fmt_file2);
- struct strbuf *bzcomment_buf = strbuf_new();
- generate_bz_comment(bzcomment_buf, problem_data, comment_fmt_spec);
- char *bzcomment = strbuf_free_nobuf(bzcomment_buf);
-//TODO: free_comment_fmt_spec(comment_fmt_spec);
+ log(_("Adding new comment to bug %d"), bz->bi_id);
+ rhbz_add_comment(client, bz->bi_id, bzcomment, 0);
+ free(bzcomment);
- int dup_comment = is_comment_dup(bz->bi_comments, bzcomment);
- if (!dup_comment)
- {
- log(_("Adding new comment to bug %d"), bz->bi_id);
- rhbz_add_comment(client, bz->bi_id, bzcomment, 0);
- free(bzcomment);
-
- const char *bt = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
- unsigned rating = 0;
- const char *rating_str = problem_data_get_content_or_NULL(problem_data, FILENAME_RATING);
- /* python doesn't have rating file */
- if (rating_str)
- rating = xatou(rating_str);
- if (bt && rating > bz->bi_best_bt_rating)
- {
- char bug_id_str[sizeof(int)*3 + 2];
- sprintf(bug_id_str, "%i", bz->bi_id);
- log(_("Attaching better backtrace"));
- rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt),
- RHBZ_NOMAIL_NOTIFY);
- }
- }
- else
+ const char *bt = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
+ unsigned rating = 0;
+ const char *rating_str = problem_data_get_content_or_NULL(problem_data, FILENAME_RATING);
+ /* python doesn't have rating file */
+ if (rating_str)
+ rating = xatou(rating_str);
+ if (bt && rating > bz->bi_best_bt_rating)
{
- free(bzcomment);
- log(_("Found the same comment in the bug history, not adding a new one"));
+ char bug_id_str[sizeof(int)*3 + 2];
+ sprintf(bug_id_str, "%i", bz->bi_id);
+ log(_("Attaching better backtrace"));
+ rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt),
+ RHBZ_NOMAIL_NOTIFY);
}
}
+ else
+ {
+ free(bzcomment);
+ log(_("Found the same comment in the bug history, not adding a new one"));
+ }
}
log_out:
--
1.8.3.1

View File

@ -0,0 +1,169 @@
From f7a5699843a9f96dbdd796da2f891989dbc0f5fd Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 30 Sep 2014 01:43:08 +0200
Subject: [LIBREPORT PATCH 89/93] lib: handle access denials in upload_file()

curl provides an error code which can be used to detect invalid
credentials.

This patch adds a support for re-trying upload with new credentials.

Related to rhbz#1066486

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/libreport_curl.h | 11 +++++++
src/lib/curl.c | 70 +++++++++++++++++++++++++++++++++++++++++---
2 files changed, 77 insertions(+), 4 deletions(-)

diff --git a/src/include/libreport_curl.h b/src/include/libreport_curl.h
index 7d6fa02..4b41ecc 100644
--- a/src/include/libreport_curl.h
+++ b/src/include/libreport_curl.h
@@ -119,9 +119,20 @@ post_file_as_form(post_state_t *state,
filename, POST_DATA_FROMFILE_AS_FORM_DATA);
}
+enum {
+ UPLOAD_FILE_NOFLAGS = 0,
+ UPLOAD_FILE_HANDLE_ACCESS_DENIALS = 1 << 0,
+};
+
#define upload_file libreport_upload_file
char *upload_file(const char *url, const char *filename);
+#define upload_file_ext libreport_upload_file_ext
+char *upload_file_ext(post_state_t *post_state,
+ const char *url,
+ const char *filename,
+ int flags);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/lib/curl.c b/src/lib/curl.c
index 5ca18dd..f7321b5 100644
--- a/src/lib/curl.c
+++ b/src/lib/curl.c
@@ -17,6 +17,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "internal_libreport.h"
+#include "client.h"
#include "libreport_curl.h"
#include "proxies.h"
@@ -586,6 +587,15 @@ post(post_state_t *state,
*/
char *upload_file(const char *url, const char *filename)
{
+ post_state_t *state = new_post_state(POST_WANT_ERROR_MSG);
+ char *retval = upload_file_ext(state, url, filename, UPLOAD_FILE_NOFLAGS);
+ free_post_state(state);
+
+ return retval;
+}
+
+char *upload_file_ext(post_state_t *state, const char *url, const char *filename, int flags)
+{
/* we don't want to print the whole url as it may contain password
* rhbz#856960
* there can be '@' in the login or password so let's try to find the
@@ -597,8 +607,6 @@ char *upload_file(const char *url, const char *filename)
else
clean_url = url;
- log(_("Sending %s to %s"), filename, clean_url);
-
char *whole_url;
unsigned len = strlen(url);
if (len > 0 && url[len-1] == '/')
@@ -606,7 +614,25 @@ char *upload_file(const char *url, const char *filename)
else
whole_url = xstrdup(url);
- post_state_t *state = new_post_state(POST_WANT_ERROR_MSG);
+
+ const char *username_bck = state->username;
+ const char *password_bck = state->password;
+ char *username = NULL;
+ char *password = NULL;
+
+ /* work around bug in libssh2(curl with scp://)
+ * libssh2_aget_disconnect() calls close(0)
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1147717
+ */
+ int stdin_bck = dup(0);
+
+ /*
+ * Well, goto seems to be the most elegant syntax form here :(
+ * This label is used to re-try the upload with an updated credentials.
+ */
+ do_post:
+
+ log(_("Sending %s to %s"), filename, clean_url);
post(state,
whole_url,
/*content_type:*/ "application/octet-stream",
@@ -615,6 +641,8 @@ char *upload_file(const char *url, const char *filename)
POST_DATA_FROMFILE_PUT
);
+ dup2(stdin_bck, 0);
+
int error = (state->curl_result != 0);
if (error)
{
@@ -623,6 +651,34 @@ char *upload_file(const char *url, const char *filename)
else
/* for example, when source file can't be opened */
error_msg("Error while uploading");
+
+ if ((flags & UPLOAD_FILE_HANDLE_ACCESS_DENIALS) &&
+ (state->curl_result == CURLE_LOGIN_DENIED
+ || state->curl_result == CURLE_REMOTE_ACCESS_DENIED))
+ {
+ char *msg = xasprintf(_("Please enter user name for '%s':"), clean_url);
+ free(username);
+ username = ask(msg);
+ free(msg);
+ if (username != NULL && username[0] != '\0')
+ {
+ msg = xasprintf(_("Please enter password for '%s':"), username);
+ free(password);
+ password = ask_password(msg);
+ free(msg);
+ /* What about empty password? */
+ if (password != NULL && password[0] != '\0')
+ {
+ state->username = username;
+ state->password = password;
+ /*
+ * Re-try with new credentials
+ */
+ goto do_post;
+ }
+ }
+ }
+
free(whole_url);
whole_url = NULL;
}
@@ -632,7 +688,13 @@ char *upload_file(const char *url, const char *filename)
log(_("Successfully sent %s to %s"), filename, clean_url);
}
- free_post_state(state);
+ close(stdin_bck);
+
+ free(password);
+ free(username);
+
+ state->username = username_bck;
+ state->password = password_bck;
return whole_url;
}
--
1.8.3.1

View File

@ -0,0 +1,104 @@
From 5b7d6f911920043671ef8aa0a9e559bfb6f3a3c8 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 30 Sep 2014 01:46:07 +0200
Subject: [LIBREPORT PATCH 90/93] upload: read credentials from environment
variables

We use environment variables for the per-user-configuration.

Adding new configuration options to the configuration file for
credentials doesn't make sense because the credentials can be part of
the URL (everything is plain text in the configuration file). But it
does make sense to add a support for environment variables which are
used to propagate the configuration from the GUI where the URL field is
plain text but the password field cannot be read.

Related to rhbz#1066486

Signed-off-by: Jakub Filak <jfilak@redhat.com>

Conflicts:
doc/reporter-upload.txt
---
doc/reporter-upload.txt | 5 +++++
src/plugins/report_Uploader.xml.in | 10 ++++++++++
src/plugins/reporter-upload.c | 24 +++++++++++++++++++++++-
3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/doc/reporter-upload.txt b/doc/reporter-upload.txt
index 8df7ea2..e813c58 100644
--- a/doc/reporter-upload.txt
+++ b/doc/reporter-upload.txt
@@ -68,6 +68,11 @@ the configuration file.
'Upload_URL'::
The URL where should be the tarball uploaded.
+'Upload_Username'::
+ User name for the upload URL
+
+'Upload_Password'::
+ Password for the upload URL
SEE ALSO
--------
diff --git a/src/plugins/report_Uploader.xml.in b/src/plugins/report_Uploader.xml.in
index df01e21..a136aad 100644
--- a/src/plugins/report_Uploader.xml.in
+++ b/src/plugins/report_Uploader.xml.in
@@ -19,6 +19,16 @@
<_note-html>Examples:&#xA;ftp://[user[:pass]@]host/dir/[file.tar.gz]&#xA;scp://[user[:pass]@]host/dir/[file.tar.gz]&#xA;file:///dir/[file.tar.gz]</_note-html>
<default-value></default-value>
</option>
+ <option type="text" name="Upload_Username">
+ <_label>User name</_label>
+ <allow-empty>no</allow-empty>
+ <_description>Use this field if you do not want to have user name in URL</_description>
+ </option>
+ <option type="password" name="Upload_Password">
+ <_label>Password</_label>
+ <allow-empty>no</allow-empty>
+ <_description>Use this field if you do not want to have password in URL</_description>
+ </option>
<advanced-options>
<option type="text" name="http_proxy">
<_label>HTTP Proxy</_label>
diff --git a/src/plugins/reporter-upload.c b/src/plugins/reporter-upload.c
index 7783557..f934953 100644
--- a/src/plugins/reporter-upload.c
+++ b/src/plugins/reporter-upload.c
@@ -148,9 +148,31 @@ static int create_and_upload_archive(
/* Upload from /tmp to /tmp + deletion -> BAD, exclude this possibility */
if (url && url[0] && strcmp(url, "file://"LARGE_DATA_TMP_DIR"/") != 0)
{
- char *remote_name = upload_file(url, tempfile);
+ post_state_t *state = new_post_state(POST_WANT_ERROR_MSG);
+ state->username = getenv("Upload_Username");
+ char *password_inp = NULL;
+ if (state->username != NULL && state->username[0] != '\0')
+ {
+ /* Load Password only if Username is configured, it doesn't make */
+ /* much sense to load Password without Username. */
+ state->password = getenv("Upload_Password");
+ if (state->password == NULL && state->password[0] == '\0')
+ {
+ /* Be permissive and nice, ask only once and don't check */
+ /* the result. User can dismiss this prompt but the upload */
+ /* may work somehow??? */
+ char *msg = xasprintf(_("Please enter password for uploading:"), state->username);
+ state->password = password_inp = ask_password(msg);
+ free(msg);
+ }
+ }
+
+ char *remote_name = upload_file_ext(state, url, tempfile, UPLOAD_FILE_HANDLE_ACCESS_DENIALS);
+
result = (remote_name == NULL); /* error if NULL */
free(remote_name);
+ free(password_inp);
+ free_post_state(state);
/* cleanup code will delete tempfile */
}
else
--
1.8.3.1

View File

@ -0,0 +1,250 @@
From 097869274a0fe107587226c117a4b7288d37cea0 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 26 Sep 2014 18:40:46 +0200
Subject: [LIBREPORT PATCH 91/93] rhtsupport: re-prompt for credentials

Resolves rhbz#1104313

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/include/ureport.h | 11 ++++
src/lib/ureport.c | 2 +-
src/plugins/reporter-rhtsupport.c | 117 ++++++++++++++++++++++++++++++--------
3 files changed, 106 insertions(+), 24 deletions(-)

diff --git a/src/include/ureport.h b/src/include/ureport.h
index 8bb1f6c..104e8d0 100644
--- a/src/include/ureport.h
+++ b/src/include/ureport.h
@@ -216,6 +216,17 @@ struct ureport_server_response *
ureport_submit(const char *json_ureport, struct ureport_server_config *config);
/*
+ * Build a new uReport attachement from give arguments
+ *
+ * @param bthash ID of uReport
+ * @param type Type of attachement recognized by uReport Server
+ * @param data Attached data
+ * @returm Malloced JSON string
+ */
+char *
+ureport_json_attachment_new(const char *bthash, const char *type, const char *data);
+
+/*
* Attach given string to uReport
*
* @param bthash uReport identifier
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index f906f3e..7e71c51 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -742,7 +742,7 @@ ureport_submit(const char *json, struct ureport_server_config *config)
return resp;
}
-static char *
+char *
ureport_json_attachment_new(const char *bthash, const char *type, const char *data)
{
struct json_object *attachment = json_object_new_object();
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 47e544d..c063f3f 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -26,6 +26,22 @@
#define QUERY_HINTS_IF_SMALLER_THAN (8*1024*1024)
+static void ask_rh_credentials(char **login, char **password);
+
+#define INVALID_CREDENTIALS_LOOP(l, p, r, fncall) \
+ do {\
+ r = fncall;\
+ if (r->error == 0 || r->http_resp_code != 401 ) { break; }\
+ ask_rh_credentials(&l, &p);\
+ free_rhts_result(r);\
+ } while (1)
+
+#define STRCPY_IF_NOT_EQUAL(dest, src) \
+ do { if (strcmp(dest, src) != 0 ) { \
+ free(dest); \
+ dest = xstrdup(src); \
+ } } while (0)
+
static report_result_t *get_reported_to(const char *dump_dir_name)
{
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
@@ -170,6 +186,38 @@ ret_clean:
}
static
+struct ureport_server_response *ureport_do_post_credentials(const char *json, struct ureport_server_config *config, const char *action)
+{
+ struct post_state *post_state = NULL;
+ while (1)
+ {
+ post_state = ureport_do_post(json, config, action);
+
+ if (post_state == NULL)
+ {
+ error_msg(_("Failed on submitting the problem"));
+ return NULL;
+ }
+
+ if (post_state->http_resp_code != 401)
+ break;
+
+ free_post_state(post_state);
+
+ char *login = NULL;
+ char *password = NULL;
+ ask_rh_credentials(&login, &password);
+ ureport_server_config_set_basic_auth(config, login, password);
+ free(password);
+ free(login);
+ }
+
+ struct ureport_server_response *resp = ureport_server_response_from_reply(post_state, config);
+ free(post_state);
+ return resp;
+}
+
+static
char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *conf)
{
struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
@@ -191,7 +239,7 @@ char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *co
if (json == NULL)
return NULL;
- struct ureport_server_response *resp = ureport_submit(json, conf);
+ struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_SUBMIT_ACTION);
free(json);
if (resp == NULL)
return NULL;
@@ -215,9 +263,14 @@ char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *co
}
static
-bool check_for_hints(const char *url, const char *login, const char *password, bool ssl_verify, const char *tempfile)
+bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
{
- rhts_result_t *result = get_rhts_hints(url, login, password, ssl_verify, tempfile);
+ rhts_result_t *result = NULL;
+
+ INVALID_CREDENTIALS_LOOP((*login), (*password),
+ result, get_rhts_hints(url, *login, *password, ssl_verify, tempfile)
+ );
+
#if 0 /* testing */
log("ERR:%d", result->error);
log("MSG:'%s'", result->msg);
@@ -291,6 +344,19 @@ char *ask_rh_password(const char *message)
}
static
+void ask_rh_credentials(char **login, char **password)
+{
+ free(*login);
+ free(*password);
+
+ *login = ask_rh_login(_("Invalid password or login. Please enter your Red Hat login:"));
+
+ char *question = xasprintf(_("Invalid password or login. Please enter the password for '%s':"), *login);
+ *password = ask_rh_password(question);
+ free(question);
+}
+
+static
char *get_param_string(const char *name, map_string_t *settings, const char *dflt)
{
char *envname = xasprintf("RHTSupport_%s", name);
@@ -584,13 +650,17 @@ int main(int argc, char **argv)
log(_("Sending ABRT crash statistics data"));
bthash = submit_ureport(dump_dir_name, &urconf);
+
+ /* Ensure that we will use the updated credentials */
+ STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
+ STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
}
if (tempfile_size <= QUERY_HINTS_IF_SMALLER_THAN)
{
/* Check for hints and show them if we have something */
log(_("Checking for hints"));
- if (check_for_hints(base_api_url, login, password, ssl_verify, tempfile))
+ if (check_for_hints(base_api_url, &login, &password, ssl_verify, tempfile))
{
ureport_server_config_destroy(&urconf);
free_map_string(ursettings);
@@ -613,15 +683,9 @@ int main(int argc, char **argv)
error_msg_and_die(_("Can't determine RH Support Product from problem data."));
}
- result = create_new_case(url,
- login,
- password,
- ssl_verify,
- product,
- version,
- summary,
- dsc,
- package
+ INVALID_CREDENTIALS_LOOP(login, password,
+ result, create_new_case(url, login, password, ssl_verify,
+ product, version, summary, dsc, package)
);
free(version);
@@ -673,7 +737,19 @@ int main(int argc, char **argv)
if (bthash)
{
log(_("Linking ABRT crash statistics record with the case"));
- ureport_attach_string(bthash, "RHCID", result->url, &urconf);
+
+ /* Make sure we use the current credentials */
+ ureport_server_config_set_basic_auth(&urconf, login, password);
+
+ /* Do attach */
+ char *json = ureport_json_attachment_new(bthash, "RHCID", result->url);
+ struct ureport_server_response *resp = ureport_do_post_credentials(json, &urconf, UREPORT_ATTACH_ACTION);
+ ureport_server_response_free(resp);
+ free(json);
+
+ /* Update the credentials */
+ STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
+ STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
}
url = result->url;
@@ -705,10 +781,8 @@ int main(int argc, char **argv)
remote_filename
);
free(remote_filename);
- result_atch = add_comment_to_case(url,
- login, password,
- ssl_verify,
- comment_text
+ INVALID_CREDENTIALS_LOOP(login, password,
+ result_atch, add_comment_to_case(url, login, password, ssl_verify, comment_text)
);
free(comment_text);
}
@@ -716,11 +790,8 @@ int main(int argc, char **argv)
{
/* Attach the tarball of -d DIR */
log(_("Attaching problem data to case '%s'"), url);
- result_atch = attach_file_to_case(url,
- login, password,
- ssl_verify,
- tempfile
-
+ INVALID_CREDENTIALS_LOOP(login, password,
+ result_atch, attach_file_to_case(url, login, password, ssl_verify, tempfile)
);
}
if (result_atch->error)
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From 76b1fcd85d86325a4158600cd680da5ce599012d Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 2 Oct 2014 09:19:27 +0200
Subject: [LIBREPORT PATCH 92/93] uploader: correct capitalization of the event
name

Related to rhbz#1014788

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/report_Uploader.xml.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/report_Uploader.xml.in b/src/plugins/report_Uploader.xml.in
index a136aad..7df006a 100644
--- a/src/plugins/report_Uploader.xml.in
+++ b/src/plugins/report_Uploader.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<event>
- <_name>Report uploader</_name>
+ <_name>Report Uploader</_name>
<_description>Upload as tar.gz file (via FTP/SCP/...)</_description>
<requires-items></requires-items>
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From 3fbf503887d6f81b8e05bd9ff09f3f205c6f4eae Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 2 Oct 2014 10:36:25 +0200
Subject: [LIBREPORT PATCH 93/93] lib: process NULL arg as an empty list in
parse_list()

NULL CSV string means empty list

Related to rhbz#1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/glib_support.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/lib/glib_support.c b/src/lib/glib_support.c
index d98c690..6276e9d 100644
--- a/src/lib/glib_support.c
+++ b/src/lib/glib_support.c
@@ -60,6 +60,9 @@ void glib_init(void)
*/
GList *parse_list(const char* list)
{
+ if (list == NULL)
+ return NULL;
+
GList *l = NULL;
char *saved_ptr = NULL;
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
From 4827adfe8b6b6c8583d3115f7244ac3b8b87d609 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Oct 2014 12:26:29 +0200
Subject: [LIBREPORT PATCH 95/97] upload: don't ask for password if the env var
is empty string

Related to rhbz#1066486

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-upload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/reporter-upload.c b/src/plugins/reporter-upload.c
index f934953..84c827b 100644
--- a/src/plugins/reporter-upload.c
+++ b/src/plugins/reporter-upload.c
@@ -156,7 +156,7 @@ static int create_and_upload_archive(
/* Load Password only if Username is configured, it doesn't make */
/* much sense to load Password without Username. */
state->password = getenv("Upload_Password");
- if (state->password == NULL && state->password[0] == '\0')
+ if (state->password == NULL)
{
/* Be permissive and nice, ask only once and don't check */
/* the result. User can dismiss this prompt but the upload */
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From adfc3e694448174cd3589f0c0dd93c86f9692f90 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Oct 2014 12:37:24 +0200
Subject: [LIBREPORT PATCH 96/97] lib: fix a bug in ureport response parser

Revealed by coverity

Related to rhbz1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/ureport.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 7e71c51..0e0472e 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -340,6 +340,7 @@ parse_solution_from_json_list(struct json_object *list,
continue;
cause = json_object_get_string(struct_elem);
+ if (!cause)
continue;
if (!json_object_object_get_ex(list_elem, "note", &struct_elem))
--
1.8.3.1

View File

@ -0,0 +1,60 @@
From ca72d27d29253d9f88e33ac72df4a3ad589bd725 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Oct 2014 12:10:10 +0200
Subject: [LIBREPORT PATCH 97/97] rhtsupport: attach the contact email to
bthash

Resolves #1150388

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-rhtsupport.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index c063f3f..56daf78 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -263,6 +263,16 @@ char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *co
}
static
+void attach_to_ureport(struct ureport_server_config *conf,
+ const char *bthash, const char *attach_id, const char *data)
+{
+ char *json = ureport_json_attachment_new(bthash, attach_id, data);
+ struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_ATTACH_ACTION);
+ ureport_server_response_free(resp);
+ free(json);
+}
+
+static
bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
{
rhts_result_t *result = NULL;
@@ -741,11 +751,17 @@ int main(int argc, char **argv)
/* Make sure we use the current credentials */
ureport_server_config_set_basic_auth(&urconf, login, password);
- /* Do attach */
- char *json = ureport_json_attachment_new(bthash, "RHCID", result->url);
- struct ureport_server_response *resp = ureport_do_post_credentials(json, &urconf, UREPORT_ATTACH_ACTION);
- ureport_server_response_free(resp);
- free(json);
+ /* Attach Customer Case ID*/
+ attach_to_ureport(&urconf, bthash, "RHCID", result->url);
+
+ /* Attach Contact e-mail if configured */
+ const char *email = NULL;
+ UREPORT_OPTION_VALUE_FROM_CONF(ursettings, "ContactEmail", email, (const char *));
+ if (email != NULL)
+ {
+ log(_("Linking ABRT crash statistics record with contact email: '%s'"), email);
+ attach_to_ureport(&urconf, bthash, "email", email);
+ }
/* Update the credentials */
STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 79ac92f08a506527ecd654e22ca0664095a910e3 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 9 Oct 2014 13:16:00 +0200
Subject: [LIBREPORT PATCH 98/99] ureport: document rhsm-entitlement in the man
page

Related: #1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
doc/reporter-ureport.txt | 3 +++
1 file changed, 3 insertions(+)

diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index 551bbda..807f1e1 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -37,6 +37,9 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
'rhsm';;
Uses the system certificate that is used for Red Hat subscription management.
+ 'rhsm-entitlement';;
+ Same as 'rhsm' but uses the V3 RHSM entitlement certificates.
+
'puppet';;
Uses the certificate that is used by the Puppet configuration management tool.
--
1.8.3.1

View File

@ -0,0 +1,103 @@
From 028b35b1fc9b1b373ccecec5aa71606beb825a66 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 9 Oct 2014 14:02:11 +0200
Subject: [LIBREPORT PATCH 99/99] rhtsupport: send ureport before creating
description

Because we want to include the URL to uReport stored in 'reported_to'
file in the description.

Related: #1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-rhtsupport.c | 45 +++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 56daf78..e1c73d0 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -526,6 +526,13 @@ int main(int argc, char **argv)
free_map_string(settings);
char *base_api_url = xstrdup(url);
+ char *bthash = NULL;
+
+ map_string_t *ursettings = new_map_string();
+ struct ureport_server_config urconf;
+
+ prepare_ureport_configuration(urconf_file, ursettings, &urconf,
+ url, login, password, ssl_verify);
if (opts & OPT_t)
{
@@ -592,6 +599,17 @@ int main(int argc, char **argv)
return 0;
}
free_report_result(reported_to);
+
+ if (submit_ur)
+ {
+ log(_("Sending ABRT crash statistics data"));
+
+ bthash = submit_ureport(dump_dir_name, &urconf);
+
+ /* Ensure that we will use the updated credentials */
+ STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
+ STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
+ }
}
/* Gzipping e.g. 0.5gig coredump takes a while. Let user know what we are doing */
@@ -647,25 +665,6 @@ int main(int argc, char **argv)
if (!(opts & OPT_t))
{
- char *bthash = NULL;
-
- map_string_t *ursettings = new_map_string();
- struct ureport_server_config urconf;
-
- prepare_ureport_configuration(urconf_file, ursettings, &urconf,
- url, login, password, ssl_verify);
-
- if (submit_ur)
- {
- log(_("Sending ABRT crash statistics data"));
-
- bthash = submit_ureport(dump_dir_name, &urconf);
-
- /* Ensure that we will use the updated credentials */
- STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
- STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
- }
-
if (tempfile_size <= QUERY_HINTS_IF_SMALLER_THAN)
{
/* Check for hints and show them if we have something */
@@ -772,10 +771,6 @@ int main(int argc, char **argv)
result->url = NULL;
free_rhts_result(result);
result = NULL;
-
- ureport_server_config_destroy(&urconf);
- free_map_string(ursettings);
- free(bthash);
}
char *remote_filename = NULL;
@@ -842,6 +837,10 @@ int main(int argc, char **argv)
free_rhts_result(result_atch);
free_rhts_result(result);
+ ureport_server_config_destroy(&urconf);
+ free_map_string(ursettings);
+ free(bthash);
+
free(base_api_url);
free(url);
free(login);
--
1.8.3.1

View File

@ -0,0 +1,100 @@
From 52928f385d8a0885ba7cc6a110d4ff6dc4ab91e6 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 08:00:39 +0200
Subject: [LIBREPORT PATCH 100/105] ureport: allow multiple cert file in
rhsm-entitlement dir

Thanks Martin Milata <mmilata@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1140224#c6

Related to #1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/ureport.c | 54 +++++++++++++++++++++++-------------------------------
1 file changed, 23 insertions(+), 31 deletions(-)

diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 0e0472e..99e84ef 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -103,52 +103,44 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
GList *certs = get_file_list(RHSMENT_PEM_DIR_PATH, "pem");
- if (g_list_length(certs) != 2)
+ if (g_list_length(certs) < 2)
{
+ g_list_free_full(certs, (GDestroyNotify)free_file_obj);
+
log_notice(RHSMENT_PEM_DIR_PATH" does not contain unique cert-key files pair");
log_notice("Not using client authentication");
return;
}
- const char *cert = NULL;
- const char *key = NULL;
-
- file_obj_t *fst = (file_obj_t *)certs->data;
- file_obj_t *scn = (file_obj_t *)certs->next->data;
-
- if (strlen(fo_get_filename(fst)) < strlen(fo_get_filename(scn)))
+ /* Use the last non-key file found. */
+ file_obj_t *cert = NULL;
+ for (GList *iter = certs; iter != NULL; iter = g_list_next(iter))
{
- cert = fo_get_filename(fst);
- key = fo_get_filename(scn);
+ file_obj_t *tmp = (file_obj_t *)iter->data;
+ const char *file_name = fo_get_filename(tmp);
- config->ur_client_cert = xstrdup(fo_get_fullpath(fst));
- config->ur_client_key = xstrdup(fo_get_fullpath(scn));
+ if (suffixcmp(file_name, "-key"))
+ cert = tmp;
}
- else
+
+ if (cert == NULL)
{
- cert = fo_get_filename(scn);
- key = fo_get_filename(fst);
+ g_list_free_full(certs, (GDestroyNotify)free_file_obj);
- config->ur_client_cert = xstrdup(fo_get_fullpath(scn));
- config->ur_client_key = xstrdup(fo_get_fullpath(fst));
+ log_notice(RHSMENT_PEM_DIR_PATH" contains only key files");
+ log_notice("Not using client authentication");
+ return;
}
- const bool iscomplement = prefixcmp(key, cert) != 0 || strcmp("-key", key + strlen(cert)) != 0;
- g_list_free_full(certs, (GDestroyNotify)free_file_obj);
+ config->ur_client_cert = xstrdup(fo_get_fullpath(cert));
+ /* Yes, the key file may not exists. I over took this code from
+ * sos-uploader and they are pretty happy with this approach, so why
+ * shouldn't we?. */
+ config->ur_client_key = xasprintf("%s/%s-key.pem", RHSMENT_PEM_DIR_PATH, fo_get_filename(cert));
- if (iscomplement)
- {
- log_notice("Key file '%s' isn't complement to cert file '%s'",
- config->ur_client_key, config->ur_client_cert);
- log_notice("Not using client authentication");
-
- free(config->ur_client_cert);
- free(config->ur_client_key);
- config->ur_client_cert = NULL;
- config->ur_client_key = NULL;
+ log_debug("Using cert files: '%s' : '%s'", config->ur_client_cert, config->ur_client_key);
- return;
- }
+ g_list_free_full(certs, (GDestroyNotify)free_file_obj);
char *certdata = xmalloc_open_read_close(config->ur_client_cert, /*no size limit*/NULL);
if (certdata != NULL)
--
1.8.3.1

View File

@ -0,0 +1,84 @@
From b3ae09a48cf7cb21e3562509717381e4c4133454 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 08:12:44 +0200
Subject: [LIBREPORT PATCH 101/105] ureport: use entit certs with 'rhsm' and
drop 'rhsm-entitlement'

/etc/pki/consumer certificates cannot be used for authentication in
Strata. Martin Milata has correctly pointed out that it does not make
sense to have both 'rhsm' and 'rhsm-entitlement' options.

Related #1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
doc/reporter-ureport.txt | 6 ++----
src/lib/ureport.c | 11 -----------
src/plugins/ureport.conf | 4 +---
3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
index 807f1e1..1a67441 100644
--- a/doc/reporter-ureport.txt
+++ b/doc/reporter-ureport.txt
@@ -35,10 +35,8 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
Possible values are:
'rhsm';;
- Uses the system certificate that is used for Red Hat subscription management.
-
- 'rhsm-entitlement';;
- Same as 'rhsm' but uses the V3 RHSM entitlement certificates.
+ Uses the system V3 entitlement certificate that is used for Red Hat
+ subscription management.
'puppet';;
Uses the certificate that is used by the Puppet configuration management tool.
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 99e84ef..5782b4e 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -32,9 +32,6 @@
#define RHSM_WEB_SERVICE_URL "https://api.access.redhat.com/rs/telemetry/abrt"
-#define RHSM_CERT_PATH "/etc/pki/consumer/cert.pem"
-#define RHSM_KEY_PATH "/etc/pki/consumer/key.pem"
-
#define RHSMENT_PEM_DIR_PATH "/etc/pki/entitlement"
#define RHSMENT_ENT_DATA_BEGIN_TAG "-----BEGIN ENTITLEMENT DATA-----"
#define RHSMENT_ENT_DATA_END_TAG "-----END ENTITLEMENT DATA-----"
@@ -94,14 +91,6 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
if (config->ur_url == NULL)
ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
- config->ur_client_cert = xstrdup(RHSM_CERT_PATH);
- config->ur_client_key = xstrdup(RHSM_KEY_PATH);
- }
- else if (strcmp(client_auth, "rhsm-entitlement") == 0)
- {
- if (config->ur_url == NULL)
- ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
-
GList *certs = get_file_list(RHSMENT_PEM_DIR_PATH, "pem");
if (g_list_length(certs) < 2)
{
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
index e7bd66b..9e0415f 100644
--- a/src/plugins/ureport.conf
+++ b/src/plugins/ureport.conf
@@ -22,10 +22,8 @@ AuthDataItems = hostname, machineid
# 'IncludeAuthData' to 'yes'.
# None (default):
# SSLClientAuth =
-# Using RH subscription management certificate:
-# SSLClientAuth = rhsm
# Using RH subscription management entitlement certificate:
-# SSLClientAuth = rhsm-entitlement
+# SSLClientAuth = rhsm
# Using Puppet certificate:
# SSLClientAuth = puppet
# Using custom certificate:
--
1.8.3.1

View File

@ -0,0 +1,107 @@
From 2b20c9f91342da7744ae40ee623735ab95f83219 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 14:27:00 +0200
Subject: [LIBREPORT PATCH 102/105] ureport: get rhsm entitlement cert dir from
rhsm conf

Related #1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/ureport.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 5782b4e..41f4531 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -32,7 +32,6 @@
#define RHSM_WEB_SERVICE_URL "https://api.access.redhat.com/rs/telemetry/abrt"
-#define RHSMENT_PEM_DIR_PATH "/etc/pki/entitlement"
#define RHSMENT_ENT_DATA_BEGIN_TAG "-----BEGIN ENTITLEMENT DATA-----"
#define RHSMENT_ENT_DATA_END_TAG "-----END ENTITLEMENT DATA-----"
#define RHSMENT_SIG_DATA_BEGIN_TAG "-----BEGIN RSA SIGNATURE-----"
@@ -69,6 +68,33 @@ ureport_server_config_set_url(struct ureport_server_config *config,
config->ur_url = server_url;
}
+static char *
+rhsm_config_get_entitlement_cert_dir(void)
+{
+ char *result = getenv("LIBREPORT_DEBUG_RHSMENT_PEM_DIR_PATH");
+ if (result != NULL)
+ return xstrdup(result);
+
+ result = run_in_shell_and_save_output(0,
+ "python -c \"from rhsm.config import initConfig; print(initConfig().get('rhsm', 'entitlementCertDir'))\"",
+ NULL, NULL);
+
+ /* run_in_shell_and_save_output always returns non-NULL */
+ if (result[0] != '/')
+ goto error;
+
+ char *newline = strchrnul(result, '\n');
+ if (!newline)
+ goto error;
+
+ *newline = '\0';
+ return result;
+error:
+ error_msg("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module.");
+ free(result);
+ return NULL;
+}
+
void
ureport_server_config_set_client_auth(struct ureport_server_config *config,
const char *client_auth)
@@ -91,13 +117,21 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
if (config->ur_url == NULL)
ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
- GList *certs = get_file_list(RHSMENT_PEM_DIR_PATH, "pem");
+ char *rhsm_dir = rhsm_config_get_entitlement_cert_dir();
+ if (rhsm_dir == NULL)
+ {
+ log_notice("Not using client authentication");
+ return;
+ }
+
+ GList *certs = get_file_list(rhsm_dir, "pem");
if (g_list_length(certs) < 2)
{
g_list_free_full(certs, (GDestroyNotify)free_file_obj);
- log_notice(RHSMENT_PEM_DIR_PATH" does not contain unique cert-key files pair");
+ log_notice("'%s' does not contain a cert-key files pair", rhsm_dir);
log_notice("Not using client authentication");
+ free(rhsm_dir);
return;
}
@@ -116,8 +150,9 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
{
g_list_free_full(certs, (GDestroyNotify)free_file_obj);
- log_notice(RHSMENT_PEM_DIR_PATH" contains only key files");
+ log_notice("'%s' does not contain a cert file (only keys)", rhsm_dir);
log_notice("Not using client authentication");
+ free(rhsm_dir);
return;
}
@@ -125,7 +160,8 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
/* Yes, the key file may not exists. I over took this code from
* sos-uploader and they are pretty happy with this approach, so why
* shouldn't we?. */
- config->ur_client_key = xasprintf("%s/%s-key.pem", RHSMENT_PEM_DIR_PATH, fo_get_filename(cert));
+ config->ur_client_key = xasprintf("%s/%s-key.pem", rhsm_dir, fo_get_filename(cert));
+ free(rhsm_dir);
log_debug("Using cert files: '%s' : '%s'", config->ur_client_cert, config->ur_client_key);
--
1.8.3.1

View File

@ -0,0 +1,79 @@
From fca34b5620a6213e1d191bcb99e8757f34bbe0a5 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 09:16:48 +0200
Subject: [LIBREPORT PATCH 103/105] ureport: consistently die on all client
auth errors

Related #1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/ureport.c | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index 41f4531..f4f9b19 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -90,9 +90,8 @@ rhsm_config_get_entitlement_cert_dir(void)
*newline = '\0';
return result;
error:
- error_msg("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module.");
free(result);
- return NULL;
+ error_msg_and_die("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module.");
}
void
@@ -118,21 +117,12 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
char *rhsm_dir = rhsm_config_get_entitlement_cert_dir();
- if (rhsm_dir == NULL)
- {
- log_notice("Not using client authentication");
- return;
- }
GList *certs = get_file_list(rhsm_dir, "pem");
if (g_list_length(certs) < 2)
{
g_list_free_full(certs, (GDestroyNotify)free_file_obj);
-
- log_notice("'%s' does not contain a cert-key files pair", rhsm_dir);
- log_notice("Not using client authentication");
- free(rhsm_dir);
- return;
+ error_msg_and_die("'%s' does not contain a cert-key files pair", rhsm_dir);
}
/* Use the last non-key file found. */
@@ -149,11 +139,7 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
if (cert == NULL)
{
g_list_free_full(certs, (GDestroyNotify)free_file_obj);
-
- log_notice("'%s' does not contain a cert file (only keys)", rhsm_dir);
- log_notice("Not using client authentication");
- free(rhsm_dir);
- return;
+ error_msg_and_die("'%s' does not contain a cert file (only keys)", rhsm_dir);
}
config->ur_client_cert = xstrdup(fo_get_fullpath(cert));
@@ -189,10 +175,7 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
xasprintf(RHSMENT_SIG_DATA_BEGIN_TAG"%s"RHSMENT_SIG_DATA_END_TAG, sig_data));
}
else
- {
- log_notice("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
- log_notice("Not using HTTP authentication headers");
- }
+ error_msg_and_die("Cert file '%s' doesn't contain Entitlement and RSA Signature sections", config->ur_client_cert);
free(sig_data);
free(ent_data);
--
1.8.3.1

View File

@ -0,0 +1,58 @@
From 218ae6bbc9ecd1538bfde2c8033cd1ff82a53bbe Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 10:21:07 +0200
Subject: [LIBREPORT PATCH 104/105] rhtsupport: never use uReport URL from
ureport.config

The GUI reporter always export uReport_URL, thus reporter-rhtsupport
never use the Strata URL.

Moreover, usage of uReport_URL is really bad idea, because a reporter
thinks he is going to send data to the portal but the ureport might end
somewhere else.

Related #1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-rhtsupport.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index e1c73d0..4b74c5c 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -383,18 +383,18 @@ void prepare_ureport_configuration(const char *urcfile,
load_conf_file(urcfile, settings, false);
ureport_server_config_init(urconf);
- char *url = NULL;
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", url, xstrdup);
- if (url == NULL)
- {
- ureport_server_config_set_url(urconf, concat_path_file(portal_url, "/telemetry/abrt"));
- urconf->ur_ssl_verify = ssl_verify;
- }
- else
- {
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLVerify", urconf->ur_ssl_verify, string_to_bool);
- ureport_server_config_set_url(urconf, url);
- }
+ /* The following lines cause that we always use URL from ureport's
+ * configuration becuase the GUI reporter always exports uReport_URL env
+ * var.
+ *
+ * char *url = NULL;
+ * UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", url, xstrdup);
+ * if (url != NULL)
+ * ureport_server_config_set_url(urconf, url);
+ */
+
+ ureport_server_config_set_url(urconf, concat_path_file(portal_url, "/telemetry/abrt"));
+ urconf->ur_ssl_verify = ssl_verify;
ureport_server_config_set_basic_auth(urconf, login, password);
--
1.8.3.1

View File

@ -0,0 +1,53 @@
From d10be6466e36650ae0598772ece838c9df0f9188 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 11:09:43 +0200
Subject: [LIBREPORT PATCH 105/105] rhtsupport: do not leak the hints results

The leak was introduced in commit
5ff7f36c1a06f5317241b43999f4f03a21594c79

Related to rhbz#1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/reporter-rhtsupport.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 4b74c5c..add0d6b 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -275,6 +275,7 @@ void attach_to_ureport(struct ureport_server_config *conf,
static
bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
{
+ bool retval = false;
rhts_result_t *result = NULL;
INVALID_CREDENTIALS_LOOP((*login), (*password),
@@ -317,14 +318,18 @@ bool check_for_hints(const char *url, char **login, char **password, bool ssl_ve
hint = append_to_malloced_string(hint,
_("Do you still want to create a RHTSupport ticket?")
);
- int create_ticket = ask_yes_no(hint);
+
+ /*
+ * 'Yes' to the create ticket question means no hints were found.
+ */
+ retval = !ask_yes_no(hint);
+
free(hint);
- if (!create_ticket)
- return true;
}
}
+
free_rhts_result(result);
- return false;
+ return retval;
}
static
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From 0b86e5f6275b88a0088c63c1ba76b1f682190694 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 23 Oct 2014 11:30:14 +0200
Subject: [LIBREPORT PATCH 106/107] ureport: fall back to the hardcoded rhsm
cert dir

This commit adds a fallback execution path for cases where getting the
rhsm entitlement dir path via an execution of python from the
librepor-web library fails for any reason.

See commit 2b20c9f91342da7744ae40ee623735ab95f83219
Related #1140224

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/lib/ureport.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/ureport.c b/src/lib/ureport.c
index f4f9b19..40b7129 100644
--- a/src/lib/ureport.c
+++ b/src/lib/ureport.c
@@ -32,6 +32,7 @@
#define RHSM_WEB_SERVICE_URL "https://api.access.redhat.com/rs/telemetry/abrt"
+#define RHSMENT_PEM_DIR_PATH "/etc/pki/entitlement"
#define RHSMENT_ENT_DATA_BEGIN_TAG "-----BEGIN ENTITLEMENT DATA-----"
#define RHSMENT_ENT_DATA_END_TAG "-----END ENTITLEMENT DATA-----"
#define RHSMENT_SIG_DATA_BEGIN_TAG "-----BEGIN RSA SIGNATURE-----"
@@ -91,7 +92,8 @@ rhsm_config_get_entitlement_cert_dir(void)
return result;
error:
free(result);
- error_msg_and_die("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module.");
+ error_msg("Failed to get 'rhsm':'entitlementCertDir' from rhsm.config python module. Using "RHSMENT_PEM_DIR_PATH);
+ return xstrdup(RHSMENT_PEM_DIR_PATH);
}
void
--
1.8.3.1

View File

@ -0,0 +1,59 @@
From 9006942dcaf55da71ffab9245e317395a4cca2f0 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 24 Oct 2014 16:23:55 +0200
Subject: [LIBREPORT PATCH 107/109] workflows: do not use the Retrace server
for generating backtrace

The Retrace server is not available for RHEL.

Related to rhbz#1094203

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/workflows/workflow_LoggerCCpp.xml.in | 2 +-
src/workflows/workflow_MailxCCpp.xml.in | 2 +-
src/workflows/workflow_UploadCCpp.xml.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/workflows/workflow_LoggerCCpp.xml.in b/src/workflows/workflow_LoggerCCpp.xml.in
index 5dce9f0..9a67e7e 100644
--- a/src/workflows/workflow_LoggerCCpp.xml.in
+++ b/src/workflows/workflow_LoggerCCpp.xml.in
@@ -6,7 +6,7 @@
<events>
<event>collect_*</event>
- <event>analyze_CCpp</event>
+ <event>analyze_LocalGDB</event>
<event>report_Logger</event>
</events>
</workflow>
diff --git a/src/workflows/workflow_MailxCCpp.xml.in b/src/workflows/workflow_MailxCCpp.xml.in
index 3dd3bba..7b5c9fc 100644
--- a/src/workflows/workflow_MailxCCpp.xml.in
+++ b/src/workflows/workflow_MailxCCpp.xml.in
@@ -6,7 +6,7 @@
<events>
<event>collect_*</event>
- <event>analyze_CCpp</event>
+ <event>analyze_LocalGDB</event>
<event>report_Mailx</event>
</events>
</workflow>
diff --git a/src/workflows/workflow_UploadCCpp.xml.in b/src/workflows/workflow_UploadCCpp.xml.in
index 7f22cb8..fbb9a23 100644
--- a/src/workflows/workflow_UploadCCpp.xml.in
+++ b/src/workflows/workflow_UploadCCpp.xml.in
@@ -6,7 +6,7 @@
<events>
<event>collect_*</event>
- <event>analyze_CCpp</event>
+ <event>analyze_LocalGDB</event>
<event>report_Uploader</event>
</events>
</workflow>
--
1.8.3.1

Some files were not shown because too many files have changed in this diff Show More