Blob Blame History Raw
From 98156aa13a496b83c998f651efd0f7f3f0700c6b Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Aug 2012 17:52:00 +0200
Subject: [PATCH 07/10] trac#660: report-gtk asks for permission to send
 sensitive data

* if the currently process event has configured 'sending-sensitive-data'
  report-gtk asks for permission to continue with processing of the
  event

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/gui-wizard-gtk/wizard.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 861d922..6f540a8 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -2028,6 +2028,22 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
     }
 }
 
+static bool get_sensitive_data_permission(const char *event_name)
+{
+    event_config_t *event_cfg = get_event_config(event_name);
+
+    if (!event_cfg || !event_cfg->ec_sending_sensitive_data)
+        return true;
+
+    char *msg = xasprintf(_("Event '%s' requires permission to send possibly sensitive data."
+                            "\nDo you want to continue?"),
+                            event_cfg->screen_name ? event_cfg->screen_name : event_name);
+    const bool response = ask_yes_no_save_result(msg, "ask_send_sensitive_data");
+    free(msg);
+
+    return response;
+}
+
 static gint select_next_page_no(gint current_page_no, gpointer data)
 {
     GtkWidget *page;
@@ -2049,6 +2065,16 @@ static gint select_next_page_no(gint current_page_no, gpointer data)
             }
 
             free(g_event_selected);
+
+            if (!get_sensitive_data_permission(event))
+            {
+                g_event_selected = NULL;
+                gtk_label_set_text(g_lbl_event_log, _("Processing was cancelled"));
+                terminate_event_chain();
+                current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1;
+                goto again;
+            }
+
             g_event_selected = xstrdup(event);
 
             if (check_event_config(g_event_selected) != 0)
-- 
1.7.11.2