Blame SOURCES/0196-rhtsupport-Discourage-users-from-reporting-in-non-Re.patch

2c83a8
From 64b9c39ffada27c51a202426378499dc5f278ceb Mon Sep 17 00:00:00 2001
2c83a8
From: Matej Habrnal <mhabrnal@redhat.com>
2c83a8
Date: Tue, 29 Mar 2016 12:03:41 +0200
2c83a8
Subject: [PATCH] rhtsupport: Discourage users from reporting in non Red Hat
2c83a8
 stuff
2c83a8
2c83a8
Related: #1258482
2c83a8
2c83a8
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
2c83a8
---
2c83a8
 src/include/internal_libreport.h  |  6 ++++++
2c83a8
 src/plugins/reporter-rhtsupport.c | 34 +++++++++++++++++++++++++++++++---
2c83a8
 2 files changed, 37 insertions(+), 3 deletions(-)
2c83a8
2c83a8
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
2c83a8
index c5f899c..397ac22 100644
2c83a8
--- a/src/include/internal_libreport.h
2c83a8
+++ b/src/include/internal_libreport.h
2c83a8
@@ -948,6 +948,12 @@ struct dump_dir *open_directory_for_writing(
2c83a8
 #define FILENAME_PKG_VERSION   "pkg_version"
2c83a8
 #define FILENAME_PKG_RELEASE   "pkg_release"
2c83a8
 #define FILENAME_PKG_ARCH      "pkg_arch"
2c83a8
+
2c83a8
+/* RHEL packages - Red Hat, Inc. */
2c83a8
+#define FILENAME_PKG_VENDOR    "pkg_vendor"
2c83a8
+/* RHEL keys - https://access.redhat.com/security/team/key */
2c83a8
+#define FILENAME_PKG_FINGERPRINT "pkg_fingerprint"
2c83a8
+
2c83a8
 #define FILENAME_USERNAME      "username"
2c83a8
 #define FILENAME_ABRT_VERSION  "abrt_version"
2c83a8
 #define FILENAME_EXPLOITABLE   "exploitable"
2c83a8
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
2c83a8
index 2374dd9..7b04086 100644
2c83a8
--- a/src/plugins/reporter-rhtsupport.c
2c83a8
+++ b/src/plugins/reporter-rhtsupport.c
2c83a8
@@ -647,11 +647,39 @@ int main(int argc, char **argv)
2c83a8
             exit(EXIT_CANCEL_BY_USER);
2c83a8
     }
2c83a8
 
2c83a8
+    const char *vendor = NULL;
2c83a8
+    vendor = problem_data_get_content_or_NULL(problem_data, FILENAME_PKG_VENDOR);
2c83a8
+    const char *package = NULL;
2c83a8
+    package  = problem_data_get_content_or_NULL(problem_data, FILENAME_PACKAGE);
2c83a8
+
2c83a8
+    if (package && vendor && strcmp(vendor, "Red Hat, Inc.") != 0)
2c83a8
+    {
2c83a8
+        char *message = xasprintf(
2c83a8
+            _("The crashed program was released by '%s'. "
2c83a8
+              "Would you like to report the problem to Red Hat Support?"),
2c83a8
+              vendor);
2c83a8
+        int r = ask_yes_no(message);
2c83a8
+        free(message);
2c83a8
+        if (!r)
2c83a8
+            exit(EXIT_CANCEL_BY_USER);
2c83a8
+    }
2c83a8
+
2c83a8
+    const char *executable = NULL;
2c83a8
+    executable  = problem_data_get_content_or_NULL(problem_data, FILENAME_EXECUTABLE);
2c83a8
+    if (!package)
2c83a8
+    {
2c83a8
+        char *message = xasprintf(
2c83a8
+            _("The program '%s' does not appear to be provided by Red Hat. "
2c83a8
+              "Would you like to report the problem to Red Hat Support?"),
2c83a8
+              executable);
2c83a8
+        int r = ask_yes_no(message);
2c83a8
+        free(message);
2c83a8
+        if (!r)
2c83a8
+            exit(EXIT_CANCEL_BY_USER);
2c83a8
+    }
2c83a8
+
2c83a8
     const char *function;
2c83a8
     const char *reason;
2c83a8
-    const char *package;
2c83a8
-
2c83a8
-    package  = problem_data_get_content_or_NULL(problem_data, FILENAME_PACKAGE);
2c83a8
     reason   = problem_data_get_content_or_NULL(problem_data, FILENAME_REASON);
2c83a8
     function = problem_data_get_content_or_NULL(problem_data, FILENAME_CRASH_FUNCTION);
2c83a8
     {
2c83a8
-- 
2c83a8
1.8.3.1
2c83a8