summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2009-10-29 15:20:56 +0100
committerNikola Pajkovsky <npajkovs@redhat.com>2009-10-29 15:20:56 +0100
commit7f10181be367d77e5f3203e938ab24cf722119df (patch)
tree2c5f02ed0e9174bc3483aee3d0b84f860c314aef
parentad158666b7a144d557a9476408766a7bbf7ace9d (diff)
downloadabrt-7f10181be367d77e5f3203e938ab24cf722119df.tar.gz
abrt-7f10181be367d77e5f3203e938ab24cf722119df.tar.xz
abrt-7f10181be367d77e5f3203e938ab24cf722119df.zip
Normal user can see kerneloops and report it
Bugzilla memory leaks fix
-rw-r--r--lib/Plugins/Bugzilla.cpp27
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp2
-rw-r--r--lib/Plugins/KerneloopsScanner.cpp3
-rw-r--r--lib/Plugins/SQLite3.cpp26
-rw-r--r--src/Applet/Applet.cpp9
-rw-r--r--src/Daemon/Daemon.cpp27
-rw-r--r--src/Daemon/MiddleWare.cpp3
-rw-r--r--src/Daemon/abrt.conf2
8 files changed, 81 insertions, 18 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index be81ebc..2303316 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -106,6 +106,9 @@ static void login(const char* login, const char* passwd)
xmlrpc_client_call2(&env, client, server_info, "User.login", param, &result);
throw_if_fault_occurred(&env);
+
+ xmlrpc_DECREF(result);
+ xmlrpc_DECREF(param);
}
static void logout()
@@ -118,6 +121,9 @@ static void logout()
xmlrpc_client_call2(&env, client, server_info, "User.logout", param, &result);
throw_if_fault_occurred(&env);
+
+ xmlrpc_DECREF(result);
+ xmlrpc_DECREF(param);
}
static bool check_cc_and_reporter(const uint32_t bug_id, const char* login)
@@ -146,6 +152,10 @@ static bool check_cc_and_reporter(const uint32_t bug_id, const char* login)
if (strcmp(reporter, login) == 0 )
{
+ xmlrpc_DECREF(param);
+ xmlrpc_DECREF(result);
+ xmlrpc_DECREF(reporter_member);
+ free((void*)reporter);
return true;
}
}
@@ -169,12 +179,20 @@ static bool check_cc_and_reporter(const uint32_t bug_id, const char* login)
if (strcmp(cc, login) == 0)
{
+ xmlrpc_DECREF(param);
+ xmlrpc_DECREF(result);
+ xmlrpc_DECREF(reporter_member);
+ xmlrpc_DECREF(cc_member);
+ xmlrpc_DECREF(item);
+ free((void*)cc);
return true;
}
}
}
-
+ xmlrpc_DECREF(cc_member);
+ xmlrpc_DECREF(param);
xmlrpc_DECREF(result);
+ xmlrpc_DECREF(reporter_member);
return false;
}
@@ -190,6 +208,7 @@ static void add_plus_one_cc(const uint32_t bug_id, const char* login)
throw_if_fault_occurred(&env);
xmlrpc_DECREF(result);
+ xmlrpc_DECREF(param);
}
static int32_t check_uuid_in_bugzilla(const char* component, const char* UUID)
@@ -237,12 +256,14 @@ static int32_t check_uuid_in_bugzilla(const char* component, const char* UUID)
xmlrpc_DECREF(bug);
xmlrpc_DECREF(item);
xmlrpc_DECREF(bugs_member);
+ xmlrpc_DECREF(param);
return bug_id;
}
}
xmlrpc_DECREF(result);
xmlrpc_DECREF(bugs_member);
+ xmlrpc_DECREF(param);
return -1;
}
@@ -378,6 +399,8 @@ static uint32_t new_bug(const map_crash_report_t& pCrashReport)
}
xmlrpc_DECREF(result);
+ xmlrpc_DECREF(param);
+ xmlrpc_DECREF(id);
return bug_id;
}
@@ -405,6 +428,8 @@ static void add_attachments(const std::string& pBugId, const map_crash_report_t&
xmlrpc_client_call2(&env, client, server_info, "bugzilla.addAttachment", param, &result);
throw_if_fault_occurred(&env);
+ xmlrpc_DECREF(result);
+ xmlrpc_DECREF(param);
}
}
}
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index e9967fd..8344b81 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -114,7 +114,7 @@ std::string CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport,
/* FIXME: be more informative */
throw CABRTException(EXCEP_PLUGIN, std::string("CKerneloopsReporter::Report(): Report has not been sent..."));
}
- return "Kernel oops report was uploaded to :" + m_sSubmitURL;
+ return "Kernel oops report was uploaded to: " + m_sSubmitURL;
}
void CKerneloopsReporter::SetSettings(const map_plugin_settings_t& pSettings)
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp
index 4caa459..bf0222a 100644
--- a/lib/Plugins/KerneloopsScanner.cpp
+++ b/lib/Plugins/KerneloopsScanner.cpp
@@ -34,6 +34,7 @@
#include "KerneloopsSysLog.h"
#include "KerneloopsScanner.h"
+#include <limits.h>
#define FILENAME_KERNELOOPS "kerneloops"
@@ -96,7 +97,7 @@ void CKerneloopsScanner::SaveOopsToDebugDump()
try
{
CDebugDump debugDump;
- debugDump.Create(path, 0);
+ debugDump.Create(path, UINT_MAX);
debugDump.SaveText(FILENAME_ANALYZER, "Kerneloops");
debugDump.SaveText(FILENAME_EXECUTABLE, "kernel");
debugDump.SaveText(FILENAME_KERNEL, first_line);
diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp
index a2dc426..200a813 100644
--- a/lib/Plugins/SQLite3.cpp
+++ b/lib/Plugins/SQLite3.cpp
@@ -24,7 +24,8 @@
#include <stdlib.h>
#include "SQLite3.h"
#include "ABRTException.h"
-
+#include <limits.h>
+#include <abrtlib.h>
#define ABRT_TABLE_VERSION 2
#define ABRT_TABLE_VERSION_STR "2"
@@ -96,8 +97,10 @@ bool CSQLite3::Exist(const std::string& pUUID, const std::string& pUID)
{
vector_database_rows_t table;
GetTable("SELECT "DATABASE_COLUMN_REPORTED" FROM "ABRT_TABLE" WHERE "
- DATABASE_COLUMN_UUID" = '"+pUUID+"' AND "
- DATABASE_COLUMN_UID" = '"+pUID+"';", table);
+ DATABASE_COLUMN_UUID" = '"+pUUID+"' "
+ "AND ("DATABASE_COLUMN_UID" = '"+pUID+"' "
+ "OR "DATABASE_COLUMN_UID" = '"+to_string(UINT_MAX)+"');"
+ , table);
if (table.empty())
{
return false;
@@ -311,7 +314,8 @@ void CSQLite3::Delete(const std::string& pUUID, const std::string& pUID)
{
Exec("DELETE FROM "ABRT_TABLE" "
"WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' "
- "AND "DATABASE_COLUMN_UID" = '"+pUID+"';");
+ "AND "DATABASE_COLUMN_UID" = '"+pUID+"' "
+ "OR "DATABASE_COLUMN_UID" = '"+to_string(UINT_MAX)+"';");
}
else
{
@@ -335,15 +339,17 @@ void CSQLite3::SetReported(const std::string& pUUID, const std::string& pUID, co
Exec("UPDATE "ABRT_TABLE" "
"SET "DATABASE_COLUMN_REPORTED" = 1 "
"WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' "
- "AND "DATABASE_COLUMN_UID" = '"+pUID+"';");
+ "AND ("DATABASE_COLUMN_UID" = '"+pUID+"' "
+ "OR "DATABASE_COLUMN_UID" = '"+to_string(UINT_MAX)+"');");
Exec("UPDATE "ABRT_TABLE" "
"SET "DATABASE_COLUMN_MESSAGE" = '" + pMessage + "' "
"WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' "
- "AND "DATABASE_COLUMN_UID" = '"+pUID+"';");
+ "AND ("DATABASE_COLUMN_UID" = '"+pUID+"' "
+ "OR "DATABASE_COLUMN_UID" = '"+to_string(UINT_MAX)+"');");
}
else
{
- throw CABRTException(EXCEP_PLUGIN, "CSQLite3::SetReported(): UUID is not found in DB.");
+ throw CABRTException(EXCEP_PLUGIN, "CSQLite3::SetReported(): UUID"+pUID+" is not found in DB.");
}
}
@@ -357,7 +363,8 @@ vector_database_rows_t CSQLite3::GetUIDData(const std::string& pUID)
else
{
GetTable("SELECT * FROM "ABRT_TABLE
- " WHERE "DATABASE_COLUMN_UID" = '"+pUID+"';",
+ " WHERE "DATABASE_COLUMN_UID" = '"+pUID+"' "
+ "OR "DATABASE_COLUMN_UID" = '"+to_string(UINT_MAX)+"';",
table);
}
return table;
@@ -377,7 +384,8 @@ database_row_t CSQLite3::GetUUIDData(const std::string& pUUID, const std::string
{
GetTable("SELECT * FROM "ABRT_TABLE" "
"WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' "
- "AND "DATABASE_COLUMN_UID" = '"+pUID+"';",
+ "AND ("DATABASE_COLUMN_UID" = '"+pUID+"' "
+ "OR "DATABASE_COLUMN_UID" = '"+to_string(UINT_MAX)+"');",
table);
}
diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp
index 9d7be5f..c2d5467 100644
--- a/src/Applet/Applet.cpp
+++ b/src/Applet/Applet.cpp
@@ -20,6 +20,7 @@
#include <dbus/dbus-shared.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include <limits.h>
#if HAVE_CONFIG_H
#include <config.h>
#endif
@@ -63,9 +64,13 @@ static void Crash(DBusMessage* signal)
//if (m_pSessionDBus->has_name("com.redhat.abrt.gui"))
// return;
- uid_t uid_num = atoi(uid_str);
+// uid_t uid_num = atol(uid_str);
- if (uid_num != getuid())
+ char* endptr;
+ uid_t uid_num = (uid_t)strtoul(uid_str,&endptr, 10);
+
+ printf("%u:%s\n", uid_num, uid_str);
+ if ((uid_num != getuid()) && (uid_num != UINT_MAX))
return;
const char* message = _("A crash in package %s has been detected");
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index d1ab188..a6a4f93 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -22,6 +22,7 @@
#include <glib.h>
#include <pthread.h>
#include <string>
+#include <limits.h>
#if HAVE_CONFIG_H
#include <config.h>
#endif
@@ -555,14 +556,34 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
log("New crash, saving...");
RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT]);
/* Send dbus signal */
- g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
+ if(crashinfo[CD_MWANALYZER][CD_CONTENT] == "Kerneloops")
+ {
+ // When Kerneloops comes it will be sent uid with -1
+ // Applet will detected and show normal user
+ std::cout << "New: package|kerneloops" << crashinfo[CD_PACKAGE][CD_CONTENT] << std::endl;
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], to_string(UINT_MAX));
+ }
+ else
+ {
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
+ }
break;
case MW_REPORTED:
case MW_OCCURED:
log("Already saved crash, deleting...");
/* Send dbus signal */
- g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
- DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
+ if(crashinfo[CD_MWANALYZER][CD_CONTENT] == "Kerneloops")
+ {
+ // When Kerneloops comes it will be sent uid with -1
+ // Applet will detected and show normal user
+ std::cout << "New: package|kerneloops" << crashinfo[CD_PACKAGE][CD_CONTENT] << std::endl;
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], to_string(UINT_MAX));
+ }
+ else
+ {
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
+ }
+ //DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
break;
case MW_BLACKLISTED:
case MW_CORRUPTED:
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 2ccd589..7c5bb41 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -710,6 +710,7 @@ mw_result_t GetCrashInfo(const std::string& pUUID,
std::string package;
std::string executable;
std::string description;
+ std::string analyzer;
try
{
@@ -718,6 +719,7 @@ mw_result_t GetCrashInfo(const std::string& pUUID,
dd.LoadText(FILENAME_EXECUTABLE, executable);
dd.LoadText(FILENAME_PACKAGE, package);
dd.LoadText(FILENAME_DESCRIPTION, description);
+ dd.LoadText(FILENAME_ANALYZER, analyzer);
}
catch (CABRTException& e)
{
@@ -738,6 +740,7 @@ mw_result_t GetCrashInfo(const std::string& pUUID,
add_crash_data_to_crash_info(pCrashInfo, CD_REPORTED, row.m_sReported);
add_crash_data_to_crash_info(pCrashInfo, CD_MESSAGE, row.m_sMessage);
add_crash_data_to_crash_info(pCrashInfo, CD_MWDDD, row.m_sDebugDumpDir);
+ add_crash_data_to_crash_info(pCrashInfo, CD_MWANALYZER, analyzer);
return MW_OK;
}
diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf
index 1fe6123..375fd27 100644
--- a/src/Daemon/abrt.conf
+++ b/src/Daemon/abrt.conf
@@ -30,4 +30,4 @@ Python = Bugzilla, Logger
[ Cron ]
# h:m - at h:m an action plugin is activated
# s - every s seconds is an action plugin activated
-120 = KerneloopsScanner
+2 = KerneloopsScanner