diff options
| author | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-02-07 16:03:50 +0100 |
|---|---|---|
| committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-02-07 16:03:50 +0100 |
| commit | 34fc227339ccd23b30973ea4684fcb6fb408635e (patch) | |
| tree | c47ba01ecdc6e0e2ab5fc38c5eb07c4d6deeeedd /src/CLI/report.cpp | |
| parent | 985908c6b086b83381eccd95a0a6508c8bf1d731 (diff) | |
| parent | 1e76e071620e1f9bf110dacf3cf8caffccef324b (diff) | |
| download | abrt-34fc227339ccd23b30973ea4684fcb6fb408635e.tar.gz abrt-34fc227339ccd23b30973ea4684fcb6fb408635e.tar.xz abrt-34fc227339ccd23b30973ea4684fcb6fb408635e.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/CLI/report.cpp')
| -rw-r--r-- | src/CLI/report.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp index 2bcd52a..7ef33ac 100644 --- a/src/CLI/report.cpp +++ b/src/CLI/report.cpp @@ -412,10 +412,63 @@ int report(const char *uuid, bool always) } } + map_map_string_t pluginSettings; + if (!always) + { + // Get informations about all plugins. + map_map_string_t plugins = call_GetPluginsInfo(); + // Check the configuration of each enabled Reporter plugin. + map_map_string_t::iterator it, itend = plugins.end(); + for (it = plugins.begin(); it != itend; ++it) + { + // Skip disabled plugins. + if (0 != strcmp(it->second["Enabled"].c_str(), "yes")) + continue; + // Skip nonReporter plugins. + if (0 != strcmp(it->second["Type"].c_str(), "Reporter")) + continue; + + map_string_t settings = call_GetPluginSettings(it->first.c_str()); + // Login information is missing. + bool loginMissing = settings.find("Login") != settings.end() + && 0 == strcmp(settings["Login"].c_str(), ""); + bool passwordMissing = settings.find("Password") != settings.end() + && 0 == strcmp(settings["Password"].c_str(), ""); + if (!loginMissing && !passwordMissing) + continue; + + // Copy the received settings as defaults. + // Plugins won't work without it, if some value is missing + // they use their default values for all fields. + pluginSettings[it->first] = settings; + + printf(_("Wrong settings were detected for plugin %s.\n"), it->second["Name"].c_str()); + if (loginMissing) + { + printf(_("Enter your login: ")); + fflush(NULL); + char answer[64] = ""; + fgets(answer, sizeof(answer), stdin); + if (strlen(answer) > 0) + pluginSettings[it->first]["Login"] = answer; + } + if (passwordMissing) + { +// TODO: echo off, see http://fixunix.com/unix/84474-echo-off.html + printf(_("Enter your password: ")); + fflush(NULL); + char answer[64] = ""; + fgets(answer, sizeof(answer), stdin); + if (strlen(answer) > 0) + pluginSettings[it->first]["Password"] = answer; + } + } + } + int errors = 0; int plugins = 0; puts(_("Reporting...")); - report_status_t r = call_Report(cr); + report_status_t r = call_Report(cr, pluginSettings); report_status_t::iterator it = r.begin(); while (it != r.end()) { |
