libreport/0005-report-client-check-owner-of-var-cache-abrt-di-when-.patch
Matej Habrnal b5a180b66f Translations update and several bug fixes
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
2015-05-20 14:34:41 +02:00

55 lines
1.8 KiB
Diff

From 70414c99d98c5ed65a2b8b431aca9a3455d24ce2 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Tue, 12 May 2015 14:54:20 +0200
Subject: [PATCH] report client: check owner of /var/cache/abrt-di when
unpacking fails
If unpacking of debuginfo fails and '/vat/cache/abrt-di' is not owned by
abrt.abrt the client provides a solution how to fix the issue.
Related to rhbz#1213485
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/client-python/reportclient/debuginfo.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/client-python/reportclient/debuginfo.py b/src/client-python/reportclient/debuginfo.py
index 9daf7aa..6a3b67c 100644
--- a/src/client-python/reportclient/debuginfo.py
+++ b/src/client-python/reportclient/debuginfo.py
@@ -23,6 +23,7 @@
import sys
import os
+import pwd
import time
import errno
import shutil
@@ -42,7 +43,6 @@ def ensure_abrt_uid(fn):
the function.
"""
- import pwd
current_uid = os.getuid()
current_gid = os.getgid()
abrt = pwd.getpwnam("abrt")
@@ -381,6 +381,14 @@ class DebugInfoDownload(object):
if unpack_result == RETURN_FAILURE:
# recursively delete the temp dir on failure
print(_("Unpacking failed, aborting download..."))
+
+ s = os.stat(self.cachedir)
+ abrt = pwd.getpwnam("abrt")
+ if (s.st_uid != abrt.pw_uid) or (s.st_gid != abrt.pw_gid):
+ print(_("'{0}' must be owned by abrt. "
+ "Please run '# chown -R abrt.abrt {0}' "
+ "to fix the issue.").format(self.cachedir))
+
clean_up(self.tmpdir)
return RETURN_FAILURE
--
2.4.1