[policycoreutils/f14/master] - Warn on errors to run setsebool as root

Daniel J Walsh dwalsh at fedoraproject.org
Thu Jan 6 21:48:29 UTC 2011


commit 167eb4ae4d92bdaadceebcd7c011f1960c09fe4e
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Thu Jan 6 16:48:17 2011 -0500

    - Warn on errors to run setsebool as root

 policycoreutils-f15.patch |   35 +++++++++++++++++++++++++++++++++++
 policycoreutils.spec      |    7 ++++++-
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/policycoreutils-f15.patch b/policycoreutils-f15.patch
new file mode 100644
index 0000000..594cea9
--- /dev/null
+++ b/policycoreutils-f15.patch
@@ -0,0 +1,35 @@
+diff -up policycoreutils-2.0.83/setsebool/setsebool.c.root policycoreutils-2.0.83/setsebool/setsebool.c
+--- policycoreutils-2.0.83/setsebool/setsebool.c.root	2011-01-06 16:45:56.000000000 -0500
++++ policycoreutils-2.0.83/setsebool/setsebool.c	2011-01-06 16:46:01.000000000 -0500
+@@ -82,8 +82,13 @@ static int selinux_set_boolean_list(size
+ 		if (errno == ENOENT)
+ 			fprintf(stderr, "Could not change active booleans: "
+ 				"Invalid boolean\n");
+-		else if (errno)
+-			perror("Could not change active booleans");
++		else if (errno) {
++			if (getuid() == 0) {
++				perror("Could not change active booleans");
++			} else {
++				perror("Could not change active booleans. Please try as root");
++			}
++		}
+ 
+ 		return -1;
+ 	}
+@@ -115,8 +120,13 @@ static int semanage_set_boolean_list(siz
+ 		goto err;
+ 
+ 	} else if (managed == 0) {
+-		fprintf(stderr,
+-			"Cannot set persistent booleans without managed policy.\n");
++		if (getuid() == 0) {
++			fprintf(stderr,
++				"Cannot set persistent booleans without managed policy.\n");
++		} else {
++			fprintf(stderr,
++				"Cannot set persistent booleans, please try as root.\n");
++		}
+ 		goto err;
+ 	}
+ 
diff --git a/policycoreutils.spec b/policycoreutils.spec
index f969435..f5b123c 100644
--- a/policycoreutils.spec
+++ b/policycoreutils.spec
@@ -7,7 +7,7 @@
 Summary: SELinux policy core utilities
 Name:	 policycoreutils
 Version: 2.0.83
-Release: 33.6%{?dist}
+Release: 33.7%{?dist}
 License: GPLv2
 Group:	 System Environment/Base
 Source:  http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
@@ -24,6 +24,7 @@ Patch:	 policycoreutils-rhat.patch
 Patch1:	 policycoreutils-po.patch
 Patch3:	 policycoreutils-gui.patch
 Patch4:	 policycoreutils-sepolgen.patch
+Patch5:	 policycoreutils-f15.patch
 Obsoletes: policycoreutils < 2.0.61-2
 
 %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
@@ -62,6 +63,7 @@ context.
 %patch1 -p1 -b .rhatpo
 %patch3 -p1 -b .gui
 %patch4 -p1 -b .sepolgen
+%patch5 -p1 -b .f15
 
 %build
 make LSPP_PRIV=y LIBDIR="%{_libdir}" CFLAGS="%{optflags} -fPIE " LDFLAGS="-pie -Wl,-z,relro" all 
@@ -315,6 +317,9 @@ fi
 exit 0
 
 %changelog
+* Thu Jan 6 2011 Dan Walsh <dwalsh at redhat.com> 2.0.83-33.7
+- Warn on errors to run setsebool as root
+
 * Tue Jan 4 2011 Dan Walsh <dwalsh at redhat.com> 2.0.83-33.6
 - Polgengui raises the wrong type of exception.  #471078
 - Change semanage to not allow it to semanage module -D


More information about the scm-commits mailing list