doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0013-applet-do-not-say-the-report-is-anonymous-when-urepo.patch

b404a9
From cafb9545c0e251b8ece493a341e7b209bde00a11 Mon Sep 17 00:00:00 2001
b404a9
From: Martin Milata <mmilata@redhat.com>
b404a9
Date: Mon, 20 Jan 2014 15:24:31 +0100
b404a9
Subject: [ABRT PATCH 13/13] applet: do not say the report is anonymous when
b404a9
 ureport auth is enabled
b404a9
b404a9
Depends on https://github.com/abrt/libreport/pull/232
b404a9
b404a9
Related to rhbz#1053042, rhbz#1055619.
b404a9
b404a9
Signed-off-by: Martin Milata <mmilata@redhat.com>
b404a9
---
b404a9
 configure.ac           |  2 ++
b404a9
 src/applet/Makefile.am |  1 +
b404a9
 src/applet/applet.c    | 43 +++++++++++++++++++++++++++++++++++++++----
b404a9
 3 files changed, 42 insertions(+), 4 deletions(-)
b404a9
b404a9
diff --git a/configure.ac b/configure.ac
b404a9
index a5f7a79..479289c 100644
b404a9
--- a/configure.ac
b404a9
+++ b/configure.ac
b404a9
@@ -139,6 +139,7 @@ EVENTS_DIR='${datadir}/libreport/events'
b404a9
 EVENTS_CONF_DIR='${sysconfdir}/libreport/events.d'
b404a9
 ENABLE_SOCKET_OR_DBUS='-DENABLE_DBUS=1'
b404a9
 DEFAULT_DUMP_DIR_MODE=$($PKG_CONFIG --variable=dd_mode libreport)
b404a9
+LIBREPORT_PLUGINS_CONF_DIR=$($PKG_CONFIG --variable=plugins_conf_dir libreport)
b404a9
 PROBLEMS_CONFIG_INTERFACES_DIR=${dbusinterfacedir}
b404a9
 
b404a9
 AC_ARG_WITH([defaultdumplocation],
b404a9
@@ -226,6 +227,7 @@ AC_SUBST(EVENTS_CONF_DIR)
b404a9
 AC_SUBST(EVENTS_DIR)
b404a9
 AC_SUBST(DEFAULT_DUMP_LOCATION)
b404a9
 AC_SUBST(DEFAULT_DUMP_DIR_MODE)
b404a9
+AC_SUBST(LIBREPORT_PLUGINS_CONF_DIR)
b404a9
 AC_SUBST(PROBLEMS_CONFIG_INTERFACES_DIR)
b404a9
 
b404a9
 AC_ARG_WITH(bodhi,
b404a9
diff --git a/src/applet/Makefile.am b/src/applet/Makefile.am
b404a9
index ec50fcd..fe7ec98 100644
b404a9
--- a/src/applet/Makefile.am
b404a9
+++ b/src/applet/Makefile.am
b404a9
@@ -9,6 +9,7 @@ abrt_applet_CPPFLAGS = \
b404a9
     -DBIN_DIR=\"$(bindir)\" \
b404a9
     -DLIBEXEC_DIR=\"$(libexecdir)\" \
b404a9
     -DICON_DIR=\"${datadir}/abrt/icons/hicolor/48x48/status\" \
b404a9
+    -DLIBREPORT_PLUGINS_CONF_DIR=\"$(LIBREPORT_PLUGINS_CONF_DIR)\" \
b404a9
     $(XICE_CFLAGS) \
b404a9
     $(XSMP_CFLAGS) \
b404a9
     $(GTK_CFLAGS) \
b404a9
diff --git a/src/applet/applet.c b/src/applet/applet.c
b404a9
index 9971e04..131d2ab 100644
b404a9
--- a/src/applet/applet.c
b404a9
+++ b/src/applet/applet.c
b404a9
@@ -90,6 +90,27 @@ static bool is_autoreporting_enabled(void)
b404a9
     return get_configured_bool_or_default("AutoreportingEnabled", g_settings_autoreporting);
b404a9
 }
b404a9
 
b404a9
+static bool is_ureport_auth_enabled(void)
b404a9
+{
b404a9
+    bool success, auth_enabled;
b404a9
+    map_string_t *settings = new_map_string();
b404a9
+    char *ureport_conf_path = concat_path_file(LIBREPORT_PLUGINS_CONF_DIR, "ureport.conf");
b404a9
+
b404a9
+    success = load_conf_file(ureport_conf_path, settings, /*skipKeysWithoutValue*/false);
b404a9
+    if (success)
b404a9
+    {
b404a9
+        const char *value = get_map_string_item_or_NULL(settings, "SSLClientAuth");
b404a9
+        auth_enabled = (value && value[0] != '\0');
b404a9
+    }
b404a9
+    else
b404a9
+        auth_enabled = true; /* assume it is, do not claim the reporting is anonymous */
b404a9
+
b404a9
+    free(ureport_conf_path);
b404a9
+    free_map_string(settings);
b404a9
+
b404a9
+    return auth_enabled;
b404a9
+}
b404a9
+
b404a9
 static const char *get_autoreport_event_name(void)
b404a9
 {
b404a9
     load_user_settings("abrt-applet");
b404a9
@@ -99,14 +120,28 @@ static const char *get_autoreport_event_name(void)
b404a9
 
b404a9
 static void ask_start_autoreporting()
b404a9
 {
b404a9
+    struct strbuf *question = strbuf_new();
b404a9
+    question = strbuf_append_str(question,
b404a9
+         _("The report which will be sent does not contain any security sensitive data. "
b404a9
+           "Therefore it is not necessary to bother you next time and require any further action by you. \n"));
b404a9
+
b404a9
+    if (is_ureport_auth_enabled())
b404a9
+    {
b404a9
+        question = strbuf_append_str(question,
b404a9
+            _("Do you want to enable automatically submitted crash reports?"));
b404a9
+    }
b404a9
+    else
b404a9
+    {
b404a9
+        question = strbuf_append_str(question,
b404a9
+            _("Do you want to enable automatically submitted anonymous crash reports?"));
b404a9
+    }
b404a9
+
b404a9
     /* The "Yes" response will be saved even if user don't check the
b404a9
      * "Don't ask me again" box.
b404a9
      */
b404a9
-    const int ret = run_ask_yes_no_save_result_dialog("AutoreportingEnabled",
b404a9
-     _("The report which will be sent does not contain any security sensitive data. "
b404a9
-       "Therefore it is not necessary to bother you next time and require any further action by you. "
b404a9
-       "\nDo you want to enable automatically submitted anonymous crash reports?"),
b404a9
+    const int ret = run_ask_yes_no_save_result_dialog("AutoreportingEnabled", question->buf,
b404a9
        /*parent wnd */ NULL);
b404a9
+    strbuf_free(question);
b404a9
 
b404a9
     load_user_settings("abrt-applet");
b404a9
 
b404a9
-- 
b404a9
1.8.3.1
b404a9