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

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