doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

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

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