|
|
4b6aa8 |
From 215926614e59d509a2ab01e74706daaeffee3e49 Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
4b6aa8 |
Date: Tue, 5 Apr 2016 14:17:56 +0200
|
|
|
4b6aa8 |
Subject: [PATCH] lib: allow report SELinux denial from sealert under common
|
|
|
4b6aa8 |
user
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
The main purpose of the removed lines in this commit were preventing from
|
|
|
4b6aa8 |
creating non-root dump dir's sub-directrories in the case an uid element
|
|
|
4b6aa8 |
doesn't exist in time of creating the dump dir.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
The removed lines are moved to the function problem_data_save() in abrt
|
|
|
4b6aa8 |
src/lib/hooklib.c.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Related to rhbz#1264921
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/lib/create_dump_dir.c | 3 ---
|
|
|
4b6aa8 |
tests/report_python.at | 37 +++++++++++++++++++++++++++++++++++++
|
|
|
4b6aa8 |
2 files changed, 37 insertions(+), 3 deletions(-)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/lib/create_dump_dir.c b/src/lib/create_dump_dir.c
|
|
|
4b6aa8 |
index 45c248d..d683b8e 100644
|
|
|
4b6aa8 |
--- a/src/lib/create_dump_dir.c
|
|
|
4b6aa8 |
+++ b/src/lib/create_dump_dir.c
|
|
|
4b6aa8 |
@@ -48,9 +48,6 @@ struct dump_dir *create_dump_dir_from_problem_data_ext(problem_data_t *problem_d
|
|
|
4b6aa8 |
return NULL;
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- if (uid == (uid_t)-1L)
|
|
|
4b6aa8 |
- uid = 0;
|
|
|
4b6aa8 |
-
|
|
|
4b6aa8 |
struct timeval tv;
|
|
|
4b6aa8 |
if (gettimeofday(&tv, NULL) < 0)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
diff --git a/tests/report_python.at b/tests/report_python.at
|
|
|
4b6aa8 |
index a05498c..7886e9d 100644
|
|
|
4b6aa8 |
--- a/tests/report_python.at
|
|
|
4b6aa8 |
+++ b/tests/report_python.at
|
|
|
4b6aa8 |
@@ -100,3 +100,40 @@ if report.getVersion_fromOSRELEASE() != report.getVersion():
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
sys.exit(exit_code)
|
|
|
4b6aa8 |
]])
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+## ---------------------------------- ##
|
|
|
4b6aa8 |
+## create_dump_dir_uid_does_not_exist ##
|
|
|
4b6aa8 |
+## ---------------------------------- ##
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+AT_PYTESTFUN([create_dump_dir_uid_does_not_exist],
|
|
|
4b6aa8 |
+[[import sys
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+sys.path.insert(0, "../../../src/report-python")
|
|
|
4b6aa8 |
+sys.path.insert(0, "../../../src/report-python/.libs")
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+report = __import__("report-python", globals(), locals(), [], -1)
|
|
|
4b6aa8 |
+sys.modules["report"] = report
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+import os
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+cd = report.problem_data()
|
|
|
4b6aa8 |
+cd.add_basics()
|
|
|
4b6aa8 |
+dd = cd.create_dump_dir("/tmp/")
|
|
|
4b6aa8 |
+print "dumpdir name:", dd.name
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+stat_info = os.stat(dd.name)
|
|
|
4b6aa8 |
+uid = stat_info.st_uid
|
|
|
4b6aa8 |
+gid = stat_info.st_gid
|
|
|
4b6aa8 |
+print "user uid", os.getuid()
|
|
|
4b6aa8 |
+print "user gid", os.getgid()
|
|
|
4b6aa8 |
+print "dumpdir uid: ", uid," gid: ", gid
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+exit_code = 0
|
|
|
4b6aa8 |
+if os.getuid() != uid:
|
|
|
4b6aa8 |
+ exit_code += 1
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+if os.getgid() != gid:
|
|
|
4b6aa8 |
+ exit_code += 1
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+sys.exit(exit_code)
|
|
|
4b6aa8 |
+]])
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|