Blame SOURCES/0221-lib-prevent-from-creating-non-root-sub-dirs-in-dump-.patch

a60cd7
From 2acf4b7691165003cae6308f006cef329802f79e Mon Sep 17 00:00:00 2001
a60cd7
From: Matej Habrnal <mhabrnal@redhat.com>
a60cd7
Date: Tue, 5 Apr 2016 14:51:28 +0200
a60cd7
Subject: [PATCH] lib: prevent from creating non-root sub-dirs in dump dir
a60cd7
a60cd7
In the case an uid element doesn't exist in time of dump dir creating, we have
a60cd7
to create dump dir owned by root.
a60cd7
a60cd7
Related to rhbz#1264921
a60cd7
a60cd7
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
a60cd7
---
a60cd7
 src/lib/hooklib.c | 7 ++++++-
a60cd7
 1 file changed, 6 insertions(+), 1 deletion(-)
a60cd7
a60cd7
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
a60cd7
index 160a011..ed1607d 100644
a60cd7
--- a/src/lib/hooklib.c
a60cd7
+++ b/src/lib/hooklib.c
a60cd7
@@ -415,7 +415,12 @@ char* problem_data_save(problem_data_t *pd)
a60cd7
     if (g_settings_privatereports)
a60cd7
         dd = create_dump_dir_from_problem_data_ext(pd, g_settings_dump_location, 0);
a60cd7
     else
a60cd7
-        dd = create_dump_dir_from_problem_data(pd, g_settings_dump_location);
a60cd7
+    {
a60cd7
+        if (problem_data_get_content_or_NULL(pd, FILENAME_UID) == NULL)
a60cd7
+            dd = create_dump_dir_from_problem_data_ext(pd, g_settings_dump_location, 0);
a60cd7
+        else
a60cd7
+            dd = create_dump_dir_from_problem_data(pd, g_settings_dump_location);
a60cd7
+    }
a60cd7
 
a60cd7
     char *problem_id = NULL;
a60cd7
     if (dd)
a60cd7
-- 
a60cd7
1.8.3.1
a60cd7