summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-05 17:21:11 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-05 17:21:11 +0100
commit64c5d35aebc38f93ce5c086c15c15de5acb21b2f (patch)
tree51113a991ff0111cddcf65bca90ac995e2173c1b /lib
parent01f36609ba1631751e492784d95b0e6b0706cf45 (diff)
downloadabrt-64c5d35aebc38f93ce5c086c15c15de5acb21b2f.tar.gz
abrt-64c5d35aebc38f93ce5c086c15c15de5acb21b2f.tar.xz
abrt-64c5d35aebc38f93ce5c086c15c15de5acb21b2f.zip
InformAllUsers support. enabled by default for Kerneloops. Tested wuth CCpp.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Plugins/CCpp.cpp4
-rw-r--r--lib/Plugins/CCpp.h2
-rw-r--r--lib/Plugins/Kerneloops.conf2
-rw-r--r--lib/Plugins/Kerneloops.cpp10
-rw-r--r--lib/Plugins/Kerneloops.h5
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp15
-rw-r--r--lib/Plugins/KerneloopsScanner.cpp27
-rw-r--r--lib/Plugins/KerneloopsScanner.h2
-rw-r--r--lib/Plugins/Makefile.am62
-rw-r--r--lib/Utils/xfuncs.cpp13
10 files changed, 90 insertions, 52 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 83622169..8a86e144 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -948,6 +948,8 @@ void CAnalyzerCCpp::DeInit()
void CAnalyzerCCpp::SetSettings(const map_plugin_settings_t& pSettings)
{
+ m_pSettings = pSettings;
+
map_plugin_settings_t::const_iterator end = pSettings.end();
map_plugin_settings_t::const_iterator it;
it = pSettings.find("MemoryMap");
@@ -976,7 +978,7 @@ void CAnalyzerCCpp::SetSettings(const map_plugin_settings_t& pSettings)
map_plugin_settings_t CAnalyzerCCpp::GetSettings()
{
- map_plugin_settings_t ret;
+ map_plugin_settings_t ret = m_pSettings;
ret["MemoryMap"] = m_bMemoryMap ? "yes" : "no";
ret["DebugInfo"] = m_sDebugInfo;
diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h
index f3f911ef..a37ba67c 100644
--- a/lib/Plugins/CCpp.h
+++ b/lib/Plugins/CCpp.h
@@ -35,6 +35,8 @@ class CAnalyzerCCpp : public CAnalyzer
unsigned m_nDebugInfoCacheMB;
std::string m_sOldCorePattern;
std::string m_sDebugInfo;
+ map_plugin_settings_t m_pSettings;
+
public:
CAnalyzerCCpp();
virtual std::string GetLocalUUID(const std::string& pDebugDumpDir);
diff --git a/lib/Plugins/Kerneloops.conf b/lib/Plugins/Kerneloops.conf
new file mode 100644
index 00000000..47b242ff
--- /dev/null
+++ b/lib/Plugins/Kerneloops.conf
@@ -0,0 +1,2 @@
+# compatibility with kerneloops.org tool
+InformAllUsers = yes
diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp
index e01bb426..e072ada7 100644
--- a/lib/Plugins/Kerneloops.cpp
+++ b/lib/Plugins/Kerneloops.cpp
@@ -63,6 +63,16 @@ std::string CAnalyzerKerneloops::GetGlobalUUID(const std::string& pDebugDumpDir)
return GetLocalUUID(pDebugDumpDir);
}
+void CAnalyzerKerneloops::SetSettings(const map_plugin_settings_t& pSettings)
+{
+ m_pSettings = pSettings;
+}
+
+map_plugin_settings_t CAnalyzerKerneloops::GetSettings()
+{
+ return m_pSettings;
+}
+
PLUGIN_INFO(ANALYZER,
CAnalyzerKerneloops,
"Kerneloops",
diff --git a/lib/Plugins/Kerneloops.h b/lib/Plugins/Kerneloops.h
index edd00d8b..c22e7878 100644
--- a/lib/Plugins/Kerneloops.h
+++ b/lib/Plugins/Kerneloops.h
@@ -33,10 +33,15 @@
class CAnalyzerKerneloops : public CAnalyzer
{
+ private:
+ map_plugin_settings_t m_pSettings;
+
public:
virtual std::string GetLocalUUID(const std::string& pDebugDumpDir);
virtual std::string GetGlobalUUID(const std::string& pDebugDumpDir);
virtual void CreateReport(const std::string& pDebugDumpDir, int force) {}
+ virtual void SetSettings(const map_plugin_settings_t& pSettings);
+ virtual map_plugin_settings_t GetSettings();
};
#endif
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index c57a1ef8..712adf0f 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -98,12 +98,10 @@ std::string CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport,
const std::string& pArgs)
{
int ret = -1;
- map_crash_report_t::const_iterator it;
update_client(_("Creating and submitting a report..."));
- it = pCrashReport.begin();
- it = pCrashReport.find(FILENAME_KERNELOOPS);
+ map_crash_report_t::const_iterator it = pCrashReport.find(FILENAME_KERNELOOPS);
if (it != pCrashReport.end()) {
ret = http_post_to_kerneloops_site(
m_sSubmitURL.c_str(),
@@ -111,19 +109,18 @@ std::string CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport,
);
}
- if (ret)
- {
+ if (ret) {
/* FIXME: be more informative */
- throw CABRTException(EXCEP_PLUGIN, std::string("CKerneloopsReporter::Report(): Report has not been sent..."));
+ throw CABRTException(EXCEP_PLUGIN, std::string("CKerneloopsReporter::Report(): Report has not been sent..."));
}
return "Kernel oops report was uploaded to: " + m_sSubmitURL;
}
void CKerneloopsReporter::SetSettings(const map_plugin_settings_t& pSettings)
{
- if (pSettings.find("SubmitURL") != pSettings.end())
- {
- m_sSubmitURL = pSettings.find("SubmitURL")->second;
+ map_plugin_settings_t::const_iterator it = pSettings.find("SubmitURL");
+ if (it != pSettings.end()) {
+ m_sSubmitURL = it->second;
}
}
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp
index 9e1bd535..c7756bad 100644
--- a/lib/Plugins/KerneloopsScanner.cpp
+++ b/lib/Plugins/KerneloopsScanner.cpp
@@ -43,7 +43,6 @@
CKerneloopsScanner::CKerneloopsScanner()
{
int cnt_FoundOopses;
- m_sSysLogFile = "/var/log/messages";
/* Scan dmesg, on first call only */
cnt_FoundOopses = ScanDmesg();
@@ -54,16 +53,21 @@ CKerneloopsScanner::CKerneloopsScanner()
void CKerneloopsScanner::Run(const std::string& pActionDir,
const std::string& pArgs)
{
- int cnt_FoundOopses;
+ const char *syslog_file = "/var/log/messages";
+ map_plugin_settings_t::const_iterator it = m_pSettings.find("SysLogFile");
+ if (it != m_pSettings.end())
+ {
+ syslog_file = it->second.c_str();
+ }
- cnt_FoundOopses = ScanSysLogFile(m_sSysLogFile.c_str());
+ int cnt_FoundOopses = ScanSysLogFile(syslog_file);
if (cnt_FoundOopses > 0) {
SaveOopsToDebugDump();
/*
* This marker in syslog file prevents us from
* re-parsing old oopses (any oops before it is
* ignored by ScanSysLogFile()). The only problem
- * is that we can't be sure here that m_sSysLogFile
+ * is that we can't be sure here that syslog_file
* is the file where syslog(xxx) stuff ends up.
*/
openlog("abrt", 0, LOG_KERN);
@@ -97,8 +101,7 @@ void CKerneloopsScanner::SaveOopsToDebugDump()
try
{
CDebugDump debugDump;
- // UID of kerneloops is -1
- debugDump.Create(path, -1);
+ debugDump.Create(path, 0);
debugDump.SaveText(FILENAME_ANALYZER, "Kerneloops");
debugDump.SaveText(FILENAME_EXECUTABLE, "kernel");
debugDump.SaveText(FILENAME_KERNEL, first_line);
@@ -180,20 +183,12 @@ int CKerneloopsScanner::ScanSysLogFile(const char *filename)
void CKerneloopsScanner::SetSettings(const map_plugin_settings_t& pSettings)
{
- map_plugin_settings_t::const_iterator it = pSettings.find("SysLogFile");
- if (it != pSettings.end())
- {
- m_sSysLogFile = it->second;
- }
+ m_pSettings = pSettings;
}
map_plugin_settings_t CKerneloopsScanner::GetSettings()
{
- map_plugin_settings_t ret;
-
- ret["SysLogFile"] = m_sSysLogFile;
-
- return ret;
+ return m_pSettings;
}
PLUGIN_INFO(ACTION,
diff --git a/lib/Plugins/KerneloopsScanner.h b/lib/Plugins/KerneloopsScanner.h
index 6ac0461f..7352393b 100644
--- a/lib/Plugins/KerneloopsScanner.h
+++ b/lib/Plugins/KerneloopsScanner.h
@@ -34,7 +34,7 @@
class CKerneloopsScanner : public CAction
{
private:
- std::string m_sSysLogFile;
+ map_plugin_settings_t m_pSettings;
/* For "dumpoops" tool */
public:
diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am
index 428c2d67..0502f5e1 100644
--- a/lib/Plugins/Makefile.am
+++ b/lib/Plugins/Makefile.am
@@ -1,30 +1,42 @@
AM_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils
pluginslibdir=$(PLUGINS_LIB_DIR)
-pluginslib_LTLIBRARIES = libCCpp.la \
- libMailx.la \
- libSQLite3.la \
- libLogger.la \
- libKerneloopsScanner.la\
- libKerneloopsReporter.la\
- libKerneloops.la \
- libRunApp.la \
- libSOSreport.la \
- libBugzilla.la \
- libCatcut.la \
- libTicketUploader.la \
- libPython.la \
- libFileTransfer.la
-
-dist_pluginslib_DATA = KerneloopsReporter.GTKBuilder Logger.GTKBuilder\
- Mailx.GTKBuilder Bugzilla.GTKBuilder\
- TicketUploader.GTKBuilder Catcut.GTKBuilder
-
-pluginsconfdir=$(PLUGINS_CONF_DIR)
-dist_pluginsconf_DATA = CCpp.conf Mailx.conf SQLite3.conf Logger.conf KerneloopsScanner.conf KerneloopsReporter.conf Bugzilla.conf Catcut.conf TicketUploader.conf FileTransfer.conf
-
-
-man_MANS = abrt-FileTransfer.7 abrt-Bugzilla.7 abrt-KerneloopsReporter.7\
- abrt-KerneloopsScanner.7 abrt-Logger.7 abrt-Mailx.7 abrt-plugins.7\
+pluginslib_LTLIBRARIES = \
+ libCCpp.la \
+ libMailx.la \
+ libSQLite3.la \
+ libLogger.la \
+ libKerneloopsScanner.la\
+ libKerneloopsReporter.la\
+ libKerneloops.la \
+ libRunApp.la \
+ libSOSreport.la \
+ libBugzilla.la \
+ libCatcut.la \
+ libTicketUploader.la \
+ libPython.la \
+ libFileTransfer.la
+
+dist_pluginslib_DATA = \
+ KerneloopsReporter.GTKBuilder Logger.GTKBuilder \
+ Mailx.GTKBuilder Bugzilla.GTKBuilder \
+ TicketUploader.GTKBuilder Catcut.GTKBuilder
+
+pluginsconfdir = $(PLUGINS_CONF_DIR)
+dist_pluginsconf_DATA = \
+ CCpp.conf \
+ Mailx.conf \
+ SQLite3.conf \
+ Logger.conf \
+ Kerneloops.conf \
+ KerneloopsScanner.conf \
+ KerneloopsReporter.conf \
+ Bugzilla.conf \
+ Catcut.conf \
+ TicketUploader.conf \
+ FileTransfer.conf
+
+man_MANS = abrt-FileTransfer.7 abrt-Bugzilla.7 abrt-KerneloopsReporter.7 \
+ abrt-KerneloopsScanner.7 abrt-Logger.7 abrt-Mailx.7 abrt-plugins.7 \
abrt-SQLite3.7 abrt-RunApp.7 abrt-TicketUploader.7
# + abrt-Catcut.7
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp
index 533fbfa8..97c2f763 100644
--- a/lib/Utils/xfuncs.cpp
+++ b/lib/Utils/xfuncs.cpp
@@ -355,3 +355,16 @@ std::string concat_path_file(const char *path, const char *filename)
lc = last_char_is(path, '/');
return ssprintf("%s%s%s", path, (lc==NULL ? "/" : ""), filename);
}
+
+bool string_to_bool(const char *s)
+{
+ if (s[0] == '1' && s[1] == '\0')
+ return true;
+ if (strcasecmp(s, "on") == 0)
+ return true;
+ if (strcasecmp(s, "yes") == 0)
+ return true;
+ if (strcasecmp(s, "true") == 0)
+ return true;
+ return false;
+}