diff mbox

[v2] Build the SELinux testsuite on systems using the Reference Policy

Message ID 1472047913.4446.7.camel@trentalancia.net (mailing list archive)
State Not Applicable
Headers show

Commit Message

Guido Trentalancia Aug. 24, 2016, 2:11 p.m. UTC
Fix the Makefile in the policy subdirectory of the SELinux testsuite
so that it builds correctly on the standard Reference Policy which
does not have the same booleans available on Red Hat.

Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
---
 policy/Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stephen Smalley Aug. 26, 2016, 5:06 p.m. UTC | #1
On 08/24/2016 10:11 AM, Guido Trentalancia wrote:
> Fix the Makefile in the policy subdirectory of the SELinux testsuite
> so that it builds correctly on the standard Reference Policy which
> does not have the same booleans available on Red Hat.
> 
> Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
> ---
>  policy/Makefile |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- selinux-testsuite-git-23082016-orig/policy/Makefile	2016-08-23 20:50:08.527633728 +0200
> +++ selinux-testsuite-git-23082016/policy/Makefile	2016-08-24 14:38:08.987455031 +0200
> @@ -68,7 +68,7 @@ load_rhel: all
>  
>  load_general: all
>  	# General policy load
> -	/usr/sbin/setsebool allow_domain_fd_use=0
> +	/usr/sbin/getsebool -a | grep -q allow_domain_fd_use && /usr/sbin/setsebool allow_domain_fd_use=0 || :
>  	$(SEMODULE) -i test_policy/test_policy.pp

Just test the result of getsebool allow_domain_fd_use.
No need to dump them all and grep for the one you want.
Also, the above didn't work anyway on Fedora because the boolean has
been renamed and getsebool -a lists the new names (the old names can
still be passed to getsebool and setsebool because of the
booleans.subs_dist mapping).

>  
>  unload_rhel:
> @@ -77,7 +77,7 @@ unload_rhel:
>  
>  unload_general:
>  	# General policy unload
> -	/usr/sbin/setsebool allow_domain_fd_use=1
> +	/usr/sbin/getsebool -a | grep -q allow_domain_fd_use && /usr/sbin/setsebool allow_domain_fd_use=1 || :
>  	$(SEMODULE) -r test_policy
>  
>  clean:
diff mbox

Patch

--- selinux-testsuite-git-23082016-orig/policy/Makefile	2016-08-23 20:50:08.527633728 +0200
+++ selinux-testsuite-git-23082016/policy/Makefile	2016-08-24 14:38:08.987455031 +0200
@@ -68,7 +68,7 @@  load_rhel: all
 
 load_general: all
 	# General policy load
-	/usr/sbin/setsebool allow_domain_fd_use=0
+	/usr/sbin/getsebool -a | grep -q allow_domain_fd_use && /usr/sbin/setsebool allow_domain_fd_use=0 || :
 	$(SEMODULE) -i test_policy/test_policy.pp
 
 unload_rhel:
@@ -77,7 +77,7 @@  unload_rhel:
 
 unload_general:
 	# General policy unload
-	/usr/sbin/setsebool allow_domain_fd_use=1
+	/usr/sbin/getsebool -a | grep -q allow_domain_fd_use && /usr/sbin/setsebool allow_domain_fd_use=1 || :
 	$(SEMODULE) -r test_policy
 
 clean: