diff options
Diffstat (limited to 'src/Daemon')
-rw-r--r-- | src/Daemon/PluginManager.cpp | 6 | ||||
-rw-r--r-- | src/Daemon/Settings.cpp | 61 | ||||
-rw-r--r-- | src/Daemon/abrt.conf | 4 |
3 files changed, 49 insertions, 22 deletions
diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index 5865e42c..3867ec9b 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.cpp @@ -150,10 +150,10 @@ void CPluginManager::LoadPlugins() void CPluginManager::UnLoadPlugins() { - map_abrt_plugins_t::iterator it_p = m_mapABRTPlugins.begin(); - while (it_p != m_mapABRTPlugins.end()) + map_abrt_plugins_t::iterator it; + while ((it = m_mapABRTPlugins.begin()) != m_mapABRTPlugins.end()) { - UnLoadPlugin(it_p->first.c_str()); + UnLoadPlugin(it->first.c_str()); } } diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp index 7f419ec5..18767281 100644 --- a/src/Daemon/Settings.cpp +++ b/src/Daemon/Settings.cpp @@ -78,8 +78,11 @@ static set_string_t ParseList(const char* pList) return set; } +/* (What format do we parse here?) */ static vector_pair_string_string_t ParseListWithArgs(const char *pValue) { + VERB3 log(" ParseListWithArgs(%s)", pValue); + vector_pair_string_string_t pluginsWithArgs; unsigned int ii; std::string item; @@ -88,39 +91,55 @@ static vector_pair_string_string_t ParseListWithArgs(const char *pValue) bool is_arg = false; for (ii = 0; pValue[ii]; ii++) { - if (pValue[ii] == '\"') + if (is_quote && pValue[ii] == '\\' && pValue[ii+1]) + { + item += pValue[ii]; + ii++; + item += pValue[ii]; + continue; + } + if (pValue[ii] == '"') { is_quote = !is_quote; item += pValue[ii]; + continue; + } + if (is_quote) + { + item += pValue[ii]; + continue; } - else if (pValue[ii] == '(' && !is_quote) + if (pValue[ii] == '(') { action = item; item = ""; is_arg = true; + continue; } - else if (pValue[ii] == ')' && is_arg && !is_quote) + if (pValue[ii] == ')' && is_arg) { + VERB3 log(" adding (%s,%s)", action.c_str(), item.c_str()); pluginsWithArgs.push_back(make_pair(action, item)); item = ""; is_arg = false; action = ""; + continue; } - else if (pValue[ii] == ',' && !is_quote && !is_arg) + if (pValue[ii] == ',' && !is_arg) { if (item != "") { + VERB3 log(" adding (%s,%s)", item.c_str(), ""); pluginsWithArgs.push_back(make_pair(item, "")); item = ""; } + continue; } - else - { - item += pValue[ii]; - } + item += pValue[ii]; } if (item != "") { + VERB3 log(" adding (%s,%s)", item.c_str(), ""); pluginsWithArgs.push_back(make_pair(item, "")); } return pluginsWithArgs; @@ -255,42 +274,50 @@ void LoadSettings() std::string value; for (ii = 0; ii < line.length(); ii++) { + if (is_quote && line[ii] == '\\' && ii+1 < line.length()) + { + value += line[ii]; + ii++; + value += line[ii]; + continue; + } if (isspace(line[ii]) && !is_quote) { continue; } - else if (line[ii] == '#' && !is_quote && key == "") + if (line[ii] == '#' && !is_quote && key == "") { break; } - else if (line[ii] == '[' && !is_quote) + if (line[ii] == '[' && !is_quote) { is_section = true; section = ""; + continue; } - else if (line[ii] == '\"') + if (line[ii] == '"') { is_quote = !is_quote; value += line[ii]; + continue; } - else if (is_section) + if (is_section) { if (line[ii] == ']') { break; } section += line[ii]; + continue; } - else if (line[ii] == '=' && !is_quote) + if (line[ii] == '=' && !is_quote) { is_key = false; key = value; value = ""; + continue; } - else - { - value += line[ii]; - } + value += line[ii]; } if (!is_key && !is_quote) { diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf index f24ec4a8..028f582d 100644 --- a/src/Daemon/abrt.conf +++ b/src/Daemon/abrt.conf @@ -17,14 +17,14 @@ Database = SQLite3 MaxCrashReportsSize = 1000 # Vector of actions and reporters which are activated immediately after a crash occurs #ActionsAndReporters = Mailx("[abrt] new crash was detected") -# TODO: teach parser to escape \". Should be: x"`cat component`" = x"xorg-x11-server-Xorg" -ActionsAndReporters = RunApp("test x`cat component` = xxorg-x11-server-Xorg && cp /var/log/Xorg*.log .") +ActionsAndReporters = RunApp("test x\"`cat component`\" = x\"xorg-x11-server-Xorg\" && cp /var/log/Xorg.0.log .") # Reporters association with analyzers [ AnalyzerActionsAndReporters ] Kerneloops = KerneloopsReporter CCpp = Bugzilla, Logger Python = Bugzilla, Logger +#CCpp:xorg-x11-apps = RunApp("date", "date.txt") # Repeated calling of Action plugins [ Cron ] |