From 7f10181be367d77e5f3203e938ab24cf722119df Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Thu, 29 Oct 2009 15:20:56 +0100 Subject: Normal user can see kerneloops and report it Bugzilla memory leaks fix --- src/Applet/Applet.cpp | 9 +++++++-- src/Daemon/Daemon.cpp | 27 ++++++++++++++++++++++++--- src/Daemon/MiddleWare.cpp | 3 +++ src/Daemon/abrt.conf | 2 +- 4 files changed, 35 insertions(+), 6 deletions(-) (limited to 'src') 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 #include #include +#include #if HAVE_CONFIG_H #include #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 #include #include +#include #if HAVE_CONFIG_H #include #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 -- cgit