xfs
[Top] [All Lists]

[PATCH] xfstests: fix selinux context handling

To: <linux-btrfs@xxxxxxxxxxxxxxx>, <xfs@xxxxxxxxxxx>, <sandeen@xxxxxxxxxx>
Subject: [PATCH] xfstests: fix selinux context handling
From: Josef Bacik <jbacik@xxxxxx>
Date: Fri, 9 May 2014 16:40:27 -0400
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=3z/kGS8uF+F5MukTdxjLUyVd6hYQKj6RPlc3D1VQ4Fs=; b=cBAoT8OkyURXRC+7W6yataodnEOAsncynVqe116Li+glvH1rzCZfDuNpOJ8fPgsF3pUO C1darveFpkua9lZd0Ai9CmK6BzxdS8gN1NrIH5tU4DEK447k3YGuDBfcwC7nzG4cVQFJ KC1HZmBoaxWfESmz19Nb2pbAa3R9fT85JgI=
With the new config stuff we lost the selinux options being set for systems with
selinux turned on.  We want the selinux context set all the time, wether we
provide a MOUNT_OPTIONS value or not, so take this logic out of _mount_opts()
and just put it in the body of common/config

Signed-off-by: Josef Bacik <jbacik@xxxxxx>
---
 common/config | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/config b/common/config
index e8bcf48..a2f55cf 100644
--- a/common/config
+++ b/common/config
@@ -217,16 +217,16 @@ case "$HOSTOS" in
         ;;
 esac
 
+# SELinux adds extra xattrs which can mess up our expected output.
+# So, mount with a context, and they won't be created
+# # nfs_t is a "liberal" context so we can use it.
+if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+       SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
+       export SELINUX_MOUNT_OPTIONS
+fi
+
 _mount_opts()
 {
-       # SELinux adds extra xattrs which can mess up our expected output.
-       # So, mount with a context, and they won't be created
-       # # nfs_t is a "liberal" context so we can use it.
-       if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
-               SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
-               export SELINUX_MOUNT_OPTIONS
-       fi
-
        case $FSTYP in
        xfs)
                export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
-- 
1.8.3.1

<Prev in Thread] Current Thread [Next in Thread>