summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/Daemon')
-rw-r--r--src/Daemon/Daemon.cpp50
-rw-r--r--src/Daemon/MiddleWare.cpp10
-rw-r--r--src/Daemon/PluginManager.cpp9
3 files changed, 36 insertions, 33 deletions
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 666a7562..3a11a3ad 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -487,41 +487,47 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
case MW_OK:
log("New crash, saving");
RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT].c_str());
- /* Fall through to "send dbus signal" */
+ /* Fall through */
case MW_REPORTED:
case MW_OCCURED:
+ {
if (res != MW_OK)
log("Already saved crash, just sending dbus signal");
- /* Send dbus signal */
+
+ const char *analyzer = crashinfo[CD_MWANALYZER][CD_CONTENT].c_str();
+ const char *uid_str = crashinfo[CD_UID][CD_CONTENT].c_str();
+
+ /* Autoreport it if configured to do so */
+ if (analyzer_has_AutoReportUIDs(analyzer, uid_str))
{
- // I don't see any usable usecase for other plugin to be able automatic report.
- if (analyzer_has_AutoReportUIDs(crashinfo[CD_MWANALYZER][CD_CONTENT].c_str(), crashinfo[CD_UID][CD_CONTENT].c_str()))
+ VERB1 log("Reporting the crash automatically");
+ map_crash_report_t crash_report;
+ mw_result_t crash_result = CreateCrashReport(
+ crashinfo[CD_UUID][CD_CONTENT].c_str(),
+ uid_str, /*force:*/ 0, crash_report
+ );
+ if (crash_result == MW_OK)
{
- map_crash_report_t crash_report;
- VERB3 log("Create autoreport for user with uid %s",crashinfo[CD_UID][CD_CONTENT].c_str());
- mw_result_t crash_result = CreateCrashReport(crashinfo[CD_UUID][CD_CONTENT].c_str(), crashinfo[CD_UID][CD_CONTENT].c_str(), 0, crash_report);
- if (crash_result == MW_OK)
+ map_analyzer_actions_and_reporters_t::const_iterator it = g_settings_mapAnalyzerActionsAndReporters.find(analyzer);
+ map_analyzer_actions_and_reporters_t::const_iterator end = g_settings_mapAnalyzerActionsAndReporters.end();
+ if (it != end)
{
- map_analyzer_actions_and_reporters_t::const_iterator it = g_settings_mapAnalyzerActionsAndReporters.find("Kerneloops");
- map_analyzer_actions_and_reporters_t::const_iterator end = g_settings_mapAnalyzerActionsAndReporters.end();
- if (it != end)
+ vector_pair_string_string_t keys = it->second;
+ unsigned size = keys.size();
+ for (unsigned ii = 0; ii < size; ii++)
{
- vector_pair_string_string_t keys = it->second;
-
- uint32_t size = keys.size();
- for (uint32_t ii = 0; ii < size; ii++)
- {
- autoreport(keys[ii], crash_report);
- }
+ autoreport(keys[ii], crash_report);
}
}
}
- const char *uid_str = analyzer_has_InformAllUsers(crashinfo[CD_MWANALYZER][CD_CONTENT].c_str())
- ? NULL
- : crashinfo[CD_UID][CD_CONTENT].c_str();
- g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT].c_str(), uid_str);
}
+
+ /* Send dbus signal */
+ if (analyzer_has_InformAllUsers(analyzer))
+ uid_str = NULL;
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT].c_str(), uid_str);
break;
+ }
case MW_BLACKLISTED:
case MW_CORRUPTED:
case MW_PACKAGE_ERROR:
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 7b0eea54..94e27ae2 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -656,7 +656,6 @@ bool analyzer_has_InformAllUsers(const char *analyzer_name)
bool analyzer_has_AutoReportUIDs(const char *analyzer_name, const char* uid)
{
-
CAnalyzer* analyzer = g_pPluginManager->GetAnalyzer(analyzer_name);
if (!analyzer)
{
@@ -675,16 +674,15 @@ bool analyzer_has_AutoReportUIDs(const char *analyzer_name, const char* uid)
vector_string_t logins;
parse_args(it->second.c_str(), logins);
- uint32_t size = logins.size();
+ unsigned size = logins.size();
if (size == 0)
return false;
- uid_t id;
- for (uint32_t ii = 0; ii < size; ii++)
+ for (unsigned ii = 0; ii < size; ii++)
{
- if (!getuidbyname(logins[ii].c_str(), &id))
+ uid_t id = getuidbyname(logins[ii].c_str())
+ if (id == (uid_t)-1)
continue;
-
if (strcmp(uid, to_string(id).c_str()) == 0)
return true;
}
diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp
index a75b48ba..1e26ec2d 100644
--- a/src/Daemon/PluginManager.cpp
+++ b/src/Daemon/PluginManager.cpp
@@ -205,11 +205,10 @@ void CPluginManager::RegisterPlugin(const char *pName)
CPlugin* plugin = abrt_plugin->second->PluginNew();
map_plugin_settings_t pluginSettings;
- if ((strcmp(pName, "Kerneloops") == 0)
- || (strcmp(pName, "KerneloopsReporter") == 0)
- || (strcmp(pName, "KerneloopsScanner") == 0)
- )
- {
+ if (strcmp(pName, "Kerneloops") == 0
+ || strcmp(pName, "KerneloopsReporter") == 0
+ || strcmp(pName, "KerneloopsScanner") == 0
+ ) {
LoadPluginSettings(PLUGINS_CONF_DIR"/Kerneloops."PLUGINS_CONF_EXTENSION, pluginSettings);
VERB3 log("Load kerneloops.conf settings");
}