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