svn commit: trunk/busybox/selinux

vda at busybox.net vda at busybox.net
Wed Feb 7 14:08:42 PST 2007


Author: vda
Date: 2007-02-07 14:08:42 -0800 (Wed, 07 Feb 2007)
New Revision: 17808

Log:
selinux fixes by KaiGai Kohei <kaigai at kaigai.gr.jp>


Modified:
   trunk/busybox/selinux/getenforce.c
   trunk/busybox/selinux/getsebool.c
   trunk/busybox/selinux/matchpathcon.c
   trunk/busybox/selinux/selinuxenabled.c
   trunk/busybox/selinux/setenforce.c


Changeset:
Modified: trunk/busybox/selinux/getenforce.c
===================================================================
--- trunk/busybox/selinux/getenforce.c	2007-02-07 20:27:03 UTC (rev 17807)
+++ trunk/busybox/selinux/getenforce.c	2007-02-07 22:08:42 UTC (rev 17808)
@@ -8,6 +8,7 @@
 
 #include "busybox.h"
 
+int getenforce_main(int argc, char **argv);
 int getenforce_main(int argc, char **argv)
 {
 	int rc;

Modified: trunk/busybox/selinux/getsebool.c
===================================================================
--- trunk/busybox/selinux/getsebool.c	2007-02-07 20:27:03 UTC (rev 17807)
+++ trunk/busybox/selinux/getsebool.c	2007-02-07 22:08:42 UTC (rev 17808)
@@ -8,6 +8,7 @@
 
 #include "busybox.h"
 
+int getsebool_main(int argc, char **argv);
 int getsebool_main(int argc, char **argv)
 {
 	int i, rc = 0, active, pending, len = 0;

Modified: trunk/busybox/selinux/matchpathcon.c
===================================================================
--- trunk/busybox/selinux/matchpathcon.c	2007-02-07 20:27:03 UTC (rev 17807)
+++ trunk/busybox/selinux/matchpathcon.c	2007-02-07 22:08:42 UTC (rev 17808)
@@ -29,6 +29,7 @@
 #define OPT_PREFIX      (1<<3)  /* -p */
 #define OPT_VERIFY      (1<<4)  /* -V */
 
+int matchpathcon_main(int argc, char **argv);
 int matchpathcon_main(int argc, char **argv)
 {
 	int error = 0;
@@ -41,7 +42,7 @@
 	argv += optind;
 
 	if (opts & OPT_NOT_TRANS) {
-		set_matchpathcon_flags(NOTRANS);
+		set_matchpathcon_flags(MATCHPATHCON_NOTRANS);
 	}
 	if (opts & OPT_FCONTEXT) {
 		if (matchpathcon_init(fcontext))
@@ -57,7 +58,7 @@
 		int rc;
 
 		if (!(opts & OPT_VERIFY)) {
-			error += print_matchpathcon(path, opt & OPT_NOT_PRINT);
+			error += print_matchpathcon(path, opts & OPT_NOT_PRINT);
 			continue;
 		}
 

Modified: trunk/busybox/selinux/selinuxenabled.c
===================================================================
--- trunk/busybox/selinux/selinuxenabled.c	2007-02-07 20:27:03 UTC (rev 17807)
+++ trunk/busybox/selinux/selinuxenabled.c	2007-02-07 22:08:42 UTC (rev 17808)
@@ -7,6 +7,7 @@
  */
 #include "busybox.h"
 
+int selinuxenabled_main(int argc, char **argv);
 int selinuxenabled_main(int argc, char **argv)
 {
 	return !is_selinux_enabled();

Modified: trunk/busybox/selinux/setenforce.c
===================================================================
--- trunk/busybox/selinux/setenforce.c	2007-02-07 20:27:03 UTC (rev 17807)
+++ trunk/busybox/selinux/setenforce.c	2007-02-07 22:08:42 UTC (rev 17808)
@@ -8,12 +8,9 @@
 
 #include "busybox.h"
 
-static const smallint setenforce_mode[] = {
-	0,
-	1,
-	0,
-	1,
-};
+/* These strings are arranged so that odd ones
+ * result in security_setenforce(1) being done,
+ * the rest will do security_setenforce(0) */
 static const char *const setenforce_cmd[] = {
 	"0",
 	"1",
@@ -22,6 +19,7 @@
 	NULL,
 };
 
+int setenforce_main(int argc, char **argv);
 int setenforce_main(int argc, char **argv)
 {
 	int i, rc;
@@ -34,7 +32,7 @@
 	for (i = 0; setenforce_cmd[i]; i++) {
 		if (strcasecmp(argv[1], setenforce_cmd[i]) != 0)
 			continue;
-		rc = security_setenforce(setenforce_mode[i]);
+		rc = security_setenforce(i & 1);
 		if (rc < 0)
 			bb_perror_msg_and_die("setenforce() failed");
 		return 0;



More information about the busybox-cvs mailing list