summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abrt.spec16
-rw-r--r--lib/Plugins/Makefile.am9
-rw-r--r--lib/Plugins/StrataSignature.GTKBuilder125
-rw-r--r--lib/Plugins/StrataSignature.conf20
-rw-r--r--lib/Plugins/StrataSignature.cpp169
-rw-r--r--lib/Plugins/StrataSignature.h45
6 files changed, 384 insertions, 0 deletions
diff --git a/abrt.spec b/abrt.spec
index fc96d7a..3f1af31 100644
--- a/abrt.spec
+++ b/abrt.spec
@@ -40,6 +40,7 @@ BuildRequires: polkit-devel
BuildRequires: libzip-devel, libtar-devel, bzip2-devel, zlib-devel
BuildRequires: intltool
BuildRequires: bison
+BuildRequires: report-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-libs = %{version}-%{release}
Requires(pre): shadow-utils
@@ -184,6 +185,15 @@ Requires: %{name} = %{version}-%{release}
%description plugin-ticketuploader
Plugin to report bugs into anonymous FTP site associated with ticketing system.
+%package plugin-stratasignature
+Summary: %{name}'s Strata Signature plugin
+Group: System Environment/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: report
+
+%description plugin-stratasignature
+Plugin to send signatures to Strata's signature service.
+
%package plugin-filetransfer
Summary: %{name}'s File Transfer plugin
Group: System Environment/Libraries
@@ -429,6 +439,12 @@ fi
%{_libdir}/%{name}/TicketUploader.GTKBuilder
%{_mandir}/man7/%{name}-TicketUploader.7.gz
+%files plugin-stratasignature
+%defattr(-,root,root,-)
+%config(noreplace) %{_sysconfdir}/%{name}/plugins/StrataSignature.conf
+%{_libdir}/%{name}/libStrataSignature.so*
+%{_libdir}/%{name}/StrataSignature.GTKBuilder
+
%files plugin-filetransfer
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/FileTransfer.conf
diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am
index 139e8b3..5b0424a 100644
--- a/lib/Plugins/Makefile.am
+++ b/lib/Plugins/Makefile.am
@@ -14,6 +14,7 @@ pluginslib_LTLIBRARIES = \
librhticket.la \
libCatcut.la \
libTicketUploader.la \
+ libStrataSignature.la \
libPython.la \
libFileTransfer.la
# libFirefox.la
@@ -23,6 +24,7 @@ dist_pluginslib_DATA = \
Mailx.GTKBuilder \
Bugzilla.GTKBuilder \
TicketUploader.GTKBuilder \
+ StrataSignature.GTKBuilder \
Catcut.GTKBuilder \
KerneloopsReporter.GTKBuilder
@@ -36,6 +38,7 @@ dist_pluginsconf_DATA = \
Bugzilla.conf \
Catcut.conf \
TicketUploader.conf \
+ StrataSignature.conf \
FileTransfer.conf \
Python.conf \
SOSreport.conf
@@ -153,6 +156,12 @@ libTicketUploader_la_LDFLAGS = -avoid-version
libTicketUploader_la_LIBADD = $(CURL_LIBS)
libTicketUploader_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils $(CURL_CFLAGS) -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\"
+# StrataSignature
+libStrataSignature_la_SOURCES = StrataSignature.h StrataSignature.cpp
+libStrataSignature_la_LDFLAGS = -avoid-version
+libStrataSignature_la_LIBADD = -lstrata_client
+libStrataSignature_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\"
+
# Python
libPython_la_SOURCES = Python.h Python.cpp Python_hash.h Python_hash.cpp
#libPython_la_LIBADD = $(NSS_LIBS)
diff --git a/lib/Plugins/StrataSignature.GTKBuilder b/lib/Plugins/StrataSignature.GTKBuilder
new file mode 100644
index 0000000..40947cc
--- /dev/null
+++ b/lib/Plugins/StrataSignature.GTKBuilder
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.14"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkDialog" id="PluginDialog">
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="icon_name">abrt</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">URL:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="conf_URL">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Ticket Uploader plugin configuration&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="bApply">
+ <property name="label">gtk-apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button2</action-widget>
+ <action-widget response="-10">bApply</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkAction" id="action1"/>
+</interface>
diff --git a/lib/Plugins/StrataSignature.conf b/lib/Plugins/StrataSignature.conf
new file mode 100644
index 0000000..97f455c
--- /dev/null
+++ b/lib/Plugins/StrataSignature.conf
@@ -0,0 +1,20 @@
+# Customer = "Example Inc."
+# Ticket = IT12345
+# Encrypt = yes
+# If set to "no" or commented out,
+# compressed ticket data will be copied to /tmp:
+# Upload = yes
+
+# If "Upload = yes", URL to upload the files to.
+# supported: ftp, ftps, http, https, scp, sftp, tftp, file
+# for example: ftp://user:password@server.name/directory
+# or: scp://user:password@server.name:port/directory etc.
+# for testing: file:///tmp/test_directory
+# URL =
+
+# How many times we try to upload the file
+# RetryCount = 3
+
+# How long we wait between we retry the upload (in seconds)
+# RetryDelay = 20
+Enabled = yes
diff --git a/lib/Plugins/StrataSignature.cpp b/lib/Plugins/StrataSignature.cpp
new file mode 100644
index 0000000..5f525fd
--- /dev/null
+++ b/lib/Plugins/StrataSignature.cpp
@@ -0,0 +1,169 @@
+/*
+ StrataSignature.cpp
+
+ Copyright (C) 2009 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 "abrtlib.h"
+#include "abrt_xmlrpc.h" /* for xcurl_easy_init */
+#include "StrataSignature.h"
+#include "DebugDump.h"
+#include "ABRTException.h"
+#include "CommLayerInner.h"
+
+#include "strata_client.h"
+
+using namespace std;
+
+
+CStrataSignature::CStrataSignature()
+{}
+
+CStrataSignature::~CStrataSignature()
+{}
+
+string CStrataSignature::Report(const map_crash_data_t& pCrashData,
+ const map_plugin_settings_t& pSettings,
+ const char *pArgs)
+{
+ string URL;
+
+ map_plugin_settings_t settings = parse_settings(pSettings);
+ if (!settings.empty())
+ {
+ URL = settings["URL"];
+ }
+ else
+ {
+ URL = m_sURL;
+ }
+ update_client(_("Creating a signature..."));
+
+ reportfile_t* file = reportfile_start(1);
+ if (!file)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+
+ // Copy each entry into the tarball root.
+ // Files are simply copied, strings are written to a file
+ // TODO: some files are totally useless:
+ // "Reported", "Message" (plugin's output), "DumpDir",
+ // "Description" (package description) - maybe skip those?
+ int rc;
+ map_crash_data_t::const_iterator it;
+ for (it = pCrashData.begin(); it != pCrashData.end(); it++)
+ {
+ const char *content = it->second[CD_CONTENT].c_str();
+ if (it->second[CD_TYPE] == CD_TXT)
+ {
+ rc = reportfile_add_binding_from_string(file,
+ it->first.c_str(),
+ content, 0, 0);
+ if (rc < 0)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+ }
+ else if (it->second[CD_TYPE] == CD_BIN)
+ {
+ rc = reportfile_add_binding_from_namedfile(file,
+ it->first.c_str(),
+ content, 1, content);
+ if (rc < 0)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+ }
+ }
+
+ rc = reportfile_end(file);
+ if (rc < 0)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+
+ char* signature = reportfile_as_string(file);
+ if (!signature)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+
+ rc = reportfile_free(file);
+ if (rc < 0)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+
+ update_client(_("Creating a signature..."));
+ const char* p = post_signature(URL.c_str(), signature);
+ if (!p)
+ {
+ throw CABRTException(EXCEP_PLUGIN, "%s", strata_client_strerror());
+ }
+
+ string msg = p;
+ free((void*)p);
+ return msg;
+}
+
+void CStrataSignature::SetSettings(const map_plugin_settings_t& pSettings)
+{
+ log("entering CStrataSignature::SetSettings");
+ m_pSettings = pSettings;
+
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("URL");
+ if (it != end)
+ {
+ m_sURL = it->second;
+ }
+}
+
+const map_plugin_settings_t& CStrataSignature::GetSettings()
+{
+ m_pSettings["URL"] = m_sURL;
+ return m_pSettings;
+}
+
+//todo: make static
+map_plugin_settings_t CStrataSignature::parse_settings(const map_plugin_settings_t& pSettings)
+{
+ map_plugin_settings_t plugin_settings;
+
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
+
+ it = pSettings.find("URL");
+ if (it == end)
+ {
+ plugin_settings.clear();
+ return plugin_settings;
+ }
+ plugin_settings["URL"] = it->second;
+ VERB1 log("User settings ok, using them instead of defaults");
+ return plugin_settings;
+}
+
+PLUGIN_INFO(REPORTER,
+ CStrataSignature,
+ "StrataSignature",
+ "0.0.1",
+ "Sends a signature to a Strata signature service.",
+ "gavin@redhat.com",
+ "https://fedorahosted.org/abrt/wiki",
+ PLUGINS_LIB_DIR"/StrataSignature.GTKBuilder");
diff --git a/lib/Plugins/StrataSignature.h b/lib/Plugins/StrataSignature.h
new file mode 100644
index 0000000..55db834
--- /dev/null
+++ b/lib/Plugins/StrataSignature.h
@@ -0,0 +1,45 @@
+/*
+ StrataSignature.h
+
+ Submit a signature to Strata's signature service.
+
+ Copyright (C) 2010 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.
+*/
+#ifndef STRATASIGNATURE_H_
+#define STRATASIGNATURE_H_
+
+#include "Plugin.h"
+#include "Reporter.h"
+
+class CStrataSignature : public CReporter
+{
+ private:
+ std::string m_sURL;
+ map_plugin_settings_t parse_settings(const map_plugin_settings_t& pSettings);
+
+ public:
+ CStrataSignature();
+ virtual ~CStrataSignature();
+ virtual const map_plugin_settings_t& GetSettings();
+ virtual void SetSettings(const map_plugin_settings_t& pSettings);
+
+ virtual std::string Report(const map_crash_data_t& pCrashData,
+ const map_plugin_settings_t& pSettings,
+ const char *pArgs);
+};
+
+#endif