rpms/busybox/devel busybox-1.1.1-id_ps.patch, NONE, 1.1 busybox.spec, 1.37, 1.38

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu May 4 13:29:23 UTC 2006


Author: varekova

Update of /cvs/dist/rpms/busybox/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19715

Modified Files:
	busybox.spec 
Added Files:
	busybox-1.1.1-id_ps.patch 
Log Message:
- add -Z option to id command, rename ps command -Z option (#190534)


busybox-1.1.1-id_ps.patch:
 coreutils/id.c  |   35 +++++++++++++++++++++++++++++------
 include/usage.h |    4 ++--
 procps/ps.c     |    4 ++--
 3 files changed, 33 insertions(+), 10 deletions(-)

--- NEW FILE busybox-1.1.1-id_ps.patch ---
--- busybox-1.1.1/procps/ps.c.id	2006-05-04 12:28:29.000000000 +0200
+++ busybox-1.1.1/procps/ps.c	2006-05-04 12:28:40.000000000 +0200
@@ -44,11 +44,11 @@
 #if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX
 	/* handle arguments */
 #if ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX
-	i = bb_getopt_ulflags(argc, argv, "wc", &w_count);
+	i = bb_getopt_ulflags(argc, argv, "wZ", &w_count);
 #elif ENABLE_FEATURE_PS_WIDE && !ENABLE_SELINUX
 	bb_getopt_ulflags(argc, argv, "w", &w_count);
 #else /* !ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX */
-	i = bb_getopt_ulflags(argc, argv, "c");
+	i = bb_getopt_ulflags(argc, argv, "Z");
 #endif
 #if ENABLE_FEATURE_PS_WIDE
 	/* if w is given once, GNU ps sets the width to 132,
--- busybox-1.1.1/include/usage.h.id	2006-05-04 10:53:43.000000000 +0200
+++ busybox-1.1.1/include/usage.h	2006-05-04 12:25:15.000000000 +0200
@@ -1228,7 +1228,7 @@
 #define id_full_usage \
 	"Print information for USERNAME or the current user\n\n" \
 	"Options:\n" \
-	USAGE_SELINUX("\t-c\tprints only the security context\n") \
+	USAGE_SELINUX("\t-Z\tprints only the security context\n") \
 	"\t-g\tprints only the group ID\n" \
 	"\t-u\tprints only the user ID\n" \
 	"\t-n\tprint a name instead of a number\n" \
@@ -2433,7 +2433,7 @@
 #define ps_full_usage \
 	"Report process status\n" \
 	USAGE_PS \
-	USAGE_SELINUX("\n\t-c\tshow SE Linux context") \
+	USAGE_SELINUX("\n\t-Z\tshow SE Linux context") \
 	USAGE_PS_WIDE("\n\tw\twide output")
 
 #define ps_example_usage \
--- busybox-1.1.1/coreutils/id.c.pom	2006-03-22 22:16:22.000000000 +0100
+++ busybox-1.1.1/coreutils/id.c	2006-05-04 12:00:06.000000000 +0200
@@ -39,6 +39,7 @@
 #define NAME_NOT_NUMBER   2
 #define JUST_USER         4
 #define JUST_GROUP        8
+#define JUST_CONTEXT	  16
 
 static short printf_full(unsigned int id, const char *arg, const char prefix)
 {
@@ -63,8 +64,17 @@
 
 	/* Don't allow -n -r -nr -ug -rug -nug -rnug */
 	/* Don't allow more than one username */
-	bb_opt_complementally = "?1:?:u--g:g--u:r?ug:n?ug";
+#ifdef CONFIG_SELINUX
+	/* Don't allow -gZ, -uZ or -nZ */
+	bb_opt_complementally = "?1:?:u--g:g--u:g--Z:Z--g:u--Z:Z--u:Z--n:n--Z:r?ug:n?ug";
+#else
+	bb_opt_complementally = "?1:?:u--g:g--u:r?ug:n?ug:";
+#endif
+#ifdef CONFIG_SELINUX
+        flags = bb_getopt_ulflags(argc, argv, "rnugZ");
+#else
 	flags = bb_getopt_ulflags(argc, argv, "rnug");
+#endif
 
 	/* This values could be overwritten later */
 	uid = geteuid();
@@ -94,12 +104,20 @@
 		bb_fflush_stdout_and_exit(EXIT_SUCCESS);
 	}
 
+#ifndef CONFIG_SELINUX
+	if ((flags & JUST_CONTEXT) & (is_selinux_enabled())) {
+		flags -= JUST_CONTEXT;
+	}
+#endif
+
 	/* Print full info like GNU id */
 	/* bb_getpwuid doesn't exit on failure here */
-	status=printf_full(uid, bb_getpwuid(NULL, uid, 0), 'u');
-	putchar(' ');
-	/* bb_getgrgid doesn't exit on failure here */
-	status|=printf_full(gid, bb_getgrgid(NULL, gid, 0), 'g');
+	if (!(flags & JUST_CONTEXT))  {
+		status=printf_full(uid, bb_getpwuid(NULL, uid, 0), 'u');
+		putchar(' ');
+		/* bb_getgrgid doesn't exit on failure here */
+		status|=printf_full(gid, bb_getgrgid(NULL, gid, 0), 'g');
+	}
 
 #ifdef CONFIG_SELINUX
 	if ( is_selinux_enabled() ) {
@@ -116,7 +134,12 @@
 			}else{
 					safe_strncpy(context, "unknown",8);
 			}
-		bb_printf(" context=%s", context);
+		if (flags & JUST_CONTEXT) {
+			bb_printf("%s", context);
+		} 
+		else {
+			bb_printf(" context=%s", context);
+		}
 	}
 #endif
 


Index: busybox.spec
===================================================================
RCS file: /cvs/dist/rpms/busybox/devel/busybox.spec,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- busybox.spec	3 May 2006 10:58:15 -0000	1.37
+++ busybox.spec	4 May 2006 13:29:20 -0000	1.38
@@ -1,7 +1,7 @@
 Summary: Statically linked binary providing simplified versions of system commands
 Name: busybox
 Version: 1.1.1
-Release: 1
+Release: 2
 Epoch: 1
 License: GPL
 Group: System Environment/Shells
@@ -13,6 +13,7 @@
 Patch4: busybox-1.1.1-ppc64.patch
 Patch5: busybox-1.1.1-page_size.patch
 Patch6: busybox-1.1.1-overfl.patch
+Patch7: busybox-1.1.1-id_ps.patch
 URL: http://www.busybox.net
 BuildRoot: %{_tmppath}/%{name}-root
 BuildRequires: libselinux-devel >= 1.27.7-2
@@ -46,6 +47,7 @@
 %endif
 %patch5 -b .ia64 -p1
 %patch6 -b .overfl -p1
+%patch7 -b .id_ps -p1
 
 %build
 make defconfig
@@ -83,6 +85,9 @@
 /sbin/busybox.anaconda
 
 %changelog
+* Thu May  4 2006 Ivana Varekova <varekova at redhat.com> - 1:1.1.1-2
+- add -Z option to id command, rename ps command -Z option (#190534)
+
 * Wed May 03 2006 Ivana Varekova <varekova at redhat.com> - 1:1.1.1-1
 - update to 1.1.1
 - fix CVE-2006-1058 - BusyBox passwd command 




More information about the fedora-cvs-commits mailing list