Blob Blame History Raw
--- busybox-1.2.2/procps/ps.c.id_ps	2006-07-01 00:42:12.000000000 +0200
+++ busybox-1.2.2/procps/ps.c	2007-01-22 10:43:51.000000000 +0100
@@ -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.2.2/coreutils/id.c.id_ps	2006-07-01 00:42:07.000000000 +0200
+++ busybox-1.2.2/coreutils/id.c	2007-01-22 10:57:45.000000000 +0100
@@ -26,6 +26,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)
 {
@@ -50,9 +51,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();
 	gid = getegid();
@@ -81,12 +90,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() ) {
@@ -103,7 +120,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