2 commits - client/tools rel-eng/packages

StephenHerr sherr at fedoraproject.org
Fri Jun 1 20:12:43 UTC 2012


 client/tools/rhncfg/config_common/file_utils.py |   22 +++++++++++++++++-----
 client/tools/rhncfg/rhncfg.spec                 |    7 ++++++-
 rel-eng/packages/rhncfg                         |    2 +-
 3 files changed, 24 insertions(+), 7 deletions(-)

New commits:
commit edfb48a81cfc5e9fac29b25c7938c0d3241b4fa2
Author: Stephen Herr <sherr at redhat.com>
Date:   Fri Jun 1 16:12:33 2012 -0400

    Automatic commit of package [rhncfg] release [5.10.30-1].

diff --git a/client/tools/rhncfg/rhncfg.spec b/client/tools/rhncfg/rhncfg.spec
index 9cff0af..d539fe9 100644
--- a/client/tools/rhncfg/rhncfg.spec
+++ b/client/tools/rhncfg/rhncfg.spec
@@ -8,7 +8,7 @@ Group:   Applications/System
 License: GPLv2
 URL:     https://fedorahosted.org/spacewalk
 Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 5.10.29
+Version: 5.10.30
 Release: 1%{?dist}
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
@@ -102,6 +102,11 @@ rm -rf $RPM_BUILD_ROOT
 
 # $Id$
 %changelog
+* Fri Jun 01 2012 Stephen Herr <sherr at redhat.com> 5.10.30-1
+- 824707 - rhncfg-actions should not log the diff of files that are not
+  readable by all
+- %%defattr is not needed since rpm 4.4
+
 * Mon May 14 2012 Michael Mraka <michael.mraka at redhat.com> 5.10.29-1
 - 820517 - fixed command synopsis
 - 805449 - honor rhncfg-specific settings
diff --git a/rel-eng/packages/rhncfg b/rel-eng/packages/rhncfg
index 99188fe..ad4c9f4 100644
--- a/rel-eng/packages/rhncfg
+++ b/rel-eng/packages/rhncfg
@@ -1 +1 @@
-5.10.29-1 client/tools/rhncfg/
+5.10.30-1 client/tools/rhncfg/


commit 7a18b250b07ff4ed0c34fa48e69029c114ec3ab1
Author: Stephen Herr <sherr at redhat.com>
Date:   Fri Jun 1 16:12:14 2012 -0400

    824707 - rhncfg-actions should not log the diff of files that are not readable by all

diff --git a/client/tools/rhncfg/config_common/file_utils.py b/client/tools/rhncfg/config_common/file_utils.py
index 70563e6..f386403 100644
--- a/client/tools/rhncfg/config_common/file_utils.py
+++ b/client/tools/rhncfg/config_common/file_utils.py
@@ -14,6 +14,7 @@
 #
 
 import os
+import stat
 import time
 import tempfile
 import base64
@@ -145,7 +146,8 @@ def diff(src, dst, srcname=None, dstname=None):
             f = open(path, 'U')
             content = f.readlines()
             f.close()
-            f_time = time.ctime(os.stat(path).st_mtime)
+            statinfo = os.stat(path)
+            f_time = time.ctime(statinfo.st_mtime)
             if content and content[-1] and content[-1][-1] != "\n":
                 content[-1] += "\n"
         else:
@@ -153,15 +155,25 @@ def diff(src, dst, srcname=None, dstname=None):
             f_time = time.ctime(0)
         if not name:
             name = path
-        return (content, name, f_time)
+        return (content, name, f_time, statinfo)
 
-    (src_content, src_name, src_time) = f_content(src, srcname)
-    (dst_content, dst_name, dst_time) = f_content(dst, dstname)
+    (src_content, src_name, src_time, src_stat) = f_content(src, srcname)
+    (dst_content, dst_name, dst_time, dst_stat) = f_content(dst, dstname)
 
     diff_u = difflib.unified_diff(src_content, dst_content,
                                   src_name, dst_name,
                                   src_time, dst_time)
-    return list(diff_u)
+
+    ret_list = list(diff_u)
+    # 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
+        ret_list = [
+                "Differences exist in a file that is not readable by all. ",
+                "Re-deployment of configuration file is recommended."]
+    return ret_list
 
 
 




More information about the spacewalk-commits mailing list