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

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