diff options
Diffstat (limited to 'src/Daemon/MiddleWare.cpp')
-rw-r--r-- | src/Daemon/MiddleWare.cpp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 0bc358e1..66bdea67 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -184,7 +184,7 @@ mw_result_t CreateCrashReport(const char *pUUID, database_row_t row; if (pUUID[0] != '\0') { - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); row = database->GetUUIDData(pUUID, pUID); database->DisConnect(); @@ -278,17 +278,21 @@ void RunActionsAndReporters(const char *pDebugDumpDir) { try { - if (g_pPluginManager->GetPluginType(it_ar->first) == REPORTER) + VERB3 log("RunActionsAndReporters: checking %s", it_ar->first.c_str()); + plugin_type_t tp = g_pPluginManager->GetPluginType(it_ar->first.c_str()); + if (tp == REPORTER) { - CReporter* reporter = g_pPluginManager->GetReporter(it_ar->first); + CReporter* reporter = g_pPluginManager->GetReporter(it_ar->first.c_str()); map_crash_report_t crashReport; DebugDumpToCrashReport(pDebugDumpDir, crashReport); + VERB2 log("%s.Report(...)", it_ar->first.c_str()); reporter->Report(crashReport, plugin_settings, it_ar->second); } - else if (g_pPluginManager->GetPluginType(it_ar->first) == ACTION) + else if (tp == ACTION) { - CAction* action = g_pPluginManager->GetAction(it_ar->first); + CAction* action = g_pPluginManager->GetAction(it_ar->first.c_str()); + VERB2 log("%s.Run('%s','%s')", it_ar->first.c_str(), pDebugDumpDir, it_ar->second.c_str()); action->Run(pDebugDumpDir, it_ar->second.c_str()); } } @@ -375,27 +379,31 @@ report_status_t Report(const map_crash_report_t& pCrashReport, } } - // analyzer with package name (CCpp:xrog-x11-app) has higher priority + // analyzer with package name (CCpp:xorg-x11-app) has higher priority std::string key = analyzer + ":" + packageName; + map_analyzer_actions_and_reporters_t::iterator end = s_mapAnalyzerActionsAndReporters.end(); map_analyzer_actions_and_reporters_t::iterator keyPtr = s_mapAnalyzerActionsAndReporters.find(key); - if (keyPtr == s_mapAnalyzerActionsAndReporters.end()) + if (keyPtr == end) { // if there is no such settings, then try default analyzer keyPtr = s_mapAnalyzerActionsAndReporters.find(analyzer); + key = analyzer; } std::string message; - if (keyPtr != s_mapAnalyzerActionsAndReporters.end()) + if (keyPtr != end) { + VERB2 log("Found AnalyzerActionsAndReporters for '%s'", key.c_str()); + vector_pair_string_string_t::iterator it_r = keyPtr->second.begin(); for (; it_r != keyPtr->second.end(); it_r++) { std::string pluginName = it_r->first; try { - if (g_pPluginManager->GetPluginType(pluginName) == REPORTER) + if (g_pPluginManager->GetPluginType(pluginName.c_str()) == REPORTER) { - CReporter* reporter = g_pPluginManager->GetReporter(pluginName); + CReporter* reporter = g_pPluginManager->GetReporter(pluginName.c_str()); #if 0 /* Using ~user/.abrt/ is bad wrt security */ std::string home = ""; map_plugin_settings_t oldSettings; @@ -433,12 +441,12 @@ report_status_t Report(const map_crash_report_t& pCrashReport, { ret[pluginName].push_back("0"); ret[pluginName].push_back(e.what()); - update_client("Reporting via %s' was not successful: %s", pluginName.c_str(), e.what()); + update_client("Reporting via '%s' was not successful: %s", pluginName.c_str(), e.what()); } } } - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); database->SetReported(UUID, UID, message); database->DisConnect(); @@ -456,7 +464,7 @@ void DeleteDebugDumpDir(const char *pDebugDumpDir) std::string DeleteCrashInfo(const char *pUUID, const char *pUID) { - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); database_row_t row = database->GetUUIDData(pUUID, pUID); database->Delete(pUUID, pUID); @@ -476,7 +484,7 @@ std::string DeleteCrashInfo(const char *pUUID, static bool IsDebugDumpSaved(const char *pUID, const char *pDebugDumpDir) { - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); vector_database_rows_t rows = database->GetUIDData(pUID); database->DisConnect(); @@ -604,9 +612,9 @@ static void RunAnalyzerActions(const char *pAnalyzer, const char *pDebugDumpDir) std::string pluginName = it_a->first; try { - if (g_pPluginManager->GetPluginType(pluginName) == ACTION) + if (g_pPluginManager->GetPluginType(pluginName.c_str()) == ACTION) { - CAction* action = g_pPluginManager->GetAction(pluginName); + CAction* action = g_pPluginManager->GetAction(pluginName.c_str()); action->Run(pDebugDumpDir, it_a->second.c_str()); } } @@ -635,7 +643,7 @@ static mw_result_t SaveDebugDumpToDatabase(const char *pUUID, const char *pDebugDumpDir, map_crash_info_t& pCrashInfo) { - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); database->Insert(pUUID, pUID, pDebugDumpDir, pTime); database_row_t row = database->GetUUIDData(pUUID, pUID); @@ -657,7 +665,7 @@ static mw_result_t SaveDebugDumpToDatabase(const char *pUUID, std::string getDebugDumpDir(const char *pUUID, const char *pUID) { - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); database_row_t row = database->GetUUIDData(pUUID, pUID); database->DisConnect(); @@ -712,7 +720,7 @@ mw_result_t GetCrashInfo(const char *pUUID, map_crash_info_t& pCrashInfo) { pCrashInfo.clear(); - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); database->Connect(); database_row_t row = database->GetUUIDData(pUUID, pUID); database->DisConnect(); @@ -757,14 +765,14 @@ mw_result_t GetCrashInfo(const char *pUUID, vector_pair_string_string_t GetUUIDsOfCrash(const char *pUID) { - CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); vector_database_rows_t rows; database->Connect(); rows = database->GetUIDData(pUID); database->DisConnect(); vector_pair_string_string_t UUIDsUIDs; - int ii; + unsigned ii; for (ii = 0; ii < rows.size(); ii++) { UUIDsUIDs.push_back(make_pair(rows[ii].m_sUUID, rows[ii].m_sUID)); @@ -783,5 +791,6 @@ void AddAnalyzerActionOrReporter(const char *pAnalyzer, void AddActionOrReporter(const char *pActionOrReporter, const char *pArgs) { + VERB3 log("AddActionOrReporter('%s','%s')", pActionOrReporter, pArgs); s_vectorActionsAndReporters.push_back(make_pair(std::string(pActionOrReporter), std::string(pArgs))); } |