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