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

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