Hello all,

Attached is a patch to fix a few issues found in some more thorough testing.

Thanks,

Joshua Roys
>From c84573f1bc73693542f6d81370949ba740bc013f Mon Sep 17 00:00:00 2001
From: Joshua Roys <[email protected]>
Date: Tue, 4 Aug 2009 14:26:14 -0400
Subject: Bugfixes for config files with SELinux contexts

---
 client/tools/rhncfg/config_common/transactions.py  |    2 +-
 .../configuration/validation/configFileForm.xsd    |    1 -
 .../frontend/strings/java/StringResource_en_US.xml |    6 ++++++
 .../spacewalk/oracle/procs/lookup_config_info.sql  |    2 +-
 schema/spacewalk/postgres/manual/rhnConfigInfo.sql |    1 +
 .../postgres/procs/lookup_config_info.sql          |    2 +-
 .../150-rhnConfigInfo_selinux.sql                  |    2 +-
 7 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/client/tools/rhncfg/config_common/transactions.py 
b/client/tools/rhncfg/config_common/transactions.py
index cdd7ac0..9b00e07 100644
--- a/client/tools/rhncfg/config_common/transactions.py
+++ b/client/tools/rhncfg/config_common/transactions.py
@@ -145,7 +145,7 @@ class DeployTransaction:
 
             if file_info.has_key('selinux_ctx'):
                 sectx = file_info.get('selinux_ctx')
-                if sectx is not None:
+                if sectx is not None and sectx is not "":
                     log_debug(1, "selinux context: " + sectx);
                     if setfilecon(temp_file_path, sectx) < 0:
                         raise Exception("failed to set selinux context on %s" 
% dest_path)
diff --git 
a/java/code/src/com/redhat/rhn/frontend/action/configuration/validation/configFileForm.xsd
 
b/java/code/src/com/redhat/rhn/frontend/action/configuration/validation/configFileForm.xsd
index c2c6eba..8629faa 100644
--- 
a/java/code/src/com/redhat/rhn/frontend/action/configuration/validation/configFileForm.xsd
+++ 
b/java/code/src/com/redhat/rhn/frontend/action/configuration/validation/configFileForm.xsd
@@ -22,7 +22,6 @@
        </attribute>
        <attribute name="cffSELinuxCtx">
                <simpleType baseType="string">
-                       <minLength value="0" />
                        <maxLength value="64" />
                </simpleType>
        </attribute>
diff --git 
a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml 
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index ab5ce38..6027b74 100644
--- 
a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ 
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -6866,6 +6866,12 @@ Follow this url to see the full list of inactive systems:
           <context 
context-type="sourcefile">/rhn/configuration/file/FileDetails.do</context>
         </context-group>
       </trans-unit>
+      <trans-unit id="cffSELinuxCtx">
+<source>SELinux context</source>
+        <context-group name="ctx">
+          <context 
context-type="sourcefile">/rhn/configuration/file/FileDetails.do</context>
+        </context-group>
+      </trans-unit>
       <trans-unit id="cffMacroStart">
 <source>Macro start tag</source>
         <context-group name="ctx">
diff --git a/schema/spacewalk/oracle/procs/lookup_config_info.sql 
b/schema/spacewalk/oracle/procs/lookup_config_info.sql
index 65e238b..71a968e 100644
--- a/schema/spacewalk/oracle/procs/lookup_config_info.sql
+++ b/schema/spacewalk/oracle/procs/lookup_config_info.sql
@@ -34,7 +34,7 @@ is
            and username = username_in
            and groupname = groupname_in
            and filemode = filemode_in
-           and selinux_ctx = selinux_ctx_in;
+           and nvl(selinux_ctx, ' ') = nvl(selinux_ctx_in, ' ');
 begin
     for r in lookup_cursor loop
         return r.id;
diff --git a/schema/spacewalk/postgres/manual/rhnConfigInfo.sql 
b/schema/spacewalk/postgres/manual/rhnConfigInfo.sql
index ef594c3..77d16c7 100644
--- a/schema/spacewalk/postgres/manual/rhnConfigInfo.sql
+++ b/schema/spacewalk/postgres/manual/rhnConfigInfo.sql
@@ -30,6 +30,7 @@ rhnConfigInfo
        filemode                numeric not null,
        created                 timestamp default (current_timestamp) not null,
        modified                timestamp default (current_timestamp) not null,
+       selinux_ctx             varchar(64),
                                constraint rhn_confinfo_ugf_uq unique ( 
username, groupname, filemode )
 --                             tablespace [[4m_tbs]]
 )
diff --git a/schema/spacewalk/postgres/procs/lookup_config_info.sql 
b/schema/spacewalk/postgres/procs/lookup_config_info.sql
index d307d74..ab49472 100644
--- a/schema/spacewalk/postgres/procs/lookup_config_info.sql
+++ b/schema/spacewalk/postgres/procs/lookup_config_info.sql
@@ -33,7 +33,7 @@ declare
          where username = username_in
            and groupname = groupname_in
            and filemode = filemode_in
-           and selinux_ctx = selinux_ctx_in;
+           and nvl(selinux_ctx, ' ') = nvl(selinux_ctx_in, ' ');
 begin
     for r in lookup_cursor loop
         return r.id;
diff --git 
a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/150-rhnConfigInfo_selinux.sql
 
b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/150-rhnConfigInfo_selinux.sql
index f348e11..06ddefa 100644
--- 
a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/150-rhnConfigInfo_selinux.sql
+++ 
b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/150-rhnConfigInfo_selinux.sql
@@ -30,7 +30,7 @@ IS
            AND username = username_in
            AND groupname = groupname_in
            AND filemode = filemode_in
-           AND selinux_ctx = selinux_ctx_in;
+           AND nvl(selinux_ctx, ' ') = nvl(selinux_ctx_in, ' ');
 BEGIN
     FOR r IN lookup_cursor LOOP
         RETURN r.id;
-- 
1.6.4

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

Reply via email to