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

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