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

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