File procps-v3.3.3-selinux.patch of Package procps

--- ps/Makefile.am
+++ ps/Makefile.am	2012-06-04 12:35:28.896510496 +0000
@@ -3,7 +3,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
 	-DLOCALEDIR=\"$(localedir)\"
 
-AM_LDFLAGS = ../proc/libprocps.la
+AM_LDFLAGS = ../proc/libprocps.la -ldl
 
 dist_man_MANS = ps.1
 
--- ps/output.c
+++ ps/output.c	2012-06-01 15:20:53.892510827 +0000
@@ -1164,7 +1164,7 @@ static int pr_sgi_p(char *restrict const
 
 /****************** FLASK & seLinux security stuff **********************/
 // move the bulk of this to libproc sometime
-
+#if 0
 static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
   char filename[48];
   size_t len;
@@ -1193,7 +1193,7 @@ fail:
   return 1;
 }
 
-#if 0
+#else
 // This needs more study, considering:
 // 1. the static linking option (maybe disable this in that case)
 // 2. the -z and -Z option issue
--- ps/parser.c
+++ ps/parser.c	2012-06-01 15:21:29.632010485 +0000
@@ -230,7 +230,7 @@ static const char *parse_sysv_option(voi
     // In the meantime, please do not add to it. The list is
     // intended to ONLY contain flags defined by the POSIX and UNIX
     // standards published by The Open Group, IEEE, and ISO.
-    if(!strchr("aAdefgGlnoptuU", *flagptr)) not_pure_unix = 1;  // dude, -Z ain't in POSIX
+    if(!strchr("aAdefgGlnoptuUZ", *flagptr)) not_pure_unix = 1;  // dude, -Z ain't in POSIX
 
     switch(*flagptr){
     case 'A':
--- ps/ps.1
+++ ps/ps.1	2012-06-01 15:22:45.268010363 +0000
@@ -423,6 +423,9 @@ option, which
 .B \-F
 implies.
 .TP
+.BI \-Z
+display security context format (SELinux, etc.)
+.TP
 .BI \-\-format \ format
 user\-defined format.  Identical to
 .B \-o
--- w.c
+++ w.c	2012-06-01 15:23:59.596010373 +0000
@@ -235,6 +235,12 @@ static const proc_t *getproc(const utmp_
 			continue;
 		best = tmp;
 	}
+	/*
+	 * It is there but SELinux wouldn't allow us to know the detail. Really
+	 * w should just be given rights
+	 */
+	if(!kill(u->ut_pid, 0) || errno != ESRCH)
+		*found_utpid = 1;
 	return best ? best : secondbest;
 }
 
openSUSE Build Service is sponsored by