Hello,

Attached is a patch to fix rhbz 566664.

Thanks,

Josh
From 9bf86a51b3ca1e911f51b67c0bdde8bc6bcd6f33 Mon Sep 17 00:00:00 2001
From: Joshua Roys <[email protected]>
Date: Thu, 4 Mar 2010 13:25:37 +0000
Subject: [PATCH] 566664 - handle null SELinux contexts in config uploads

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

diff --git a/client/tools/rhncfg/config_common/file_utils.py 
b/client/tools/rhncfg/config_common/file_utils.py
index 7b609a0..d9c69b4 100644
--- a/client/tools/rhncfg/config_common/file_utils.py
+++ b/client/tools/rhncfg/config_common/file_utils.py
@@ -91,9 +91,11 @@ class FileProcessor:
         result = ''
 
         cur_sectx = lgetfilecon(path)[1]
+        if cur_sectx == None:
+            cur_sectx = ''
         if file_struct.has_key('selinux_ctx'):
             if cur_sectx != file_struct['selinux_ctx']:
-                sectx_result = "SELinux contexts differ!  Current context: 
%s\n" % cur_sectx
+                sectx_result = "SELinux contexts differ!  Current: %s, 
expected: %s\n" % (cur_sectx, file_struct['selinux_ctx'])
 
         if file_struct['filetype'] == 'symlink':
             try:
diff --git a/client/tools/rhncfg/config_common/repository.py 
b/client/tools/rhncfg/config_common/repository.py
index 78abc9e..bc71a7d 100644
--- a/client/tools/rhncfg/config_common/repository.py
+++ b/client/tools/rhncfg/config_common/repository.py
@@ -28,10 +28,10 @@ import utils
 from rhn_log import log_debug, die
 #from rhn_rpc import rpclib
 try:
-    from selinux import getfilecon
+    from selinux import lgetfilecon
 except:
     # on rhel4 we do not support selinux
-    def getfilecon(path):
+    def lgetfilecon(path):
         return [0, ''];
 
 
@@ -132,7 +132,9 @@ class Repository:
             ret['group'] = gr_name
             self._gid_cache[gid] = gr_name
 
-        ret['selinux_ctx'] = getfilecon(path)[1]
+        ret['selinux_ctx'] = lgetfilecon(path)[1]
+        if ret['selinux_ctx'] == None:
+            ret['selinux_ctx'] = ''
 
         return ret
 
-- 
1.6.5.2

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to