arrfab / rpms / abrt

Forked from rpms/abrt 5 years ago
Clone

Blame SOURCES/0179-conf-introduce-DebugLevel.patch

baab13
From 373f5d38e3c8fbc4bc466312c659974d31a68ac4 Mon Sep 17 00:00:00 2001
baab13
From: Jakub Filak <jfilak@redhat.com>
baab13
Date: Wed, 30 Sep 2015 12:17:47 +0200
baab13
Subject: [PATCH] conf: introduce DebugLevel
baab13
baab13
ABRT should ignore problems caused by ABRT tools if DebugLevel == 0.
baab13
DebugLevel is set to 0 by default.
baab13
baab13
Related to CVE-2015-5287
baab13
Related: #1262252
baab13
baab13
Signed-off-by: Jakub Filak <jfilak@redhat.com>
baab13
---
baab13
 doc/abrt.conf.txt     |  8 ++++++++
baab13
 src/daemon/abrt.conf  |  8 ++++++++
baab13
 src/include/libabrt.h |  2 ++
baab13
 src/lib/abrt_conf.c   | 14 ++++++++++++++
baab13
 4 files changed, 32 insertions(+)
baab13
baab13
diff --git a/doc/abrt.conf.txt b/doc/abrt.conf.txt
baab13
index d782e3d..7ef78f0 100644
baab13
--- a/doc/abrt.conf.txt
baab13
+++ b/doc/abrt.conf.txt
baab13
@@ -36,6 +36,14 @@ DeleteUploaded = 'yes/no'::
baab13
    or not.
baab13
    The default value is 'no'.
baab13
 
baab13
+DebugLevel = '0-100':
baab13
+   Allows ABRT tools to detect problems in ABRT itself. By increasing the value
baab13
+   you can force ABRT to detect, process and report problems in ABRT. You have
baab13
+   to bare in mind that ABRT might fall into an infinite loop when handling
baab13
+   problems caused by itself.
baab13
+   The default is 0 (non debug mode).
baab13
+
baab13
+
baab13
 SEE ALSO
baab13
 --------
baab13
 abrtd(8)
baab13
diff --git a/src/daemon/abrt.conf b/src/daemon/abrt.conf
baab13
index 2a83f8e..24df20b 100644
baab13
--- a/src/daemon/abrt.conf
baab13
+++ b/src/daemon/abrt.conf
baab13
@@ -51,3 +51,11 @@ AutoreportingEnabled = no
baab13
 #  THE PROBLEM DATA CONTAINS EXCERPTS OF /var/log/messages, dmesg AND sosreport
baab13
 #  data GENERATED BY abrtd UNDER THE USER root.
baab13
 PrivateReports = yes
baab13
+
baab13
+# Allows ABRT tools to detect problems in ABRT itself. By increasing the value
baab13
+# you can force ABRT to detect, process and report problems in ABRT. You have
baab13
+# to bare in mind that ABRT might fall into an infinite loop when handling
baab13
+# problems caused by itself.
baab13
+# The default is 0 (non debug mode).
baab13
+#
baab13
+# DebugLevel = 0
baab13
diff --git a/src/include/libabrt.h b/src/include/libabrt.h
baab13
index 3b17a64..21ce440 100644
baab13
--- a/src/include/libabrt.h
baab13
+++ b/src/include/libabrt.h
baab13
@@ -70,6 +70,8 @@ extern char *        g_settings_autoreporting_event;
baab13
 extern bool          g_settings_shortenedreporting;
baab13
 #define g_settings_privatereports abrt_g_settings_privatereports
baab13
 extern bool          g_settings_privatereports;
baab13
+#define g_settings_debug_level abrt_g_settings_debug_level
baab13
+extern unsigned int  g_settings_debug_level;
baab13
 
baab13
 
baab13
 #define load_abrt_conf abrt_load_abrt_conf
baab13
diff --git a/src/lib/abrt_conf.c b/src/lib/abrt_conf.c
baab13
index c6aba58..4a49032 100644
baab13
--- a/src/lib/abrt_conf.c
baab13
+++ b/src/lib/abrt_conf.c
baab13
@@ -28,6 +28,7 @@ bool          g_settings_autoreporting = 0;
baab13
 char *        g_settings_autoreporting_event = NULL;
baab13
 bool          g_settings_shortenedreporting = 0;
baab13
 bool          g_settings_privatereports = true;
baab13
+unsigned int  g_settings_debug_level = 0;
baab13
 
baab13
 void free_abrt_conf_data()
baab13
 {
baab13
@@ -110,6 +111,19 @@ static void ParseCommon(map_string_t *settings, const char *conf_filename)
baab13
         remove_map_string_item(settings, "PrivateReports");
baab13
     }
baab13
 
baab13
+    value = get_map_string_item_or_NULL(settings, "DebugLevel");
baab13
+    if (value)
baab13
+    {
baab13
+        char *end;
baab13
+        errno = 0;
baab13
+        unsigned long ul = strtoul(value, &end, 10);
baab13
+        if (errno || end == value || *end != '\0' || ul > INT_MAX)
baab13
+            error_msg("Error parsing %s setting: '%s'", "DebugLevel", value);
baab13
+        else
baab13
+            g_settings_debug_level = ul;
baab13
+        remove_map_string_item(settings, "DebugLevel");
baab13
+    }
baab13
+
baab13
     GHashTableIter iter;
baab13
     const char *name;
baab13
     /*char *value; - already declared */
baab13
-- 
baab13
1.8.3.1
baab13