summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2011-04-07 16:51:33 +0200
committerKarel Klic <kklic@redhat.com>2011-04-07 16:51:33 +0200
commit581757d9245c9c8abfcb3bd5e0d12c95af523619 (patch)
tree59642c89daefcaf4e8cd0491adc3e664efcbd93f /src
parentf540d45ddbbe61c07b82446cd24ce870dbb4ff01 (diff)
parent8a9cb205c89d61a7a8198768bac2606df8f508e7 (diff)
downloadabrt-581757d9245c9c8abfcb3bd5e0d12c95af523619.tar.gz
abrt-581757d9245c9c8abfcb3bd5e0d12c95af523619.tar.xz
abrt-581757d9245c9c8abfcb3bd5e0d12c95af523619.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src')
-rw-r--r--src/daemon/CommLayerServerDBus.cpp44
-rw-r--r--src/daemon/Daemon.cpp3
-rw-r--r--src/daemon/MiddleWare.cpp70
-rw-r--r--src/daemon/MiddleWare.h3
-rw-r--r--src/lib/test.cpp105
-rw-r--r--src/plugins/Makefile.am3
-rw-r--r--src/plugins/abrt-action-rhtsupport.c14
7 files changed, 14 insertions, 228 deletions
diff --git a/src/daemon/CommLayerServerDBus.cpp b/src/daemon/CommLayerServerDBus.cpp
index 0f661f23..9fd48b84 100644
--- a/src/daemon/CommLayerServerDBus.cpp
+++ b/src/daemon/CommLayerServerDBus.cpp
@@ -305,46 +305,6 @@ static int handle_DeleteDebugDump(DBusMessage* call, DBusMessage* reply)
return 0;
}
-static int handle_GetPluginsInfo(DBusMessage* call, DBusMessage* reply)
-{
- DBusMessageIter out_iter;
- dbus_message_iter_init_append(reply, &out_iter);
-
- map_map_string_t map_of_plugin_info;
- GetPluginsInfo(map_of_plugin_info);
- store_val(&out_iter, map_of_plugin_info);
-
- send_flush_and_unref(reply);
- return 0;
-}
-
-static int handle_GetPluginSettings(DBusMessage* call, DBusMessage* reply)
-{
- int r;
- DBusMessageIter in_iter;
- dbus_message_iter_init(call, &in_iter);
- const char* PluginName;
- r = load_val(&in_iter, PluginName);
- if (r != ABRT_DBUS_LAST_FIELD)
- {
- error_msg("dbus call %s: parameter type mismatch", __func__ + 7);
- return -1;
- }
-
- //long unix_uid = get_remote_uid(call);
- //VERB1 log("got %s('%s') call from uid %ld", "GetPluginSettings", PluginName, unix_uid);
- map_string_h *plugin_settings = GetPluginSettings(PluginName);
-
- DBusMessageIter out_iter;
- dbus_message_iter_init_append(reply, &out_iter);
- store_map_string(&out_iter, plugin_settings);
-
- free_map_string(plugin_settings);
-
- send_flush_and_unref(reply);
- return 0;
-}
-
static int handle_GetSettings(DBusMessage* call, DBusMessage* reply)
{
map_abrt_settings_t result = GetSettings();
@@ -402,10 +362,6 @@ static DBusHandlerResult message_received(DBusConnection* conn, DBusMessage* msg
r = handle_DeleteDebugDump(msg, reply);
else if (strcmp(member, "CreateReport") == 0)
r = handle_CreateReport(msg, reply);
- else if (strcmp(member, "GetPluginsInfo") == 0)
- r = handle_GetPluginsInfo(msg, reply);
- else if (strcmp(member, "GetPluginSettings") == 0)
- r = handle_GetPluginSettings(msg, reply);
else if (strcmp(member, "GetSettings") == 0)
r = handle_GetSettings(msg, reply);
// looks unused to me.
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp
index 1d0467bb..b1aaf8cf 100644
--- a/src/daemon/Daemon.cpp
+++ b/src/daemon/Daemon.cpp
@@ -65,9 +65,6 @@ using namespace std;
* Returns report_status_t (map_vector_string_t) - the status of each call.
* 2nd parameter is the contents of user's abrt.conf.
* - DeleteDebugDump(crash_id): delete it from DB and delete corresponding /var/spool/abrt/DIR
- * - GetPluginsInfo(): returns map_map_string_t
- * map["plugin"] = { "Name": "plugin", "Enabled": "yes" ... }
- * - GetPluginSettings(PluginName): returns map_plugin_settings_t (map_string_t)
* - RegisterPlugin(PluginName): returns void
* - UnRegisterPlugin(PluginName): returns void
* - GetSettings(): returns map_abrt_settings_t (map_map_string_t)
diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp
index ffc2d633..5ae77080 100644
--- a/src/daemon/MiddleWare.cpp
+++ b/src/daemon/MiddleWare.cpp
@@ -140,7 +140,8 @@ static mw_result_t CreateCrashReport(const char *dump_dir_name,
if (!uid_matches)
{
dd_close(dd);
- error_msg("Dump directory '%s' can't be accessed by user with uid %ld", dump_dir_name, caller_uid);
+ error_msg("Dump directory '%s' can't be accessed by user with uid %ld",
+ dump_dir_name, caller_uid);
r = MW_PERM_ERROR;
goto ret;
}
@@ -777,70 +778,3 @@ int DeleteDebugDump(const char *dump_dir_name, long caller_uid)
return 0; /* success */
}
-
-void GetPluginsInfo(map_map_string_t &map_of_plugin_info)
-{
- DIR *dir = opendir(PLUGINS_CONF_DIR);
- if (!dir)
- return;
-
- struct dirent *dent;
- while ((dent = readdir(dir)) != NULL)
- {
- char *ext = strrchr(dent->d_name, '.');
- if (!ext || strcmp(ext + 1, "conf") != 0)
- continue;
- if (!is_regular_file(dent, PLUGINS_CONF_DIR))
- continue;
- VERB3 log("Found %s", dent->d_name);
- *ext = '\0';
-
- char *glade_file = xasprintf(PLUGINS_LIB_DIR"/%s.glade", dent->d_name);
- if (access(glade_file, F_OK) == 0)
- {
- *ext = '.';
- char *conf_file = concat_path_file(PLUGINS_CONF_DIR, dent->d_name);
- *ext = '\0';
- FILE *fp = fopen(conf_file, "r");
- free(conf_file);
-
- char *descr = NULL;
- if (fp)
- {
- descr = xmalloc_fgetline(fp);
- fclose(fp);
- if (descr && strncmp("# Description:", descr, strlen("# Description:")) == 0)
- overlapping_strcpy(descr, skip_whitespace(descr + strlen("# Description:")));
- else
- {
- free(descr);
- descr = NULL;
- }
- }
- map_string_t plugin_info;
- plugin_info["Name"] = dent->d_name;
- plugin_info["Enabled"] = "yes";
- plugin_info["Type"] = "Reporter"; //was: plugin_type_str[module->GetType()]; field to be removed
- plugin_info["Version"] = VERSION; //was: module->GetVersion(); field to be removed?
- plugin_info["Description"] = descr ? descr : ""; //was: module->GetDescription();
- plugin_info["Email"] = ""; //was: module->GetEmail(); field to be removed
- plugin_info["WWW"] = ""; //was: module->GetWWW(); field to be removed
- plugin_info["GTKBuilder"] = glade_file; //was: module->GetGTKBuilder();
- free(descr);
- map_of_plugin_info[dent->d_name] = plugin_info;
- }
- free(glade_file);
-
- }
- closedir(dir);
-}
-
-map_string_h *GetPluginSettings(const char *plugin_name)
-{
- char *conf_file = xasprintf(PLUGINS_CONF_DIR"/%s.conf", plugin_name);
- map_string_h *settings = new_map_string();
- if (load_conf_file(conf_file, settings, /*skip w/o value:*/ false))
- VERB3 log("Loaded %s.conf", plugin_name);
- free(conf_file);
- return settings;
-}
diff --git a/src/daemon/MiddleWare.h b/src/daemon/MiddleWare.h
index fde29978..b3f6e602 100644
--- a/src/daemon/MiddleWare.h
+++ b/src/daemon/MiddleWare.h
@@ -78,7 +78,4 @@ int CreateReportThread(const char* dump_dir_name, long caller_uid, int force, c
void CreateReport(const char* dump_dir_name, long caller_uid, int force, crash_data_t **crash_data);
int DeleteDebugDump(const char *dump_dir_name, long caller_uid);
-void GetPluginsInfo(map_map_string_t &map_of_plugin_info);
-map_string_h *GetPluginSettings(const char *plugin_name);
-
#endif /*MIDDLEWARE_H_*/
diff --git a/src/lib/test.cpp b/src/lib/test.cpp
deleted file mode 100644
index c8269cd1..00000000
--- a/src/lib/test.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- test.cpp - simple library test
-
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com)
- 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 "MiddleWare.h"
-#include "DebugDump.h"
-#include "CrashTypes.h"
-#include <iostream>
-#include <sys/types.h>
-#include <unistd.h>
-#include <iostream>
-
-
-int main(int argc, char** argv)
-{
-
- if (argc < 2)
- {
- std::cerr << "Usage: " << argv[0] << " <DebugDumpDir>" << std::endl;
- return -1;
- }
- try
- {
- CMiddleWare middleWare(PLUGINS_CONF_DIR,
- PLUGINS_LIB_DIR);
- vector_map_string_t loaded_plugins;
- middleWare.RegisterPlugin("CCpp");
- middleWare.RegisterPlugin("Mailx");
- middleWare.RegisterPlugin("Logger");
- middleWare.RegisterPlugin("SQLite3");
- middleWare.SetDatabase("SQLite3");
- middleWare.SetOpenGPGCheck(false);
- middleWare.AddActionOrReporter("Logger", "");
- middleWare.AddAnalyzerActionOrReporter("CCpp", "Mailx", "");
-
- loaded_plugins = middleWare.GetPluginsInfo();
- std::cout << "Loaded plugins" << std::endl;
- int ii;
- for ( ii = 0; ii < loaded_plugins.size(); ii++)
- {
- std::cout << "-------------------------------------------" << std::endl;
- map_plugin_settings_t settings;
- std::cout << "Enabled: " << loaded_plugins[ii]["Enabled"] << std::endl;
- std::cout << "Type: " << loaded_plugins[ii]["Type"] << std::endl;
- std::cout << "Name: " << loaded_plugins[ii]["Name"] << std::endl;
- std::cout << "Version: " << loaded_plugins[ii]["Version"] << std::endl;
- std::cout << "Description: " << loaded_plugins[ii]["Description"] << std::endl;
- std::cout << "Email: " << loaded_plugins[ii]["Email"] << std::endl;
- std::cout << "WWW: " << loaded_plugins[ii]["WWW"] << std::endl;
- std::cout << "GTKBuilder: " << loaded_plugins[ii]["GTKBuilder"] << std::endl;
- if (loaded_plugins[ii]["Enabled"] == "yes")
- {
- std::cout << std::endl << "Settings: " << std::endl;
- settings = middleWare.GetPluginSettings(loaded_plugins[ii]["Name"]);
- map_plugin_settings_t::iterator it;
- for (it = settings.begin(); it != settings.end(); it++)
- {
- std::cout << "\t" << it->first << ": " << it->second << std::endl;
- }
- }
- std::cout << "-------------------------------------------" << std::endl;
- }
- /* Try to save it into DB */
- map_crash_data_t crashInfo;
- if (middleWare.SaveDebugDump(argv[1], crashInfo))
- {
- std::cout << "Application Crashed! " <<
- crashInfo[FILENAME_PACKAGE][CD_CONTENT] << ", " <<
- crashInfo[FILENAME_EXECUTABLE][CD_CONTENT] << ", " <<
- crashInfo[FILENAME_COUNT][CD_CONTENT] << ", " << std::endl;
-
- /* Get Report, so user can change data (remove private stuff)
- * If we do not want user interaction, just send data immediately
- */
- map_crash_data_t crashReport;
- middleWare.CreateCrashReport(crashInfo[FILENAME_DUPHASH][CD_CONTENT],
- crashInfo[FILENAME_UID][CD_CONTENT],
- crashReport);
- /* Report crash */
- middleWare.Report(crashReport);
- }
- }
- catch (std::string sError)
- {
- std::cerr << sError << std::endl;
- }
-
- return 0;
-}
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 418b5a19..1e3c15d0 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -49,7 +49,8 @@ eventsconfdir = $(EVENTS_CONF_DIR)
dist_eventsconf_DATA = \
ccpp_events.conf \
mailx_events.conf \
- koops_events.conf
+ koops_events.conf \
+ rhtsupport_events.conf
man_MANS = \
abrt-Bugzilla.7 \
diff --git a/src/plugins/abrt-action-rhtsupport.c b/src/plugins/abrt-action-rhtsupport.c
index 6bbf76a0..233b607f 100644
--- a/src/plugins/abrt-action-rhtsupport.c
+++ b/src/plugins/abrt-action-rhtsupport.c
@@ -91,11 +91,16 @@ static void report_to_rhtsupport(
dsc = xasprintf("abrt version: "VERSION"\n%s", bz_dsc);
free(bz_dsc);
}
-
file = new_reportfile();
-
- /* SELinux guys are not happy with /tmp, using /var/run/abrt */
- tempfile = xasprintf(LOCALSTATEDIR"/run/abrt/tmp-%s-%lu.tar.gz", iso_date_string(NULL), (long)getpid());
+ const char *dt_string = iso_date_string(NULL);
+ char tmpdir_name[sizeof("/tmp/rhtsupport-YYYY-MM-DD-hh:mm:ss-XXXXXX")];
+ sprintf(tmpdir_name, "/tmp/rhtsupport-%s-XXXXXX", dt_string);
+ /* mkdtemp does mkdir(xxx, 0700), should be safe (is it?) */
+ if (mkdtemp(tmpdir_name) == NULL)
+ {
+ error_msg_and_die(_("Can't create a temporary directory in /tmp"));
+ }
+ tempfile = xasprintf("%s/tmp-%s-%lu.tar.gz",tmpdir_name, iso_date_string(NULL), (long)getpid());
int pipe_from_parent_to_child[2];
xpipe(pipe_from_parent_to_child);
@@ -236,6 +241,7 @@ static void report_to_rhtsupport(
unlink(tempfile);
free(tempfile);
reportfile_free(file);
+ rmdir(tmpdir_name);
free(summary);
free(dsc);