Hello,

Commit 7a18b250b07ff4ed0c34fa48e69029c114ec3ab1 introduced the check on ownership & permission of the config file so that it doesn't log/display the diff it the config file is not readable by all.

Here it is checking the stat for source. But source is always the temp file which is created based on the config file content received from the Server and it is always under root ownership and not readable by all. Thus for all config files which are not owned by root or are readable by all, the diff result is not displayed. Instead there is the message "Differences exist in a file that is not readable by all. Re-deployment of configuration file is recommended"

Attached is the proposed patch to check the stat of dst i.e the file present on the system. With this change, for the files which are readable by all the actual diff result would be displayed.

Regards,
Paresh
>From 8a4338b0b6ee7fdf79bee125a4e7f3afb48fbdcd Mon Sep 17 00:00:00 2001
From: Paresh Mutha <pmu...@redhat.com>
Date: Wed, 24 Oct 2012 15:28:48 +0530
Subject: [PATCH] fix for bz#869626 use st_mode, st_uid of dst
 Signed-off-by: Paresh Mutha <pmu...@redhat.com>

---
 client/tools/rhncfg/config_common/file_utils.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/tools/rhncfg/config_common/file_utils.py b/client/tools/rhncfg/config_common/file_utils.py
index f386403..13a42a2 100644
--- a/client/tools/rhncfg/config_common/file_utils.py
+++ b/client/tools/rhncfg/config_common/file_utils.py
@@ -168,8 +168,8 @@ def diff(src, dst, srcname=None, dstname=None):
     # don't return the diff if the file is not readable by everyone
     # for security reasons.
     if (len(ret_list) > 0 # if differences exist
-            and src_stat.st_uid == 0 # and file is owned by root
-            and not src_stat.st_mode & stat.S_IROTH): #and not readable by all
+            and dst_stat.st_uid == 0 # and file is owned by root
+            and not dst_stat.st_mode & stat.S_IROTH): #and not readable by all
         ret_list = [
                 "Differences exist in a file that is not readable by all. ",
                 "Re-deployment of configuration file is recommended."]
-- 
1.7.1

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to