]> git.ipfire.org Git - ipfire-3.x.git/blob - procps/patches/procps-3.2.8-selinux.patch
Change file layout of the makefiles.
[ipfire-3.x.git] / procps / patches / procps-3.2.8-selinux.patch
1 diff --git a/Makefile b/Makefile
2 index 09fb3ed..4d05900 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -73,12 +73,12 @@ CURSES := -lncurses
6 # Something like this is probably needed to make the SE Linux
7 # library loading not conflict with embedded systems stuff.
8 #
9 -#ifeq ($(SHARED),1)
10 -#ldl := -ldl
11 -#LIBTYPE := -DSHAREDLIB
12 -#else
13 -#LIBTYPE := -DSTATICLIB
14 -#endif
15 +ifeq ($(SHARED),1)
16 +ldl := -ldl
17 +LIBTYPE := -DSHAREDLIB
18 +else
19 +LIBTYPE := -DSTATICLIB
20 +endif
21
22 # Preprocessor flags.
23 PKG_CPPFLAGS := -D_GNU_SOURCE -I proc
24 @@ -103,7 +103,7 @@ PKG_CFLAGS := -fno-common -ffast-math \
25 # Note that some stuff below is conditional on CFLAGS containing
26 # an option that starts with "-g". (-g, -g2, -g3, -ggdb, etc.)
27 CFLAGS := -O2 -s
28 -ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS)
29 +ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) $(LIBTYPE)
30
31 PKG_LDFLAGS := -Wl,-warn-common
32 LDFLAGS :=
33 diff --git a/ps/output.c b/ps/output.c
34 index 87bf9de..edbb4cb 100644
35 --- a/ps/output.c
36 +++ b/ps/output.c
37 @@ -1099,7 +1099,7 @@ static int pr_sgi_p(char *restrict const outbuf, const proc_t *restrict const pp
38 return snprintf(outbuf, COLWID, "*");
39 }
40
41 -
42 +#ifdef STATICLIB
43 /****************** FLASK & seLinux security stuff **********************/
44 // move the bulk of this to libproc sometime
45
46 @@ -1131,7 +1131,7 @@ fail:
47 return 1;
48 }
49
50 -#if 0
51 +#else
52 // This needs more study, considering:
53 // 1. the static linking option (maybe disable this in that case)
54 // 2. the -z and -Z option issue
55 diff --git a/ps/parser.c b/ps/parser.c
56 index 5ad9035..2659d4d 100644
57 --- a/ps/parser.c
58 +++ b/ps/parser.c
59 @@ -231,7 +231,7 @@ static const char *parse_sysv_option(void){
60 // In the meantime, please do not add to it. The list is
61 // intended to ONLY contain flags defined by the POSIX and UNIX
62 // standards published by The Open Group, IEEE, and ISO.
63 - if(!strchr("aAdefgGlnoptuU", *flagptr)) not_pure_unix = 1; // dude, -Z ain't in POSIX
64 + if(!strchr("aAdefgGlnoptuUZ", *flagptr)) not_pure_unix = 1; // dude, -Z ain't in POSIX
65
66 switch(*flagptr){
67 case 'A':
68 diff --git a/ps/ps.1 b/ps/ps.1
69 index 64953d5..aab2584 100644
70 --- a/ps/ps.1
71 +++ b/ps/ps.1
72 @@ -450,6 +450,9 @@ display virtual memory format
73 Do not show flags; show rss in place of addr.
74 This option can only be used with \fB\-l\fR.
75
76 +.opt \-Z
77 +display security context format (SELinux, etc.)
78 +
79 .opt \-\-format \ format
80 user\-defined format. Identical to \fB\-o\fR and \fBo\fR.
81
82 diff --git a/w.c b/w.c
83 index 1b2a0fc..207a8a1 100644
84 --- a/w.c
85 +++ b/w.c
86 @@ -163,6 +163,10 @@ static const proc_t *getproc(const utmp_t *restrict const u, const char *restric
87 if(best && tmp->start_time <= best->start_time) continue;
88 best = tmp;
89 }
90 + /* It is there but SELinux wouldn't allow us to know the detail. Really
91 + w should just be given rights */
92 + if(!kill(u->ut_pid, 0) || errno != ESRCH)
93 + *found_utpid = 1;
94 return best ? best : secondbest;
95 }
96