]> git.pld-linux.org Git - packages/coreutils.git/blob - coreutils-selinux.patch
- coreutils-fmt-wchars.patch: Added support for multibyte encodings
[packages/coreutils.git] / coreutils-selinux.patch
1 diff -Nur coreutils-6.4/README coreutils-6.4.selinux/README
2 --- coreutils-6.4/README        2006-10-22 16:54:15.000000000 +0000
3 +++ coreutils-6.4.selinux/README        2006-10-31 23:39:34.000000000 +0000
4 @@ -7,11 +7,11 @@
5  
6  The programs that can be built with this package are:
7  
8 -  [ base64 basename cat chgrp chmod chown chroot cksum comm cp csplit cut date
9 +  [ base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date
10    dd df dir dircolors dirname du echo env expand expr factor false fmt fold
11    ginstall groups head hostid hostname id join kill link ln logname ls
12    md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr
13 -  printenv printf ptx pwd readlink rm rmdir seq sha1sum sha224sum sha256sum
14 +  printenv printf ptx pwd readlink rm rmdir runcon seq sha1sum sha224sum sha256sum
15    sha384sum sha512sum shred shuf sleep sort split stat stty su sum sync tac
16    tail tee test touch tr true tsort tty uname unexpand uniq unlink uptime
17    users vdir wc who whoami yes
18 diff -Nur coreutils-6.4/configure.ac coreutils-6.4.selinux/configure.ac
19 --- coreutils-6.4/configure.ac  2006-10-31 23:38:15.000000000 +0000
20 +++ coreutils-6.4.selinux/configure.ac  2006-10-31 23:39:34.000000000 +0000
21 @@ -264,6 +264,13 @@
22    LIB_CRYPT=
23  fi
24  
25 +dnl Give the chance to enable SELINUX
26 +AC_ARG_ENABLE(selinux, dnl
27 +[  --enable-selinux              Enable use of the SELinux libraries],
28 +[AC_DEFINE(WITH_SELINUX, 1, [Define if you want to use SELinux])
29 +LIB_SELINUX="-lselinux"
30 +AC_SUBST(LIB_SELINUX)])
31 +
32  AC_CONFIG_FILES(
33    Makefile
34    doc/Makefile
35 diff -Nur coreutils-6.4/lib/config.hin coreutils-6.4.selinux/lib/config.hin
36 --- coreutils-6.4/lib/config.hin        2006-10-22 20:36:23.000000000 +0000
37 +++ coreutils-6.4.selinux/lib/config.hin        2006-10-31 23:39:34.000000000 +0000
38 @@ -1645,6 +1645,9 @@
39     'wint_t'. */
40  #undef WINT_T_SUFFIX
41  
42 +/* Define if you want to use SELINUX */
43 +#undef WITH_SELINUX
44 +
45  /* Define to 1 if your processor stores words with the most significant byte
46     first (like Motorola and SPARC, unlike Intel and VAX). */
47  #undef WORDS_BIGENDIAN
48 --- coreutils-6.5/man/Makefile.am.orig  2006-11-22 10:47:32.569505000 +0100
49 +++ coreutils-6.5/man/Makefile.am       2006-11-22 10:48:11.669505000 +0100
50 @@ -30,7 +30,7 @@
51    shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
52    su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
53    tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
54 -  whoami.1 yes.1 $(MAN)
55 +  whoami.1 yes.1 chcon.1 runcon.1 $(MAN)
56  optional_mans = \
57    chroot.1 hostid.1 nice.1 pinky.1 stty.1 uname.1 uptime.1 users.1 who.1
58  man_MANS = getgid.1
59 @@ -142,6 +142,8 @@
60  who.1:         $(common_dep)   $(srcdir)/who.x         ../src/who.c
61  whoami.1:      $(common_dep)   $(srcdir)/whoami.x      ../src/whoami.c
62  yes.1:         $(common_dep)   $(srcdir)/yes.x         ../src/yes.c
63 +chcon.1:       $(common_dep)   $(srcdir)/chcon.x       ../src/chcon.c
64 +runcon.1:      $(common_dep)   $(srcdir)/runcon.x      ../src/runcon.c
65  
66  SUFFIXES = .x .1
67  
68 diff -Nur coreutils-6.4/man/chcon.1 coreutils-6.4.selinux/man/chcon.1
69 --- coreutils-6.4/man/chcon.1   1970-01-01 00:00:00.000000000 +0000
70 +++ coreutils-6.4.selinux/man/chcon.1   2006-10-31 23:39:34.000000000 +0000
71 @@ -0,0 +1,64 @@
72 +.TH CHCON 1 "July 2003" "chcon (coreutils) 5.0" "User Commands"
73 +.SH NAME
74 +chcon \- change security context
75 +.SH SYNOPSIS
76 +.B chcon
77 +[\fIOPTION\fR]...\fI CONTEXT FILE\fR...
78 +.br
79 +.B chcon
80 +[\fIOPTION\fR]...\fI --reference=RFILE FILE\fR...
81 +.SH DESCRIPTION
82 +.PP
83 +." Add any additional description here
84 +.PP
85 +Change the security context of each FILE to CONTEXT.
86 +.TP
87 +\fB\-c\fR, \fB\-\-changes\fR
88 +like verbose but report only when a change is made
89 +.TP
90 +\fB\-h\fR, \fB\-\-no\-dereference\fR
91 +affect symbolic links instead of any referenced file (available only on systems with lchown system call)
92 +.TP
93 +\fB\-f\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
94 +suppress most error messages
95 +.TP
96 +\fB\-l\fR, \fB\-\-range\fR
97 +set range RANGE in the target security context
98 +.TP
99 +\fB\-\-reference\fR=\fIRFILE\fR
100 +use RFILE's context instead of using a CONTEXT value
101 +.TP
102 +\fB\-R\fR, \fB\-\-recursive\fR
103 +change files and directories recursively
104 +.TP
105 +\fB\-r\fR, \fB\-\-role\fR
106 +set role ROLE in the target security context
107 +.TP
108 +\fB\-t\fR, \fB\-\-type\fR
109 +set type TYPE in the target security context
110 +.TP
111 +\fB\-u\fR, \fB\-\-user\fR
112 +set user USER in the target security context
113 +.TP
114 +\fB\-v\fR, \fB\-\-verbose\fR
115 +output a diagnostic for every file processed
116 +.TP
117 +\fB\-\-help\fR
118 +display this help and exit
119 +.TP
120 +\fB\-\-version\fR
121 +output version information and exit
122 +.SH "REPORTING BUGS"
123 +Report bugs to <email@host.com>.
124 +.SH "SEE ALSO"
125 +The full documentation for
126 +.B chcon
127 +is maintained as a Texinfo manual.  If the
128 +.B info
129 +and
130 +.B chcon
131 +programs are properly installed at your site, the command
132 +.IP
133 +.B info chcon
134 +.PP
135 +should give you access to the complete manual.
136 diff -Nur coreutils-6.4/man/chcon.x coreutils-6.4.selinux/man/chcon.x
137 --- coreutils-6.4/man/chcon.x   1970-01-01 00:00:00.000000000 +0000
138 +++ coreutils-6.4.selinux/man/chcon.x   2006-10-31 23:39:34.000000000 +0000
139 @@ -0,0 +1,4 @@
140 +[NAME]
141 +chcon \- change file security context
142 +[DESCRIPTION]
143 +.\" Add any additional description here
144 diff -Nur coreutils-6.4/man/cp.1 coreutils-6.4.selinux/man/cp.1
145 --- coreutils-6.4/man/cp.1      2006-10-22 19:56:33.000000000 +0000
146 +++ coreutils-6.4.selinux/man/cp.1      2006-10-31 23:39:34.000000000 +0000
147 @@ -57,7 +57,7 @@
148  .TP
149  \fB\-\-preserve\fR[=\fIATTR_LIST\fR]
150  preserve the specified attributes (default:
151 -mode,ownership,timestamps), if possible
152 +mode,ownership,timestamps) and security contexts, if possible
153  additional attributes: links, all
154  .TP
155  \fB\-\-no\-preserve\fR=\fIATTR_LIST\fR
156 @@ -106,6 +106,9 @@
157  \fB\-\-help\fR
158  display this help and exit
159  .TP
160 +\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR
161 +set security context of copy to CONTEXT
162 +.TP
163  \fB\-\-version\fR
164  output version information and exit
165  .PP
166 diff -Nur coreutils-6.4/man/dir.1 coreutils-6.4.selinux/man/dir.1
167 --- coreutils-6.4/man/dir.1     2006-10-22 19:56:34.000000000 +0000
168 +++ coreutils-6.4.selinux/man/dir.1     2006-10-31 23:39:34.000000000 +0000
169 @@ -204,6 +204,20 @@
170  .TP
171  \fB\-1\fR
172  list one file per line
173 +.PP
174 +SELinux options:
175 +.TP
176 +\fB\-\-lcontext\fR
177 +Display security context.   Enable \fB\-l\fR. Lines
178 +will probably be too wide for most displays.
179 +.TP
180 +\fB\-\-context\fR
181 +Display security context so it fits on most
182 +displays.  Displays only mode, user, group,
183 +security context and file name.
184 +.TP
185 +\fB\-\-scontext\fR
186 +Display only security context and file name.
187  .TP
188  \fB\-\-help\fR
189  display this help and exit
190 diff -Nur coreutils-6.4/man/id.1 coreutils-6.4.selinux/man/id.1
191 --- coreutils-6.4/man/id.1      2006-10-22 19:56:35.000000000 +0000
192 +++ coreutils-6.4.selinux/man/id.1      2006-10-31 23:39:34.000000000 +0000
193 @@ -13,6 +13,9 @@
194  \fB\-a\fR
195  ignore, for compatibility with other versions
196  .TP
197 +\fB\-Z\fR, \fB\-\-context\fR
198 +print only the security context
199 +.TP
200  \fB\-g\fR, \fB\-\-group\fR
201  print only the effective group ID
202  .TP
203 diff -Nur coreutils-6.4/man/install.1 coreutils-6.4.selinux/man/install.1
204 --- coreutils-6.4/man/install.1 2006-10-22 19:56:35.000000000 +0000
205 +++ coreutils-6.4.selinux/man/install.1 2006-10-31 23:39:34.000000000 +0000
206 @@ -66,6 +66,11 @@
207  .TP
208  \fB\-v\fR, \fB\-\-verbose\fR
209  print the name of each directory as it is created
210 +.HP
211 +\fB\-P\fR, \fB\-\-preserve_context\fR (SELinux) Preserve security context
212 +.TP
213 +\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR
214 +(SELinux) Set security context of files and directories
215  .TP
216  \fB\-\-help\fR
217  display this help and exit
218 diff -Nur coreutils-6.4/man/ls.1 coreutils-6.4.selinux/man/ls.1
219 --- coreutils-6.4/man/ls.1      2006-10-22 19:56:35.000000000 +0000
220 +++ coreutils-6.4.selinux/man/ls.1      2006-10-31 23:39:34.000000000 +0000
221 @@ -204,6 +204,20 @@
222  .TP
223  \fB\-1\fR
224  list one file per line
225 +.PP
226 +SELinux options:
227 +.TP
228 +\fB\-\-lcontext\fR
229 +Display security context.   Enable \fB\-l\fR. Lines
230 +will probably be too wide for most displays.
231 +.TP
232 +\fB\-Z\fR, \fB\-\-context\fR
233 +Display security context so it fits on most
234 +displays.  Displays only mode, user, group,
235 +security context and file name.
236 +.TP
237 +\fB\-\-scontext\fR
238 +Display only security context and file name.
239  .TP
240  \fB\-\-help\fR
241  display this help and exit
242 diff -Nur coreutils-6.4/man/mkdir.1 coreutils-6.4.selinux/man/mkdir.1
243 --- coreutils-6.4/man/mkdir.1   2006-10-22 19:56:35.000000000 +0000
244 +++ coreutils-6.4.selinux/man/mkdir.1   2006-10-31 23:39:34.000000000 +0000
245 @@ -12,6 +12,8 @@
246  .PP
247  Mandatory arguments to long options are mandatory for short options too.
248  .TP
249 +\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR (SELinux) set security context to CONTEXT
250 +.TP
251  \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR
252  set file mode (as in chmod), not a=rwx \- umask
253  .TP
254 diff -Nur coreutils-6.4/man/mkfifo.1 coreutils-6.4.selinux/man/mkfifo.1
255 --- coreutils-6.4/man/mkfifo.1  2006-10-22 19:56:35.000000000 +0000
256 +++ coreutils-6.4.selinux/man/mkfifo.1  2006-10-31 23:39:34.000000000 +0000
257 @@ -12,6 +12,9 @@
258  .PP
259  Mandatory arguments to long options are mandatory for short options too.
260  .TP
261 +\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR
262 +set security context (quoted string)
263 +.TP
264  \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR
265  set file permission bits to MODE, not a=rw \- umask
266  .TP
267 diff -Nur coreutils-6.4/man/mknod.1 coreutils-6.4.selinux/man/mknod.1
268 --- coreutils-6.4/man/mknod.1   2006-10-22 19:56:35.000000000 +0000
269 +++ coreutils-6.4.selinux/man/mknod.1   2006-10-31 23:39:34.000000000 +0000
270 @@ -12,6 +12,9 @@
271  .PP
272  Mandatory arguments to long options are mandatory for short options too.
273  .TP
274 +\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR
275 +set security context (quoted string)
276 +.TP
277  \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR
278  set file permission bits to MODE, not a=rw \- umask
279  .TP
280 diff -Nur coreutils-6.4/man/runcon.1 coreutils-6.4.selinux/man/runcon.1
281 --- coreutils-6.4/man/runcon.1  1970-01-01 00:00:00.000000000 +0000
282 +++ coreutils-6.4.selinux/man/runcon.1  2006-10-31 23:39:34.000000000 +0000
283 @@ -0,0 +1,39 @@
284 +.TH RUNCON "1" "July 2003" "runcon (coreutils) 5.0" "selinux"
285 +.SH NAME
286 +runcon \- run command with specified security context 
287 +.SH SYNOPSIS
288 +.B runcon
289 +[\fI-t TYPE\fR] [\fI-l LEVEL\fR] [\fI-u USER\fR] [\fI-r ROLE\fR] \fICOMMAND\fR [\fIARGS...\fR]
290 +.PP
291 +or
292 +.PP
293 +.B runcon
294 +\fICONTEXT\fR \fICOMMAND\fR [\fIargs...\fR]
295 +.PP
296 +.br
297 +.SH DESCRIPTION
298 +.PP
299 +.\" Add any additional description here
300 +.PP
301 +Run COMMAND with current security context modified by one or more of LEVEL,
302 +ROLE, TYPE, and USER, or with completely-specified CONTEXT.
303 +.TP
304 +\fB\-t\fR
305 +change current type to the specified type
306 +.TP
307 +\fB\-l\fR
308 +change current level range to the specified range
309 +.TP
310 +\fB\-r\fR
311 +change current role to the specified role
312 +.TP
313 +\fB\-u\fR
314 +change current user to the specified user
315 +.PP
316 +If none of \fI-t\fR, \fI-u\fR, \fI-r\fR, or \fI-l\fR, is specified,
317 +the first argument is used as the complete context.  Any additional
318 +arguments after \fICOMMAND\fR are interpreted as arguments to the
319 +command.
320 +.PP
321 +Note that only carefully-chosen contexts are likely to successfully
322 +run.
323 diff -Nur coreutils-6.4/man/runcon.x coreutils-6.4.selinux/man/runcon.x
324 --- coreutils-6.4/man/runcon.x  1970-01-01 00:00:00.000000000 +0000
325 +++ coreutils-6.4.selinux/man/runcon.x  2006-10-31 23:39:34.000000000 +0000
326 @@ -0,0 +1,2 @@
327 +[DESCRIPTION]
328 +.\" Add any additional description here
329 diff -Nur coreutils-6.4/man/stat.1 coreutils-6.4.selinux/man/stat.1
330 --- coreutils-6.4/man/stat.1    2006-10-22 19:56:37.000000000 +0000
331 +++ coreutils-6.4.selinux/man/stat.1    2006-10-31 23:39:34.000000000 +0000
332 @@ -28,6 +28,9 @@
333  \fB\-t\fR, \fB\-\-terse\fR
334  print the information in terse form
335  .TP
336 +\fB\-Z\fR, \fB\-\-context\fR
337 +print security context information for SELinux if available.
338 +.TP
339  \fB\-\-help\fR
340  display this help and exit
341  .TP
342 @@ -51,6 +54,9 @@
343  %d
344  Device number in decimal
345  .TP
346 +%C
347 +SELinux security context
348 +.TP
349  %D
350  Device number in hex
351  .TP
352 diff -Nur coreutils-6.4/man/vdir.1 coreutils-6.4.selinux/man/vdir.1
353 --- coreutils-6.4/man/vdir.1    2006-10-22 19:56:39.000000000 +0000
354 +++ coreutils-6.4.selinux/man/vdir.1    2006-10-31 23:39:34.000000000 +0000
355 @@ -204,6 +204,20 @@
356  .TP
357  \fB\-1\fR
358  list one file per line
359 +.PP
360 +SELinux options:
361 +.TP
362 +\fB\-\-lcontext\fR
363 +Display security context.   Enable \fB\-l\fR. Lines
364 +will probably be too wide for most displays.
365 +.TP
366 +\fB\-\-context\fR
367 +Display security context so it fits on most
368 +displays.  Displays only mode, user, group,
369 +security context and file name.
370 +.TP
371 +\fB\-\-scontext\fR
372 +Display only security context and file name.
373  .TP
374  \fB\-\-help\fR
375  display this help and exit
376 diff -Nur coreutils-6.4/po/POTFILES.in coreutils-6.4.selinux/po/POTFILES.in
377 --- coreutils-6.4/po/POTFILES.in        2006-10-31 23:38:15.000000000 +0000
378 +++ coreutils-6.4.selinux/po/POTFILES.in        2006-10-31 23:39:34.000000000 +0000
379 @@ -33,6 +33,7 @@
380  src/base64.c
381  src/basename.c
382  src/cat.c
383 +src/chcon.c
384  src/chgrp.c
385  src/chmod.c
386  src/chown-core.c
387 @@ -91,6 +92,7 @@
388  src/remove.c
389  src/rm.c
390  src/rmdir.c
391 +src/runcon.c
392  src/seq.c
393  src/setuidgid.c
394  src/shred.c
395 --- coreutils-6.7/po/pl.po.orig 2006-12-09 20:03:10.686071942 +0100
396 +++ coreutils-6.7/po/pl.po      2006-12-09 20:06:54.942851606 +0100
397 @@ -867,6 +867,95 @@
398  msgid "%s: input file is output file"
399  msgstr "%s: plik wej¶ciowy jest plikiem wyj¶ciowym"
400  
401 +#: src/chcon.c:101
402 +#, c-format
403 +msgid "context of %s changed to %s\n"
404 +msgstr "kontekst %s zmieniony na %s\n"
405 +
406 +#: src/chcon.c:104
407 +#, c-format
408 +msgid "failed to change context of %s to %s\n"
409 +msgstr "nie mo¿na zmieniæ kontekstu %s na %s\n"
410 +
411 +#: src/chcon.c:107
412 +#, c-format
413 +msgid "context of %s retained as %s\n"
414 +msgstr "kontekst %s zachowany jako %s\n"
415 +
416 +#: src/chcon.c:172
417 +#, c-format
418 +msgid "can't apply partial context to unlabeled file %s"
419 +msgstr "nie mo¿na zastosowaæ czê¶ciowego kontekstu na nieoznakowanym pliku %s"
420 +
421 +#: src/chcon.c:180
422 +#, c-format
423 +msgid "couldn't compute security context from %s"
424 +msgstr "nie mo¿na obliczyæ kontekstu bezpieczeñstwa z %s"
425 +
426 +#: src/chcon.c:188
427 +#, c-format
428 +msgid "invalid context: %s"
429 +msgstr "b³êdny kontekst: %s"
430 +
431 +#: src/chcon.c:210
432 +#, c-format
433 +msgid "failed to change context of %s to %s"
434 +msgstr "nie mo¿na zmieniæ kontekstu %s na %s"
435 +
436 +#: src/chcon.c:258
437 +msgid "virtual memory exhausted"
438 +msgstr "pamiêæ wirtualna wyczerpana"
439 +
440 +#: src/chcon.c:292
441 +#, c-format
442 +msgid ""
443 +"Usage: %s [OPTION]... CONTEXT FILE...\n"
444 +"  or:  %s [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...\n"
445 +"  or:  %s [OPTION]... --reference=RFILE FILE...\n"
446 +msgstr ""
447 +"Sk³adnia: %s [OPCJA]... KONTEKST PLIK...\n"
448 +"    albo: %s [OPCJA]... [-u U¯YTKOWNIK] [-r ROLA] [-l ZAKRES] [-t TYP] PLIK...\n"
449 +"    albo: %s [OPCJA]... --reference=PLIK_WZ PLIK...\n"
450 +
451 +#: src/chcon.c:298
452 +#, c-format
453 +msgid ""
454 +"Change the security context of each FILE to CONTEXT.\n"
455 +"\n"
456 +"  -c, --changes          like verbose but report only when a change is made\n"
457 +"  -h, --no-dereference   affect symbolic links instead of any referenced file\n"
458 +"                         (available only on systems with lchown system call)\n"
459 +"  -f, --silent, --quiet  suppress most error messages\n"
460 +"      --reference=RFILE  use RFILE's group instead of using a CONTEXT value\n"
461 +"  -u, --user=USER        set user USER in the target security context\n"
462 +"  -r, --role=ROLE        set role ROLE in the target security context\n"
463 +"  -t, --type=TYPE        set type TYPE in the target security context\n"
464 +"  -l, --range=RANGE      set range RANGE in the target security context\n"
465 +"  -R, --recursive        change files and directories recursively\n"
466 +"  -v, --verbose          output a diagnostic for every file processed\n"
467 +"      --help             display this help and exit\n"
468 +"      --version          output version information and exit\n"
469 +msgstr ""
470 +"Zmiana kontekstu bezpieczeñstwa ka¿dego PLIKU na KONTEKST.\n"
471 +"\n"
472 +"  -c, --changes          jak verbose, ale raportowanie tylko wykonanych zmian\n"
473 +"  -h, --no-dereference   zmiana dowi±zañ symbolicznych zamiast wskazywanych\n"
474 +"                           plików (dostêpne tylko na systemach z lchown)\n"
475 +"  -f, --silent, --quiet  pominiêcie wiêkszo¶ci komunikatów o b³êdach\n"
476 +"      --reference=PLIK   u¿ycie grupy PLIKU zamiast warto¶ci KONTEKSTU\n"
477 +"  -u, --user=U¯YTKOWNIK  ustawienie U¯YTKOWNIK w kontek¶cie bezpieczeñstwa\n"
478 +"  -r, --role=ROLA        ustawienie ROLI w kontek¶cie bezpieczeñstwa\n"
479 +"  -t, --type=TYP         ustawienie TYPU w kontek¶cie bezpieczeñstwa\n"
480 +"  -l, --range=ZAKRES     ustawienie ZAKRESU w kontek¶cie bezpieczeñstwa\n"
481 +"  -R, --recursive        zmiana plików i katalogów rekursywnie\n"
482 +"  -v, --verbose          wypisywanie diagnostyki dla ka¿dego pliku\n"
483 +"      --help             wy¶wietlenie tego opisu i zakoñczenie\n"
484 +"      --version          wy¶wietlenie informacji o wersji i zakoñczenie\n"
485 +
486 +#: src/chcon.c:393
487 +msgid "conflicting security context specifiers given"
488 +msgstr "konflikt miêdzy podanymi okre¶leniami kontekstu bezpieczeñstwa"
489 +
490  #: src/chgrp.c:95 src/install.c:612
491  #, c-format
492  msgid "invalid group %s"
493 @@ -1540,6 +1629,21 @@
494  "nie uda³o siê przeniesienie miêdzy urz±dzeniami: %s do %s; nie uda³o siê "
495  "usunaæ pliku docelowego"
496  
497 +#: src/copy.c:1305
498 +#, c-format
499 +msgid "cannot set setfscreatecon %s"
500 +msgstr "nie mo¿na ustawiæ setfscreatecon %s"
501 +
502 +#: src/copy.c:1315
503 +#, c-format
504 +msgid "warning: security context not preserved %s"
505 +msgstr "uwaga: nie zachowano kontekstu bezpieczeñstwa %s"
506 +
507 +#: src/copy.c:1317
508 +#, c-format
509 +msgid "cannot lgetfilecon %s"
510 +msgstr "nie mo¿na wykonaæ lgetfilecon %s"
511 +
512  #: src/copy.c:1534
513  #, c-format
514  msgid "cannot copy cyclic symbolic link %s"
515 @@ -1688,6 +1792,10 @@
516  "                               atrybutów: links (dowi±zania), all "
517  "(wszystkie))\n"
518  
519 +#: src/cp.c:202
520 +msgid "  -c                           same as --preserve=context\n"
521 +msgstr "  -c                           to samo co --preserve=context\n"
522 +
523  #: src/cp.c:196
524  msgid ""
525  "      --no-preserve=ATTR_LIST  don't preserve the specified attributes\n"
526 @@ -1740,12 +1848,13 @@
527  "                                 destination file is missing\n"
528  "  -v, --verbose                explain what is being done\n"
529  "  -x, --one-file-system        stay on this file system\n"
530 +"  -Z, --context=CONTEXT        set security context of copy to CONTEXT\n"
531  msgstr ""
532  "  -u, --update                 kopiowanie tylko plików, dla których Â¬RÓD£O\n"
533  "                                 jest nowsze ni¿ CEL albo brakuje CELU\n"
534  "  -v, --verbose                wyja¶nianie co siê dzieje\n"
535  "  -x, --one-file-system        pozostanie w jednym systemie plików\n"
536 -"\n"
537 +"  -Z, --context=KONTEKST       ustawienie KONTEKSTU bezpieczeñstwa kopii\n"
538  
539  #: src/cp.c:225
540  msgid ""
541 @@ -1874,6 +1983,26 @@
542  msgid "multiple target directories specified"
543  msgstr "podano wiele katalogów docelowych"
544  
545 +#: src/cp.c:1017
546 +#, c-format
547 +msgid "%s: cannot force target context <-- %s and preserve it\n"
548 +msgstr "%s: nie mo¿na wymusiæ docelowego kontekstu <-- %s i zachowaæ go\n"
549 +
550 +#: src/cp.c:1027
551 +#, c-format
552 +msgid "Warning:  ignoring --context (-Z). It requires a SELinux enabled kernel.\n"
553 +msgstr "Uwaga: zignorowano --context (-Z). Ta opcja wymaga j±dra z obs³ug± SELinuksa.\n"
554 +
555 +#: src/cp.c:1031 src/install.c:369
556 +#, c-format
557 +msgid "%s: cannot force target context to '%s' and preserve it\n"
558 +msgstr "%s: nie mo¿na wymusiæ docelowego kontekstu na '%s' i zachowaæ go\n"
559 +
560 +#: src/cp.c:1038
561 +#, c-format
562 +msgid "cannot set default security context %s"
563 +msgstr "nie mo¿na ustawiæ domy¶lnego kontekstu bezpieczeñstwa %s"
564 +
565  #: src/cp.c:1016
566  #, c-format
567  msgid "cannot make both hard and symbolic links"
568 @@ -3880,6 +4009,7 @@
569  "Print information for USERNAME, or the current user.\n"
570  "\n"
571  "  -a              ignore, for compatibility with other versions\n"
572 +"  -Z, --context   print only the context\n"
573  "  -g, --group     print only the effective group ID\n"
574  "  -G, --groups    print all group IDs\n"
575  "  -n, --name      print a name instead of a number, for -ugG\n"
576 @@ -3890,6 +4020,7 @@
577  "\n"
578  "  -a              ignorowane, dla zachowania kompatybilno¶ci z innymi "
579  "wersjami\n"
580 +"  -Z, --context   wy¶wietlenie tylko kontekstu\n"
581  "  -g, --group     wy¶wietlenie tylko efektywnego identyfikatora grupy\n"
582  "  -G, --groups    wy¶wietlenie pe³nej listy grup\n"
583  "  -n, --name      wy¶wietlenie nazw zamiast numerów, dla -ugG\n"
584 @@ -3906,10 +4037,26 @@
585  "Bez Â¿adnych OPCJI wy¶wietla zestaw u¿ytecznych informacji, które uda³o siê\n"
586  "zidentyfikowaæ.\n"
587  
588 -#: src/id.c:152
589 +#: src/id.c:165 src/mkdir.c:136 src/mkfifo.c:124 src/mknod.c:135
590  #, c-format
591 -msgid "cannot print only user and only group"
592 -msgstr "nie mo¿na wypisaæ tylko u¿ytkownika i tylko grupê równocze¶nie"
593 +msgid "Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n"
594 +msgstr "Niestety --context (-Z) mo¿na u¿ywaæ tylko na j±drze z obs³ug± SELinuksa.\n"
595 +
596 +#: src/id.c:198
597 +msgid ""
598 +"cannot display context when SELinux not enabled or when displaying the id\n"
599 +"of a different user"
600 +msgstr ""
601 +"nie mo¿na wy¶wietliæ kontekstu kiedy SELinux nie jest w³±czony lub przy\n"
602 +"wy¶wietlaniu identyfikatora innego u¿ytkownika"
603 +
604 +#: src/id.c:209
605 +msgid "can't get process context"
606 +msgstr "nie mo¿na uzyskaæ kontekstu procesu"
607 +
608 +#: src/id.c:214
609 +msgid "cannot print \"only\" of more than one choice"
610 +msgstr "nie mo¿na wypisaæ \"tylko czego¶\" dla wiêcej ni¿ jednej rzeczy"
611  
612  #: src/id.c:156
613  #, c-format
614 @@ -3941,6 +4088,31 @@
615  msgid " groups="
616  msgstr " grupy="
617  
618 +#: src/id.c:458
619 +#, c-format
620 +msgid " context=%s"
621 +msgstr " kontekst=%s"
622 +
623 +#: src/install.c:365
624 +#, c-format
625 +msgid "Warning:  ignoring --preserve_context (-P) because the kernel is not SELinux-enabled.\n"
626 +msgstr "Uwaga: zignorowano --preserve_context (-P), poniewa¿ j±dro nie ma obs³ugi SELinuksa.\n"
627 +
628 +#: src/install.c:377
629 +#, c-format
630 +msgid "Warning:  ignoring --context (-Z) because the kernel is not SELinux-enabled.\n"
631 +msgstr "Uwaga: zignorowano --context (-Z), poniewa¿ j±dro nie ma obs³ugi SELinuksa.\n"
632 +
633 +#: src/install.c:382
634 +#, c-format
635 +msgid "%s: cannot force target context == '%s' and preserve it\n"
636 +msgstr "%s: nie mo¿na wymusiæ docelowego kontekstu '%s' i zachowaæ go\n"
637 +
638 +#: src/install.c:387
639 +#, c-format
640 +msgid "%s: cannot setup default context == '%s'\n"
641 +msgstr "%s: nie mo¿na ustawiæ domy¶lnego kontekstu '%s'\n"
642 +
643  #: src/install.c:318
644  #, c-format
645  msgid "the strip option may not be used when installing a directory"
646 @@ -4079,6 +4251,14 @@
647  "  -T, --no-target-directory  traktowanie CELU jak zwyk³ego pliku\n"
648  "  -v, --verbose       wypisanie nazwy ka¿dego tworzonego katalogu\n"
649  
650 +#: src/install.c:773
651 +msgid ""
652 +"  -P, --preserve_context (SELinux) Preserve security context\n"
653 +"  -Z, --context=CONTEXT  (SELinux) Set security context of files and directories\n"
654 +msgstr ""
655 +"  -P, --preserve_context (SELinux) zachowanie kontekstu bezpieczeñstwa\n"
656 +"  -Z, --context=KONTEKST (SELinux) ustawienie kontekstu plików i katalogów\n"
657 +
658  #: src/install.c:693 src/ln.c:365 src/mv.c:318
659  msgid ""
660  "\n"
661 @@ -4468,6 +4648,11 @@
662  msgid "no login name"
663  msgstr "brak nazwy u¿ytkownika"
664  
665 +#: src/ls.c:129
666 +#, c-format
667 +msgid "Sorry, this option can only be used on a SELinux-enabled kernel.\n"
668 +msgstr "Niestety tej opcji mo¿na u¿yæ tylko na j±drze z obs³ug± SELinuksa.\n"
669 +
670  #: src/ls.c:677
671  msgid "%b %e  %Y"
672  msgstr "%b %e  %Y"
673 @@ -4841,6 +5026,34 @@
674  "  -X                         sortowanie alfabetyczne wg rozszerzeñ\n"
675  "  -1                         listowanie po jednym pliku w linii\n"
676  
677 +#: src/ls.c:4134
678 +#, c-format
679 +msgid ""
680 +"\n"
681 +"SELinux options:\n"
682 +"\n"
683 +"      --lcontext             Display security context.   Enable -l. Lines\n"
684 +"                               will probably be too wide for most displays.\n"
685 +"      -Z, --context          Display security context so it fits on most\n"
686 +"                               displays.  Displays only mode, user, group,\n"
687 +"                               security context and file name.\n"
688 +"      --scontext             Display only security context and file name.\n"
689 +"\n"
690 +"\n"
691 +msgstr ""
692 +"\n"
693 +"Opcje dla SELinuksa:\n"
694 +"\n"
695 +"      --lcontext             wy¶wietlanie kontekstu bezpieczeñstwa; w³±cza -l,\n"
696 +"                               linie mog± byæ zbyt d³ugie dla wielu terminali\n"
697 +"      --context              wy¶wietlanie kontekstu tak, Â¿eby zmie¶ci³ siê na\n"
698 +"                               wiêkszo¶ci terminali; wy¶wietlane s± tylko\n"
699 +"                               uprawnienia, w³a¶ciciel, grupa, kontekst\n"
700 +"                               bezpieczeñstwa i nazwa pliku\n"
701 +"      --scontext             wy¶wietlanie tylko kontekstu i nazwy pliku\n"
702 +"\n"
703 +"\n"
704 +
705  #: src/ls.c:4360
706  msgid ""
707  "\n"
708 @@ -5043,6 +5256,11 @@
709  "Utworzenie KATALOGU/ÓW, je¿eli jeszcze nie istniej±.\n"
710  "\n"
711  
712 +#: src/mkdir.c:74
713 +#, c-format
714 +msgid "  -Z, --context=CONTEXT (SELinux) set security context to CONTEXT\n"
715 +msgstr "  -Z, --context=KONTEKST (SELinux) ustawienie KONTEKSTU bezpieczeñstwa\n"
716 +
717  #: src/mkdir.c:67
718  msgid ""
719  "  -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask\n"
720 @@ -5059,6 +5277,11 @@
721  msgid "created directory %s"
722  msgstr "utworzony katalog %s"
723  
724 +#: src/mkdir.c:170 src/mkfifo.c:128 src/mknod.c:139
725 +#, c-format
726 +msgid "Sorry, cannot set default context to %s.\n"
727 +msgstr "Niestety nie mo¿na ustawiæ domy¶lnego kontekstu na %s.\n"
728 +
729  #: src/mkfifo.c:54
730  #, c-format
731  msgid "Usage: %s [OPTION] NAME...\n"
732 @@ -5072,6 +5295,11 @@
733  "Tworzenie nazwanych potoków (pipes, FIFOs) o podanych NAZWACH.\n"
734  "\n"
735  
736 +#: src/mkfifo.c:68 src/mknod.c:69
737 +#, c-format
738 +msgid "  -Z, --context=CONTEXT   set security context (quoted string)\n"
739 +msgstr "  -Z, --context=KONTEKST  ustawienie kontekstu bezpieczeñstwa (³añcuch cytowany)\n"
740 +
741  #: src/mkfifo.c:62 src/mknod.c:64
742  msgid ""
743  "  -m, --mode=MODE   set file permission bits to MODE, not a=rw - umask\n"
744 @@ -6808,6 +7036,72 @@
745  "  -v, --verbose   informacja diagnostyczna o ka¿dym przetworzonym\n"
746  "                  katalogu\n"
747  
748 +#: src/runcon.c:42
749 +#, c-format
750 +msgid ""
751 +"Usage: %s [OPTION]... command [args]\n"
752 +"Run a program in a different security context.\n"
753 +"\n"
754 +"  context       Complete security context\n"
755 +"  -t            type (for same role as parent)\n"
756 +"  -u            user identity\n"
757 +"  -r            role\n"
758 +"  -l            levelrange\n"
759 +"    --help      display this help and exit\n"
760 +msgstr ""
761 +"Sk³adnia: %s [OPCJA]... polecenie [argumenty]\n"
762 +"Uruchomienie programu w innym kontek¶cie bezpieczeñstwa.\n"
763 +"\n"
764 +"  kontekst      pe³ny kontekst bezpieczeñstwa\n"
765 +"  -t            typ (dla tej samej roli jako rodzica)\n"
766 +"  -u            identyfikator u¿ytkownika\n"
767 +"  -r            rola\n"
768 +"  -l            zakres poziomów\n"
769 +"    --help      wy¶wietlenie tego opisu i zakoñczenie\n"
770 +
771 +#: src/runcon.c:90
772 +#, c-format
773 +msgid "multiple roles\n"
774 +msgstr "wiele ról\n"
775 +
776 +#: src/runcon.c:97
777 +#, c-format
778 +msgid "multiple types\n"
779 +msgstr "wiele typów\n"
780 +
781 +#: src/runcon.c:104
782 +#, c-format
783 +msgid "multiple users\n"
784 +msgstr "wielu u¿ytkowników\n"
785 +
786 +#: src/runcon.c:111
787 +#, c-format
788 +msgid "multiple levelranges\n"
789 +msgstr "wiele zakresów poziomów\n"
790 +
791 +#: src/runcon.c:117
792 +#, c-format
793 +msgid "unrecognised option %c\n"
794 +msgstr "nierozpoznana opcja %c\n"
795 +
796 +#: src/runcon.c:125
797 +msgid "must specify -t, -u, -l, -r, or context"
798 +msgstr "trzeba podaæ -t, -u, -l, -r albo kontekst"
799 +
800 +#: src/runcon.c:131
801 +msgid "no command found"
802 +msgstr "nie znaleziono polecenia"
803 +
804 +#: src/runcon.c:137 src/runcon.c:145
805 +#, c-format
806 +msgid "%s is not a valid context\n"
807 +msgstr "%s nie jest poprawnym kontekstem\n"
808 +
809 +#: src/runcon.c:163
810 +#, c-format
811 +msgid "unable to setup security context %s\n"
812 +msgstr "nie mo¿na ustawiæ kontekstu bezpieczeñstwa %s\n"
813 +
814  #: src/seq.c:74
815  #, c-format
816  msgid ""
817 @@ -7689,6 +7983,7 @@
818  "      --printf=FORMAT   like --format, but interpret backslash escapes,\n"
819  "                          and do not output a mandatory trailing newline.\n"
820  "                          If you want a newline, include \\n in FORMAT.\n"
821 +"  -Z, --context         print the security context\n"
822  "  -t, --terse           print the information in terse form\n"
823  msgstr ""
824  "  -c  --format=FORMAT   u¿ycie podanego FORMATU zamiast domy¶lnego; po\n"
825 @@ -7699,6 +7994,7 @@
826  "                          uko¶nikiem odwrotnym i bez wypisywania znaku "
827  "nowej\n"
828  "                          linii. Â¯eby go wypisaæ u¿yj \\n w FORMACIE.\n"
829 +"  -Z, --context         wypisywanie kontekstu bezpieczeñstwa\n"
830  "  -t, --terse           wypisywanie informacji w skróconej formie\n"
831  
832  #: src/stat.c:849
833 @@ -7786,6 +8082,7 @@
834  "  %c   Total file nodes in file system\n"
835  "  %d   Free file nodes in file system\n"
836  "  %f   Free blocks in file system\n"
837 +"  %C   Security context in SELinux\n"
838  msgstr ""
839  "Prawid³owe specyfikacje formatu dla systemów plików:\n"
840  "\n"
841 @@ -7794,6 +8091,7 @@
842  "  %c   ca³kowita liczba i-wêz³ów w systemie plików\n"
843  "  %d   liczba wolnych i-wêz³ów w systemie plików\n"
844  "  %f   liczba wolnych bloków w systemie plików\n"
845 +"  %C   kontekst bezpieczeñstwa w SELinuksie\n"
846  
847  #: src/stat.c:896
848  msgid ""
849 @@ -7813,6 +8111,10 @@
850  "  %t   typ szesnastkowo\n"
851  "  %T   typ w formie czytelnej dla cz³owieka\n"
852  
853 +#: src/stat.c:900
854 +msgid "Kernel is not SELinux enabled"
855 +msgstr "J±dro nie ma obs³ugi SELinuksa"
856 +
857  #: src/stty.c:511
858  #, c-format
859  msgid ""
860 diff -Nur coreutils-6.4/src/Makefile.am coreutils-6.4.selinux/src/Makefile.am
861 --- coreutils-6.4/src/Makefile.am       2006-10-31 23:38:15.000000000 +0000
862 +++ coreutils-6.4.selinux/src/Makefile.am       2006-10-31 23:39:34.000000000 +0000
863 @@ -20,14 +20,14 @@
864  EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who
865  
866  bin_SCRIPTS = groups
867 -bin_PROGRAMS = [ chgrp chown chmod cp dd dircolors du \
868 +bin_PROGRAMS = [ chgrp chown chmod chcon cp dd dircolors du \
869    ginstall link ln dir vdir ls mkdir \
870    mkfifo mknod mv nohup readlink rm rmdir shred stat sync touch unlink \
871    cat cksum comm csplit cut expand fmt fold head join md5sum \
872    nl od paste pr ptx sha1sum sha224sum sha256sum sha384sum sha512sum \
873    shuf sort split sum tac tail tr tsort unexpand uniq wc \
874    basename date dirname echo env expr factor false getgid \
875 -  hostname id kill logname pathchk printenv printf pwd seq sleep tee \
876 +  hostname id kill logname pathchk printenv printf pwd runcon seq sleep tee \
877    test true tty whoami yes \
878    base64 \
879    $(OPTIONAL_BIN_PROGS) $(DF_PROG)
880 @@ -112,6 +112,20 @@
881  mv_LDADD += $(LIB_ACL)
882  ginstall_LDADD += $(LIB_ACL)
883  
884 +dir_LDADD += @LIB_SELINUX@
885 +ls_LDADD += @LIB_SELINUX@
886 +vdir_LDADD += @LIB_SELINUX@
887 +cp_LDADD += @LIB_SELINUX@
888 +ginstall_LDADD += @LIB_SELINUX@
889 +mv_LDADD += @LIB_SELINUX@
890 +chcon_LDADD = $(LDADD) @LIB_SELINUX@
891 +id_LDADD = $(LDADD) @LIB_SELINUX@
892 +mkdir_LDADD = $(LDADD) @LIB_SELINUX@
893 +mkfifo_LDADD = $(LDADD) @LIB_SELINUX@
894 +mknod_LDADD = $(LDADD) @LIB_SELINUX@
895 +stat_LDADD = $(LDADD) @LIB_SELINUX@
896 +runcon_LDADD = $(LDADD) @LIB_SELINUX@
897 +
898  $(PROGRAMS): ../lib/libcoreutils.a
899  
900  SUFFIXES = .sh
901 diff -Nur coreutils-6.4/src/chcon.c coreutils-6.4.selinux/src/chcon.c
902 --- coreutils-6.4/src/chcon.c   1970-01-01 00:00:00.000000000 +0000
903 +++ coreutils-6.4.selinux/src/chcon.c   2006-10-31 23:39:34.000000000 +0000
904 @@ -0,0 +1,423 @@
905 +/* chcontext -- change security context of a pathname */
906 +
907 +#include <config.h>
908 +#include <stdio.h>
909 +#include <sys/types.h>
910 +#include <grp.h>
911 +#include <getopt.h>
912 +#include <selinux/selinux.h>
913 +#include <selinux/context.h>
914 +
915 +#include "system.h"
916 +#include "error.h"
917 +#include "savedir.h"
918 +#include "group-member.h"
919 +
920 +enum Change_status
921 +{
922 +  CH_SUCCEEDED,
923 +  CH_FAILED,
924 +  CH_NO_CHANGE_REQUESTED
925 +};
926 +
927 +enum Verbosity
928 +{
929 +  /* Print a message for each file that is processed.  */
930 +  V_high,
931 +
932 +  /* Print a message for each file whose attributes we change.  */
933 +  V_changes_only,
934 +
935 +  /* Do not be verbose.  This is the default. */
936 +  V_off
937 +};
938 +
939 +static int change_dir_context (const char *dir, const struct stat *statp);
940 +
941 +/* The name the program was run with. */
942 +char *program_name;
943 +
944 +/* If nonzero, and the systems has support for it, change the context
945 +   of symbolic links rather than any files they point to.  */
946 +static int change_symlinks;
947 +
948 +/* If nonzero, change the context of directories recursively. */
949 +static int recurse;
950 +
951 +/* If nonzero, force silence (no error messages). */
952 +static int force_silent;
953 +
954 +/* Level of verbosity.  */
955 +static enum Verbosity verbosity = V_off;
956 +
957 +/* The name of the context file is being given. */
958 +static const char *specified_context;
959 +
960 +/* Specific components of the context */
961 +static const char *specified_user;
962 +static const char *specified_role;
963 +static const char *specified_range;
964 +static const char *specified_type;
965 +
966 +/* The argument to the --reference option.  Use the context of this file.
967 +   This file must exist.  */
968 +static char *reference_file;
969 +
970 +/* If nonzero, display usage information and exit.  */
971 +static int show_help;
972 +
973 +/* If nonzero, print the version on standard output and exit.  */
974 +static int show_version;
975 +
976 +static struct option const long_options[] =
977 +{
978 +  {"recursive", no_argument, 0, 'R'},
979 +  {"changes", no_argument, 0, 'c'},
980 +  {"no-dereference", no_argument, 0, 'h'},
981 +  {"silent", no_argument, 0, 'f'},
982 +  {"quiet", no_argument, 0, 'f'},
983 +  {"reference", required_argument, 0, CHAR_MAX + 1},
984 +  {"context", required_argument, 0, CHAR_MAX + 2},
985 +  {"user", required_argument, 0, 'u'},
986 +  {"role", required_argument, 0, 'r'},      
987 +  {"type", required_argument, 0, 't'},
988 +  {"range", required_argument, 0, 'l'},   
989 +  {"verbose", no_argument, 0, 'v'},
990 +  {"help", no_argument, &show_help, 1},
991 +  {"version", no_argument, &show_version, 1},
992 +  {0, 0, 0, 0}
993 +};
994 +
995 +/* Tell the user how/if the context of FILE has been changed.
996 +   CHANGED describes what (if anything) has happened. */
997 +
998 +static void
999 +describe_change (const char *file, security_context_t newcontext, enum Change_status changed)
1000 +{
1001 +  const char *fmt;
1002 +  switch (changed)
1003 +    {
1004 +    case CH_SUCCEEDED:
1005 +      fmt = _("context of %s changed to %s\n");
1006 +      break;
1007 +    case CH_FAILED:
1008 +      fmt = _("failed to change context of %s to %s\n");
1009 +      break;
1010 +    case CH_NO_CHANGE_REQUESTED:
1011 +      fmt = _("context of %s retained as %s\n");
1012 +      break;
1013 +    default:
1014 +      abort ();
1015 +    }
1016 +  printf (fmt, file, newcontext);
1017 +}
1018 +
1019 +static int
1020 +compute_context_from_mask (security_context_t context, context_t *ret)
1021 +{
1022 +  context_t newcontext = context_new (context);
1023 +  if (!newcontext)
1024 +    return 1;
1025 +#define SETCOMPONENT(comp) \
1026 +  do { \
1027 +    if (specified_ ## comp) \
1028 +      if (context_ ## comp ## _set (newcontext, specified_ ## comp)) \
1029 +        goto lose; \
1030 +  } while (0)
1031 +      
1032 +  SETCOMPONENT(user);
1033 +  SETCOMPONENT(range);
1034 +  SETCOMPONENT(role);
1035 +  SETCOMPONENT(type);
1036 +#undef SETCOMPONENT
1037 +  
1038 +  *ret = newcontext;
1039 +  return 0;
1040 + lose:
1041 +  context_free (newcontext);
1042 +  return 1;
1043 +}
1044 +
1045 +/* Change the context of FILE, using specified components.
1046 +   If it is a directory and -R is given, recurse.
1047 +   Return 0 if successful, 1 if errors occurred. */
1048 +
1049 +static int
1050 +change_file_context (const char *file)
1051 +{
1052 +  struct stat file_stats;
1053 +  security_context_t file_context=NULL;
1054 +  context_t context;
1055 +  security_context_t context_string;
1056 +  int errors = 0;
1057 +  int status = 0;
1058 +
1059 +  if (change_symlinks)
1060 +    status = lgetfilecon(file, &file_context);
1061 +  else 
1062 +    status = getfilecon(file, &file_context);
1063 +
1064 +  if ((status < 0) && (errno != ENODATA))
1065 +    {
1066 +      if (force_silent == 0)
1067 +       error (0, errno, "%s", file);
1068 +      return 1;
1069 +    }
1070 +
1071 +  /* If the file doesn't have a context, and we're not setting all of
1072 +     the context components, there isn't really an obvious default.
1073 +     Thus, we just give up. */
1074 +  if (file_context == NULL && specified_context == NULL)
1075 +    {
1076 +      error (0, 0, _("can't apply partial context to unlabeled file %s"), file);
1077 +      return 1;
1078 +    }
1079 +      
1080 +  if (specified_context == NULL)
1081 +    {
1082 +      if (compute_context_from_mask (file_context, &context))
1083 +       {
1084 +         error (0, 0, _("couldn't compute security context from %s"), file_context);
1085 +             return 1;
1086 +       }
1087 +    }
1088 +  else
1089 +    {
1090 +      context = context_new (specified_context);
1091 +      if (!context)
1092 +       error (1, 0,_("invalid context: %s"),specified_context);            
1093 +    }
1094 +
1095 +  context_string = context_str (context);
1096 +      
1097 +  if (file_context == NULL || strcmp(context_string,file_context)!=0)
1098 +    {
1099 +      int fail;
1100 +
1101 +      if (change_symlinks)
1102 +       fail = lsetfilecon (file, context_string);
1103 +      else
1104 +       fail = setfilecon (file, context_string);
1105 +
1106 +      if (verbosity == V_high || (verbosity == V_changes_only && !fail))
1107 +       describe_change (file, context_string, (fail ? CH_FAILED : CH_SUCCEEDED));
1108 +
1109 +      if (fail)
1110 +       {
1111 +         errors = 1;
1112 +         if (force_silent == 0)
1113 +           {
1114 +             error (0, errno, _("failed to change context of %s to %s"), file, context_string);
1115 +           }
1116 +       }
1117 +    }
1118 +  else if (verbosity == V_high)
1119 +    {
1120 +      describe_change (file, context_string, CH_NO_CHANGE_REQUESTED);
1121 +    }
1122 +
1123 +  context_free(context);
1124 +  freecon(file_context);
1125 +
1126 +  if (recurse) {
1127 +    if (lstat(file, &file_stats)==0)
1128 +      if (S_ISDIR (file_stats.st_mode) && 
1129 +         (strcmp(file,"..") !=0) &&
1130 +         (strcmp(file,".") !=0))
1131 +       errors |= change_dir_context (file, &file_stats);
1132 +  }
1133 +  return errors;
1134 +}
1135 +
1136 +/* Recursively change context of the files in directory DIR
1137 +   using specified context components.
1138 +   STATP points to the results of lstat on DIR.
1139 +   Return 0 if successful, 1 if errors occurred. */
1140 +
1141 +static int
1142 +change_dir_context (const char *dir, const struct stat *statp)
1143 +{
1144 +  char *name_space, *namep;
1145 +  char *path;                  /* Full path of each entry to process. */
1146 +  unsigned dirlength;          /* Length of `dir' and '\0'. */
1147 +  unsigned filelength;         /* Length of each pathname to process. */
1148 +  unsigned pathlength;         /* Bytes allocated for `path'. */
1149 +  int errors = 0;
1150 +
1151 +  errno = 0;
1152 +  name_space = savedir (dir);
1153 +  if (name_space == NULL)
1154 +    {
1155 +      if (errno)
1156 +        {
1157 +         if (force_silent == 0)
1158 +           error (0, errno, "%s", dir);
1159 +         return 1;
1160 +       }
1161 +      else
1162 +       error (1, 0, _("virtual memory exhausted"));
1163 +    }
1164 +
1165 +  dirlength = strlen (dir) + 1;        /* + 1 is for the trailing '/'. */
1166 +  pathlength = dirlength + 1;
1167 +  /* Give `path' a dummy value; it will be reallocated before first use. */
1168 +  path = xmalloc (pathlength);
1169 +  strcpy (path, dir);
1170 +  path[dirlength - 1] = '/';
1171 +
1172 +  for (namep = name_space; *namep; namep += filelength - dirlength)
1173 +    {
1174 +      filelength = dirlength + strlen (namep) + 1;
1175 +      if (filelength > pathlength)
1176 +       {
1177 +         pathlength = filelength * 2;
1178 +         path = xrealloc (path, pathlength);
1179 +       }
1180 +      strcpy (path + dirlength, namep);
1181 +      errors |= change_file_context (path);
1182 +    }
1183 +  free (path);
1184 +  free (name_space);
1185 +  return errors;
1186 +}
1187 +
1188 +static void
1189 +usage (int status)
1190 +{
1191 +  if (status != 0)
1192 +    fprintf (stderr, _("Try `%s --help' for more information.\n"),
1193 +            program_name);
1194 +  else
1195 +    {
1196 +      printf (_("\
1197 +Usage: %s [OPTION]... CONTEXT FILE...\n\
1198 +  or:  %s [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...\n\
1199 +  or:  %s [OPTION]... --reference=RFILE FILE...\n\
1200 +"),
1201 +       program_name, program_name, program_name);
1202 +      printf (_("\
1203 +Change the security context of each FILE to CONTEXT.\n\
1204 +\n\
1205 +  -c, --changes          like verbose but report only when a change is made\n\
1206 +  -h, --no-dereference   affect symbolic links instead of any referenced file\n\
1207 +                         (available only on systems with lchown system call)\n\
1208 +  -f, --silent, --quiet  suppress most error messages\n\
1209 +      --reference=RFILE  use RFILE's group instead of using a CONTEXT value\n\
1210 +  -u, --user=USER        set user USER in the target security context\n\
1211 +  -r, --role=ROLE        set role ROLE in the target security context\n\
1212 +  -t, --type=TYPE        set type TYPE in the target security context\n\
1213 +  -l, --range=RANGE      set range RANGE in the target security context\n\
1214 +  -R, --recursive        change files and directories recursively\n\
1215 +  -v, --verbose          output a diagnostic for every file processed\n\
1216 +      --help             display this help and exit\n\
1217 +      --version          output version information and exit\n\
1218 +"));
1219 +      close_stdout ();
1220 +    }
1221 +  exit (status);
1222 +}
1223 +
1224 +int
1225 +main (int argc, char **argv)
1226 +{
1227 +  security_context_t ref_context = NULL;
1228 +  int errors = 0;
1229 +  int optc;
1230 +  int component_specified = 0;
1231 +  
1232 +  program_name = argv[0];
1233 +  setlocale (LC_ALL, "");
1234 +  bindtextdomain (PACKAGE, LOCALEDIR);
1235 +  textdomain (PACKAGE);
1236 +
1237 +  recurse = force_silent = 0;
1238 +  
1239 +  while ((optc = getopt_long (argc, argv, "Rcfhvu:r:t:l:", long_options, NULL)) != -1)
1240 +  {
1241 +         switch (optc)
1242 +         {
1243 +         case 0:
1244 +           break;
1245 +         case 'u':
1246 +           specified_user = optarg;
1247 +           component_specified = 1;
1248 +           break;
1249 +         case 'r':
1250 +           specified_role = optarg;
1251 +           component_specified = 1;
1252 +           break;
1253 +         case 't':
1254 +           specified_type = optarg;
1255 +           component_specified = 1;
1256 +           break;
1257 +         case 'l':
1258 +           specified_range = optarg;
1259 +           component_specified = 1;
1260 +           break;
1261 +         case CHAR_MAX + 1:
1262 +                 reference_file = optarg;
1263 +                 break;
1264 +         case 'R':
1265 +                 recurse = 1;
1266 +                 break;
1267 +         case 'c':
1268 +                 verbosity = V_changes_only;
1269 +                 break;
1270 +         case 'f':
1271 +                 force_silent = 1;
1272 +                 break;
1273 +         case 'h':
1274 +                 change_symlinks = 1;
1275 +                 break;
1276 +         case 'v':
1277 +                 verbosity = V_high;
1278 +                 break;
1279 +         default:
1280 +                 usage (1);
1281 +         }
1282 +  }
1283 +
1284 +  if (show_version)
1285 +  {
1286 +     printf ("chcon (%s) %s\n", GNU_PACKAGE, VERSION);
1287 +     close_stdout ();
1288 +     exit (0);
1289 +  }
1290 +
1291 +  if (show_help)
1292 +    usage (0);
1293 +
1294 +  
1295 +  if (reference_file && component_specified)
1296 +    {
1297 +      error (0, 0, _("conflicting security context specifiers given"));
1298 +      usage (1);
1299 +    }
1300 +
1301 +  if (!(((reference_file || component_specified)
1302 +        && (argc - optind > 0))
1303 +       || (argc - optind > 1)))
1304 +    {
1305 +      error (0, 0, _("too few arguments"));
1306 +      usage (1);
1307 +    }
1308 +  
1309 +  if (reference_file)
1310 +    {
1311 +      if (getfilecon (reference_file, &ref_context)<0)
1312 +       error (1, errno, "%s", reference_file);
1313 +      
1314 +      specified_context = ref_context;
1315 +    }
1316 +  else if (!component_specified) {
1317 +    specified_context = argv[optind++];
1318 +  }
1319 +  for (; optind < argc; ++optind)
1320 +     errors |= change_file_context (argv[optind]);
1321 +
1322 +  if (verbosity != V_off)
1323 +    close_stdout ();
1324 +  if (ref_context != NULL)
1325 +    freecon(ref_context);
1326 +  exit (errors);
1327 +}
1328 diff -Nur coreutils-6.4/src/copy.c coreutils-6.4.selinux/src/copy.c
1329 --- coreutils-6.4/src/copy.c    2006-10-22 16:54:15.000000000 +0000
1330 +++ coreutils-6.4.selinux/src/copy.c    2006-10-31 23:39:34.000000000 +0000
1331 @@ -53,6 +53,11 @@
1332  #include "xreadlink.h"
1333  #include "yesno.h"
1334  
1335 +#ifdef WITH_SELINUX
1336 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
1337 +extern int  selinux_enabled;
1338 +#endif
1339 +
1340  #ifndef HAVE_FCHOWN
1341  # define HAVE_FCHOWN false
1342  # define fchown(fd, uid, gid) (-1)
1343 @@ -1473,6 +1478,34 @@
1344       In such cases, set this variable to zero.  */
1345    preserve_metadata = true;
1346  
1347 +#ifdef WITH_SELINUX
1348 +  if (x->preserve_security_context && selinux_enabled)
1349 +    {
1350 +      security_context_t con;
1351 +
1352 +      if (lgetfilecon (src_name, &con) >= 0)
1353 +       {
1354 +         if (setfscreatecon(con) < 0) 
1355 +           {
1356 +             error (0, errno, _("cannot set setfscreatecon %s"), quote (con));
1357 +             if (x->require_preserve) {
1358 +               freecon(con);
1359 +               return 1;
1360 +             }
1361 +           }
1362 +         freecon(con);
1363 +       }
1364 +      else {
1365 +       if ( errno == ENOTSUP ) {
1366 +         error (0, errno, _("warning: security context not preserved %s"), quote (src_name));
1367 +       } else {
1368 +         error (0, errno, _("cannot lgetfilecon %s"), quote (src_name));
1369 +         return 1;
1370 +       }
1371 +      }
1372 +  }
1373 +#endif
1374 +
1375    if (S_ISDIR (src_mode))
1376      {
1377        struct dir_list *dir;
1378 @@ -1544,8 +1577,14 @@
1379         }
1380  
1381        /* Are we crossing a file system boundary?  */
1382 -      if (x->one_file_system && device != 0 && device != src_sb.st_dev)
1383 -       return true;
1384 +
1385 +      if (x->one_file_system && device != 0 && device != src_sb.st_dev) {
1386 +#ifdef WITH_SELINUX
1387 +       if (x->preserve_security_context && selinux_enabled)
1388 +         setfscreatecon(NULL);
1389 +#endif
1390 +       return true;
1391 +      }      
1392  
1393        /* Copy the contents of the directory.  */
1394  
1395 @@ -1689,6 +1728,11 @@
1396             }
1397         }
1398  
1399 +#ifdef WITH_SELINUX
1400 +      if (x->preserve_security_context && selinux_enabled)
1401 +       setfscreatecon(NULL);
1402 +#endif
1403 +
1404        /* There's no need to preserve timestamps or permissions.  */
1405        preserve_metadata = false;
1406  
1407 @@ -1789,6 +1833,11 @@
1408  
1409  un_backup:
1410  
1411 +#ifdef WITH_SELINUX
1412 +  if (x->preserve_security_context && selinux_enabled)
1413 +    setfscreatecon(NULL);
1414 +#endif
1415 +
1416    /* We have failed to create the destination file.
1417       If we've just added a dev/ino entry via the remember_copied
1418       call above (i.e., unless we've just failed to create a hard link),
1419 diff -Nur coreutils-6.4/src/copy.h coreutils-6.4.selinux/src/copy.h
1420 --- coreutils-6.4/src/copy.h    2006-10-22 16:54:15.000000000 +0000
1421 +++ coreutils-6.4.selinux/src/copy.h    2006-10-31 23:39:34.000000000 +0000
1422 @@ -128,6 +128,9 @@
1423    bool preserve_mode;
1424    bool preserve_timestamps;
1425  
1426 +#ifdef WITH_SELINUX
1427 +  bool preserve_security_context;
1428 +#endif
1429    /* Enabled for mv, and for cp by the --preserve=links option.
1430       If true, attempt to preserve in the destination files any
1431       logical hard links between the source files.  If used with cp's
1432 diff -Nur coreutils-6.4/src/cp.c coreutils-6.4.selinux/src/cp.c
1433 --- coreutils-6.4/src/cp.c      2006-10-22 16:54:15.000000000 +0000
1434 +++ coreutils-6.4.selinux/src/cp.c      2006-10-31 23:39:34.000000000 +0000
1435 @@ -51,6 +51,11 @@
1436  
1437  #define AUTHORS "Torbjorn Granlund", "David MacKenzie", "Jim Meyering"
1438  
1439 +#ifdef WITH_SELINUX
1440 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
1441 +int selinux_enabled=0;
1442 +#endif
1443 +
1444  /* Used by do_copy, make_dir_parents_private, and re_protect
1445     to keep a list of leading directories whose protections
1446     need to be fixed after copying. */
1447 @@ -141,6 +146,9 @@
1448    {"target-directory", required_argument, NULL, 't'},
1449    {"update", no_argument, NULL, 'u'},
1450    {"verbose", no_argument, NULL, 'v'},
1451 +#ifdef WITH_SELINUX
1452 +  {"context", required_argument, NULL, 'Z'},
1453 +#endif
1454    {GETOPT_HELP_OPTION_DECL},
1455    {GETOPT_VERSION_OPTION_DECL},
1456    {NULL, 0, NULL, 0}
1457 @@ -194,6 +202,9 @@
1458                                   additional attributes: links, all\n\
1459  "), stdout);
1460        fputs (_("\
1461 +  -c                           same as --preserve=context\n\
1462 +"), stdout);
1463 +      fputs (_("\
1464        --no-preserve=ATTR_LIST  don't preserve the specified attributes\n\
1465        --parents                use full source file name under DIRECTORY\n\
1466  "), stdout);
1467 @@ -219,6 +230,7 @@
1468                                   destination file is missing\n\
1469    -v, --verbose                explain what is being done\n\
1470    -x, --one-file-system        stay on this file system\n\
1471 +  -Z, --context=CONTEXT        set security context of copy to CONTEXT\n\
1472  "), stdout);
1473        fputs (HELP_OPTION_DESCRIPTION, stdout);
1474        fputs (VERSION_OPTION_DESCRIPTION, stdout);
1475 @@ -729,6 +741,10 @@
1476    x->preserve_mode = false;
1477    x->preserve_timestamps = false;
1478  
1479 +#ifdef WITH_SELINUX
1480 +  x->preserve_security_context = false;
1481 +#endif
1482 +
1483    x->require_preserve = false;
1484    x->recursive = false;
1485    x->sparse_mode = SPARSE_AUTO;
1486 @@ -756,18 +772,19 @@
1487        PRESERVE_TIMESTAMPS,
1488        PRESERVE_OWNERSHIP,
1489        PRESERVE_LINK,
1490 +      PRESERVE_CONTEXT,
1491        PRESERVE_ALL
1492      };
1493    static enum File_attribute const preserve_vals[] =
1494      {
1495        PRESERVE_MODE, PRESERVE_TIMESTAMPS,
1496 -      PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_ALL
1497 +      PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_ALL
1498      };
1499    /* Valid arguments to the `--preserve' option. */
1500    static char const* const preserve_args[] =
1501      {
1502        "mode", "timestamps",
1503 -      "ownership", "links", "all", NULL
1504 +      "ownership", "links", "context", "all", NULL
1505      };
1506    ARGMATCH_VERIFY (preserve_args, preserve_vals);
1507  
1508 @@ -803,11 +820,16 @@
1509           x->preserve_links = on_off;
1510           break;
1511  
1512 +       case PRESERVE_CONTEXT:
1513 +         x->preserve_security_context = on_off;
1514 +         break;
1515 +
1516         case PRESERVE_ALL:
1517           x->preserve_mode = on_off;
1518           x->preserve_timestamps = on_off;
1519           x->preserve_ownership = on_off;
1520           x->preserve_links = on_off;
1521 +         x->preserve_security_context = on_off;
1522           break;
1523  
1524         default:
1525 @@ -832,6 +854,10 @@
1526    bool copy_contents = false;
1527    char *target_directory = NULL;
1528    bool no_target_directory = false;
1529 +#ifdef WITH_SELINUX
1530 +  security_context_t scontext = NULL;
1531 +  selinux_enabled= (is_selinux_enabled()>0);
1532 +#endif
1533  
1534    initialize_main (&argc, &argv);
1535    program_name = argv[0];
1536 @@ -847,7 +873,13 @@
1537       we'll actually use backup_suffix_string.  */
1538    backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
1539  
1540 -  while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T",
1541 +  
1542 +  while ((c = getopt_long (argc, argv, 
1543 +#ifdef WITH_SELINUX
1544 +                         "abcdfHilLprst:uvxPRS:TZ:",
1545 +#else
1546 +                         "abdfHilLprst:uvxPRS:T",
1547 +#endif
1548                            long_opts, NULL))
1549          != -1)
1550      {
1551 @@ -938,6 +970,35 @@
1552         case 'R':
1553           x.recursive = true;
1554           break;
1555 +#ifdef WITH_SELINUX
1556 +       case 'c':
1557 +         if ( scontext != NULL ) { 
1558 +             (void) fprintf(stderr, _("%s: cannot force target context <-- %s and preserve it\n"), argv[0], scontext);
1559 +           exit( 1 );
1560 +         }
1561 +         else if (selinux_enabled) 
1562 +           x.preserve_security_context = true;
1563 +         break;
1564 +
1565 +       case 'Z':
1566 +         /* politely decline if we're not on a selinux-enabled kernel. */
1567 +         if( !selinux_enabled ) {
1568 +           fprintf( stderr, _("Warning:  ignoring --context (-Z). It requires a SELinux enabled kernel.\n") );
1569 +           break;
1570 +         }
1571 +         if ( x.preserve_security_context ) {
1572 +           (void) fprintf(stderr, _("%s: cannot force target context to '%s' and preserve it\n"), argv[0], optarg);
1573 +           exit( 1 );
1574 +         }
1575 +         scontext = optarg;
1576 +         /* if there's a security_context given set new path 
1577 +            components to that context, too */
1578 +         if ( setfscreatecon(scontext) < 0 ) {
1579 +           (void) fprintf(stderr, _("cannot set default security context %s"), scontext);
1580 +           exit( 1 );
1581 +         }
1582 +         break;
1583 +#endif
1584  
1585         case REPLY_OPTION: /* Deprecated */
1586           x.interactive = XARGMATCH ("--reply", optarg,
1587 diff -Nur coreutils-6.4/src/id.c coreutils-6.4.selinux/src/id.c
1588 --- coreutils-6.4/src/id.c      2006-10-22 16:54:15.000000000 +0000
1589 +++ coreutils-6.4.selinux/src/id.c      2006-10-31 23:39:34.000000000 +0000
1590 @@ -37,6 +37,20 @@
1591  
1592  int getugroups ();
1593  
1594 +#ifdef WITH_SELINUX
1595 +#include <selinux/selinux.h>
1596 +static void print_context (char* context);
1597 +/* Print the SELinux context */
1598 +static void
1599 +print_context(char *context)
1600 +{
1601 +  printf ("%s", context);
1602 +}
1603 +
1604 +/* If nonzero, output only the SELinux context. -Z */
1605 +static int just_context = 0;
1606 +
1607 +#endif
1608  static void print_user (uid_t uid);
1609  static void print_group (gid_t gid);
1610  static void print_group_list (const char *username);
1611 @@ -55,8 +69,14 @@
1612  /* True unless errors have been encountered.  */
1613  static bool ok = true;
1614  
1615 +/* The SELinux context */
1616 +/* Set `context' to a known invalid value so print_full_info() will *
1617 + * know when `context' has not been set to a meaningful value.      */
1618 +static security_context_t context=NULL;
1619 +
1620  static struct option const longopts[] =
1621  {
1622 +  {"context", no_argument, NULL, 'Z'},
1623    {"group", no_argument, NULL, 'g'},
1624    {"groups", no_argument, NULL, 'G'},
1625    {"name", no_argument, NULL, 'n'},
1626 @@ -80,6 +100,7 @@
1627  Print information for USERNAME, or the current user.\n\
1628  \n\
1629    -a              ignore, for compatibility with other versions\n\
1630 +  -Z, --context   print only the context\n\
1631    -g, --group     print only the effective group ID\n\
1632    -G, --groups    print all group IDs\n\
1633    -n, --name      print a name instead of a number, for -ugG\n\
1634 @@ -101,6 +122,7 @@
1635  main (int argc, char **argv)
1636  {
1637    int optc;
1638 +  int selinux_enabled=(is_selinux_enabled()>0);
1639  
1640    /* If true, output the list of all group IDs. -G */
1641    bool just_group_list = false;
1642 @@ -119,13 +141,23 @@
1643  
1644    atexit (close_stdout);
1645  
1646 -  while ((optc = getopt_long (argc, argv, "agnruG", longopts, NULL)) != -1)
1647 +  while ((optc = getopt_long (argc, argv, "agnruGZ", longopts, NULL)) != -1)
1648      {
1649        switch (optc)
1650         {
1651         case 'a':
1652           /* Ignore -a, for compatibility with SVR4.  */
1653           break;
1654 +#ifdef WITH_SELINUX
1655 +        case 'Z':
1656 +         /* politely decline if we're not on a selinux-enabled kernel. */
1657 +         if( !selinux_enabled ) {
1658 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
1659 +           exit( 1 );
1660 +         }
1661 +          just_context = 1;
1662 +          break;
1663 +#endif
1664         case 'g':
1665           just_group = true;
1666           break;
1667 @@ -148,8 +180,28 @@
1668         }
1669      }
1670  
1671 -  if (just_user + just_group + just_group_list > 1)
1672 -    error (EXIT_FAILURE, 0, _("cannot print only user and only group"));
1673 +#ifdef WITH_SELINUX
1674 +  if (argc - optind == 1)
1675 +    selinux_enabled = 0;
1676 +
1677 +  if( just_context  && !selinux_enabled)
1678 +    error (1, 0, _("\
1679 +cannot display context when SELinux not enabled or when displaying the id\n\
1680 +of a different user"));
1681 +
1682 +  /* If we are on a selinux-enabled kernel, get our context.    *
1683 +   * Otherwise, leave the context variable alone - it has *
1684 +   * been initialized known invalid value; if we see this invalid   *
1685 +   * value later, we will know we are on a non-selinux kernel.         */
1686 +  if( selinux_enabled )
1687 +    {
1688 +      if (getcon(&context))
1689 +        error (1, 0, _("can't get process context"));
1690 +    }
1691 +#endif
1692 +
1693 +  if (just_user + just_group + just_group_list + just_context > 1)
1694 +    error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice"));
1695  
1696    if (just_user + just_group + just_group_list == 0 && (use_real | use_name))
1697      error (EXIT_FAILURE, 0,
1698 @@ -183,6 +235,10 @@
1699      print_group (use_real ? rgid : egid);
1700    else if (just_group_list)
1701      print_group_list (argv[optind]);
1702 +#ifdef WITH_SELINUX
1703 +  else if (just_context)
1704 +    print_context (context);
1705 +#endif
1706    else
1707      print_full_info (argv[optind]);
1708    putchar ('\n');
1709 @@ -385,4 +441,9 @@
1710      free (groups);
1711    }
1712  #endif /* HAVE_GETGROUPS */
1713 +#ifdef WITH_SELINUX
1714 +  if ( context != NULL ) {
1715 +    printf(_(" context=%s"),context);
1716 +  }
1717 +#endif
1718  }
1719 diff -Nur coreutils-6.4/src/install.c coreutils-6.4.selinux/src/install.c
1720 --- coreutils-6.4/src/install.c 2006-10-31 23:38:15.000000000 +0000
1721 +++ coreutils-6.4.selinux/src/install.c 2006-10-31 23:39:34.000000000 +0000
1722 @@ -50,6 +50,11 @@
1723  # include <sys/wait.h>
1724  #endif
1725  
1726 +#ifdef WITH_SELINUX
1727 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
1728 +int selinux_enabled=0;
1729 +#endif
1730 +
1731  #if ! HAVE_ENDGRENT
1732  # define endgrent() ((void) 0)
1733  #endif
1734 @@ -128,12 +133,18 @@
1735  static struct option const long_options[] =
1736  {
1737    {"backup", optional_argument, NULL, 'b'},
1738 +#ifdef WITH_SELINUX
1739 +  {"context", required_argument, NULL, 'Z'},
1740 +#endif
1741    {"directory", no_argument, NULL, 'd'},
1742    {"group", required_argument, NULL, 'g'},
1743    {"mode", required_argument, NULL, 'm'},
1744    {"no-target-directory", no_argument, NULL, 'T'},
1745    {"owner", required_argument, NULL, 'o'},
1746    {"preserve-timestamps", no_argument, NULL, 'p'},
1747 +#ifdef WITH_SELINUX
1748 +  {"preserve_context", no_argument, NULL, 'P'},
1749 +#endif
1750    {"strip", no_argument, NULL, 's'},
1751    {"suffix", required_argument, NULL, 'S'},
1752    {"target-directory", required_argument, NULL, 't'},
1753 @@ -250,6 +261,9 @@
1754  
1755    x->update = false;
1756    x->verbose = false;
1757 +#ifdef WITH_SELINUX
1758 +  x->preserve_security_context = false;
1759 +#endif
1760    x->dest_info = NULL;
1761    x->src_info = NULL;
1762  }
1763 @@ -302,6 +316,11 @@
1764    bool no_target_directory = false;
1765    int n_files;
1766    char **file;
1767 +#ifdef WITH_SELINUX
1768 +  security_context_t scontext = NULL;
1769 + /* set iff kernel has extra selinux system calls */
1770 +  selinux_enabled = (is_selinux_enabled()>0);
1771 +#endif
1772  
1773    initialize_main (&argc, &argv);
1774    program_name = argv[0];
1775 @@ -323,8 +342,13 @@
1776       we'll actually use backup_suffix_string.  */
1777    backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
1778  
1779 -  while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:", long_options,
1780 -                             NULL)) != -1)
1781 +  while ((optc = getopt_long (argc, argv,
1782 +#ifdef WITH_SELINUX
1783 +                                 "bcCsDdg:m:o:pPt:TvS:Z:",
1784 +#else
1785 +                                 "bcCsDdg:m:o:pt:TvS:",
1786 +#endif
1787 +                                 long_options, NULL)) != -1)
1788      {
1789        switch (optc)
1790         {
1791 @@ -388,6 +412,37 @@
1792         case 'T':
1793           no_target_directory = true;
1794           break;
1795 +#ifdef WITH_SELINUX
1796 +       case 'P':
1797 +       /* politely decline if we're not on a selinux-enabled kernel. */
1798 +         if( !selinux_enabled ) {
1799 +           fprintf( stderr, _("Warning:  ignoring --preserve_context (-P) because the kernel is not SELinux-enabled.\n") );
1800 +           break;
1801 +         }
1802 +         if ( scontext!=NULL ) { /* scontext could be NULL because of calloc() failure */
1803 +             (void) fprintf(stderr, _("%s: cannot force target context to '%s' and preserve it\n"), argv[0], scontext);
1804 +           exit( 1 );
1805 +         }
1806 +         x.preserve_security_context = true;
1807 +         break ;
1808 +       case 'Z':
1809 +         /* politely decline if we're not on a selinux-enabled kernel. */
1810 +         if( !selinux_enabled) {
1811 +           fprintf( stderr, _("Warning:  ignoring --context (-Z) because the kernel is not SELinux-enabled.\n") );
1812 +           break;
1813 +         }
1814 +         if ( x.preserve_security_context ) {
1815 +
1816 +                   (void) fprintf(stderr, _("%s: cannot force target context == '%s' and preserve it\n"), argv[0], optarg);
1817 +           exit( 1 );
1818 +         }
1819 +         scontext = optarg;
1820 +         if (setfscreatecon(scontext)) {
1821 +           (void) fprintf(stderr, _("%s: cannot setup default context == '%s'\n"), argv[0], scontext);
1822 +           exit(1);
1823 +         }
1824 +         break;
1825 +#endif
1826         case_GETOPT_HELP_CHAR;
1827         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
1828         default:
1829 @@ -781,6 +836,11 @@
1830    -T, --no-target-directory  treat DEST as a normal file\n\
1831    -v, --verbose       print the name of each directory as it is created\n\
1832  "), stdout);
1833 +      fputs (_("\
1834 +  -P, --preserve_context (SELinux) Preserve security context\n\
1835 +  -Z, --context=CONTEXT  (SELinux) Set security context of files and directories\n\
1836 +"), stdout);
1837 +
1838        fputs (HELP_OPTION_DESCRIPTION, stdout);
1839        fputs (VERSION_OPTION_DESCRIPTION, stdout);
1840        fputs (_("\
1841 diff -Nur coreutils-6.4/src/ls.c coreutils-6.4.selinux/src/ls.c
1842 --- coreutils-6.4/src/ls.c      2006-10-22 16:54:15.000000000 +0000
1843 +++ coreutils-6.4.selinux/src/ls.c      2006-10-31 23:39:34.000000000 +0000
1844 @@ -110,6 +110,17 @@
1845  
1846  #define AUTHORS "Richard Stallman", "David MacKenzie"
1847  
1848 +#ifdef WITH_SELINUX
1849 +#include <selinux/selinux.h>
1850 +int selinux_enabled= 0;
1851 +static int print_scontext       = 0;
1852 +#define check_selinux() if (!selinux_enabled) { \
1853 +           fprintf( stderr, _("Sorry, this option can only be used on a SELinux-enabled kernel.\n") ); \
1854 +           exit( EXIT_FAILURE ); \
1855 +}
1856 +
1857 +#endif
1858 +
1859  #define obstack_chunk_alloc malloc
1860  #define obstack_chunk_free free
1861  
1862 @@ -175,6 +186,10 @@
1863      /* For long listings, true if the file has an access control list.  */
1864      bool have_acl;
1865  #endif
1866 +
1867 +#ifdef WITH_SELINUX
1868 +    security_context_t scontext;
1869 +#endif
1870    };
1871  
1872  #if USE_ACL
1873 @@ -245,6 +260,9 @@
1874  static void sort_files (void);
1875  static void parse_ls_color (void);
1876  void usage (int status);
1877 +#ifdef WITH_SELINUX
1878 +static void print_scontext_format (const struct fileinfo *f);
1879 +#endif
1880  
1881  /* The name this program was run with.  */
1882  char *program_name;
1883 @@ -353,7 +371,10 @@
1884      one_per_line,              /* -1 */
1885      many_per_line,             /* -C */
1886      horizontal,                        /* -x */
1887 -    with_commas                        /* -m */
1888 +#ifdef WITH_SELINUX
1889 +    security_format,           /* -Z */
1890 +#endif
1891 +    with_commas                        /* -m */
1892    };
1893  
1894  static enum format format;
1895 @@ -734,6 +755,11 @@
1896    SHOW_CONTROL_CHARS_OPTION,
1897    SI_OPTION,
1898    SORT_OPTION,
1899 +#ifdef WITH_SELINUX
1900 +  CONTEXT_OPTION,
1901 +  LCONTEXT_OPTION,
1902 +  SCONTEXT_OPTION,
1903 +#endif
1904    TIME_OPTION,
1905    TIME_STYLE_OPTION
1906  };
1907 @@ -780,6 +806,11 @@
1908    {"time-style", required_argument, NULL, TIME_STYLE_OPTION},
1909    {"color", optional_argument, NULL, COLOR_OPTION},
1910    {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
1911 +#ifdef WITH_SELINUX
1912 +  {"context", no_argument, 0, CONTEXT_OPTION},
1913 +  {"lcontext", no_argument, 0, LCONTEXT_OPTION},
1914 +  {"scontext", no_argument, 0, SCONTEXT_OPTION},
1915 +#endif
1916    {"author", no_argument, NULL, AUTHOR_OPTION},
1917    {GETOPT_HELP_OPTION_DECL},
1918    {GETOPT_VERSION_OPTION_DECL},
1919 @@ -789,11 +820,18 @@
1920  static char const *const format_args[] =
1921  {
1922    "verbose", "long", "commas", "horizontal", "across",
1923 -  "vertical", "single-column", NULL
1924 +  "vertical", "single-column", 
1925 +#ifdef WITH_SELINUX
1926 +  "context",
1927 +#endif
1928 +  NULL
1929  };
1930  static enum format const format_types[] =
1931  {
1932    long_format, long_format, with_commas, horizontal, horizontal,
1933 +#ifdef WITH_SELINUX
1934 +  security_format,
1935 +#endif
1936    many_per_line, one_per_line
1937  };
1938  ARGMATCH_VERIFY (format_args, format_types);
1939 @@ -1218,6 +1256,9 @@
1940  
1941    format_needs_stat = sort_type == sort_time || sort_type == sort_size
1942      || format == long_format
1943 +#ifdef WITH_SELINUX
1944 +    || format == security_format || print_scontext
1945 +#endif
1946      || print_block_size;
1947    format_needs_type = (! format_needs_stat
1948                        && (recursive
1949 @@ -1361,6 +1402,11 @@
1950    /* Record whether there is an option specifying sort type.  */
1951    bool sort_type_specified = false;
1952  
1953 +#ifdef WITH_SELINUX
1954 +  /* 1 iff kernel has new selinux system calls */
1955 +  selinux_enabled= (is_selinux_enabled()>0);
1956 +#endif
1957 +
1958    qmark_funny_chars = false;
1959  
1960    /* initialize all switches to default settings */
1961 @@ -1411,6 +1457,9 @@
1962    ignore_mode = IGNORE_DEFAULT;
1963    ignore_patterns = NULL;
1964    hide_patterns = NULL;
1965 +#ifdef WITH_SELINUX
1966 +  print_scontext       = 0;
1967 +#endif
1968  
1969    /* FIXME: put this in a function.  */
1970    {
1971 @@ -1486,7 +1535,7 @@
1972    }
1973  
1974    while ((c = getopt_long (argc, argv,
1975 -                          "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
1976 +                          "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1Z",
1977                            long_options, NULL)) != -1)
1978      {
1979        switch (c)
1980 @@ -1609,6 +1658,13 @@
1981           format = horizontal;
1982           break;
1983  
1984 +#ifdef WITH_SELINUX
1985 +       case 'Z':
1986 +         check_selinux();
1987 +         print_scontext = 1;
1988 +         format = security_format;
1989 +         break;
1990 +#endif
1991         case 'A':
1992           if (ignore_mode == IGNORE_DEFAULT)
1993             ignore_mode = IGNORE_DOT_AND_DOTDOT;
1994 @@ -1789,6 +1845,25 @@
1995  
1996         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
1997  
1998 +#ifdef WITH_SELINUX
1999 +
2000 +       case CONTEXT_OPTION: /* new security format */
2001 +               check_selinux();
2002 +               print_scontext = 1;
2003 +               format = security_format;
2004 +               break;
2005 +       case LCONTEXT_OPTION: /* long format plus security context */
2006 +               check_selinux();
2007 +               print_scontext = 1;
2008 +               format = long_format;
2009 +               break;
2010 +       case SCONTEXT_OPTION: /* short form of new security format */
2011 +               check_selinux();
2012 +               print_scontext = 0;
2013 +               format = security_format;
2014 +               break;
2015 +#endif
2016 +
2017         default:
2018           usage (LS_FAILURE);
2019         }
2020 @@ -2485,6 +2560,12 @@
2021      {
2022        free (files[i].name);
2023        free (files[i].linkname);
2024 +#ifdef WITH_SELINUX
2025 +      if (files[i].scontext) {
2026 +       freecon (files[i].scontext);
2027 +       files[i].scontext=NULL;
2028 +      }
2029 +#endif
2030      }
2031  
2032    files_index = 0;
2033 @@ -2527,6 +2608,9 @@
2034    memset (f, '\0', sizeof *f);
2035    f->stat.st_ino = inode;
2036    f->filetype = type;
2037 +#ifdef WITH_SELINUX
2038 +  f->scontext = NULL;
2039 +#endif
2040  
2041    if (command_line_arg
2042        || format_needs_stat
2043 @@ -2582,7 +2666,12 @@
2044             {
2045               bool need_lstat;
2046               err = stat (absolute_name, &f->stat);
2047 -
2048 +#ifdef WITH_SELINUX
2049 +             if (err>=0) 
2050 +               if (selinux_enabled && (format == security_format || print_scontext))
2051 +                 getfilecon(absolute_name, &f->scontext);
2052 +#endif
2053 +       
2054               if (dereference == DEREF_COMMAND_LINE_ARGUMENTS)
2055                 break;
2056  
2057 @@ -2600,6 +2689,11 @@
2058  
2059         default: /* DEREF_NEVER */
2060           err = lstat (absolute_name, &f->stat);
2061 +#ifdef WITH_SELINUX
2062 +         if (err>=0) 
2063 +           if (selinux_enabled && (format == security_format || print_scontext))
2064 +             lgetfilecon(absolute_name, &f->scontext);
2065 +#endif
2066           break;
2067         }
2068  
2069 @@ -3158,6 +3252,16 @@
2070           DIRED_PUTCHAR ('\n');
2071         }
2072        break;
2073 +
2074 +#ifdef WITH_SELINUX
2075 +    case security_format:
2076 +      for (i = 0; i < files_index; i++)
2077 +      {
2078 +        print_scontext_format (files + i);
2079 +        DIRED_PUTCHAR ('\n');
2080 +      }
2081 +      break;
2082 +#endif
2083      }
2084  }
2085  
2086 @@ -3412,6 +3516,14 @@
2087       The latter is wrong when nlink_width is zero.  */
2088    p += strlen (p);
2089  
2090 +#ifdef WITH_SELINUX
2091 +
2092 +  if ( print_scontext ) {
2093 +    sprintf (p, "%-32s ", f->scontext);
2094 +    p += strlen (p);
2095 +  }
2096 +#endif
2097 +
2098    DIRED_INDENT ();
2099  
2100    if (print_owner | print_group | print_author)
2101 @@ -4347,6 +4459,16 @@
2102    -X                         sort alphabetically by entry extension\n\
2103    -1                         list one file per line\n\
2104  "), stdout);
2105 +#ifdef WITH_SELINUX
2106 +printf(_("\nSELinux options:\n\n\
2107 +      --lcontext             Display security context.   Enable -l. Lines\n\
2108 +                               will probably be too wide for most displays.\n\
2109 +      -Z, --context          Display security context so it fits on most\n\
2110 +                               displays.  Displays only mode, user, group,\n\
2111 +                               security context and file name.\n\
2112 +      --scontext             Display only security context and file name.\n\
2113 +\n\n"));
2114 +#endif
2115        fputs (HELP_OPTION_DESCRIPTION, stdout);
2116        fputs (VERSION_OPTION_DESCRIPTION, stdout);
2117        fputs (_("\n\
2118 @@ -4370,3 +4492,79 @@
2119      }
2120    exit (status);
2121  }
2122 +
2123 +#ifdef WITH_SELINUX
2124 +
2125 +static void
2126 +print_scontext_format (const struct fileinfo *f)
2127 +{
2128 +  char modebuf[12];
2129 +
2130 +  /* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
2131 +     1 10-byte mode string,
2132 +     9 spaces, one following each of these fields, and
2133 +     1 trailing NUL byte.  */
2134 +
2135 +  char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10  + 9 + 1];
2136 +  char *buf = init_bigbuf;
2137 +  size_t bufsize = sizeof (init_bigbuf);
2138 +  size_t s;
2139 +  char *p;
2140 +  const char *fmt;
2141 +  char *user_name;
2142 +  char *group_name;
2143 +  int rv;
2144 +  char *scontext;
2145 +
2146 +  p = buf;
2147 +
2148 +  if ( print_scontext ) { /* zero means terse listing */
2149 +    filemodestring (&f->stat, modebuf);
2150 +    modebuf[10] = (FILE_HAS_ACL (f) ? '+' : ' ');
2151 +    modebuf[11] = '\0';
2152 +
2153 +    /* print mode */
2154 +
2155 +    (void) sprintf (p, "%s ", modebuf);
2156 +    p += strlen (p);
2157 +
2158 +    /* print standard user and group */
2159 +
2160 +    user_name = (numeric_ids ? NULL : getuser (f->stat.st_uid));
2161 +    if (user_name)
2162 +      (void) sprintf (p, "%-8.8s ", user_name);
2163 +    else
2164 +      (void) sprintf (p, "%-8u ", (unsigned int) f->stat.st_uid);
2165 +    p += strlen (p);
2166 +
2167 +    if ( print_group ) {
2168 +      group_name = (numeric_ids ? NULL : getgroup (f->stat.st_gid));
2169 +      if (group_name)
2170 +       (void) sprintf (p, "%-8.8s ", group_name);
2171 +      else
2172 +       (void) sprintf (p, "%-8u ", (unsigned int) f->stat.st_gid);
2173 +      p += strlen (p);
2174 +    }
2175 +  }
2176 +
2177 +  (void) sprintf (p, "%-32s ", f->scontext);
2178 +  p += strlen (p);
2179
2180 +  DIRED_INDENT ();
2181 +  DIRED_FPUTS (buf, stdout, p - buf);
2182 +  print_name_with_quoting (f->name, f->stat.st_mode, f->linkok, f->stat_ok, f->filetype, &dired_obstack);
2183
2184 +  if (f->filetype == symbolic_link) {
2185 +      if (f->linkname) {
2186 +         DIRED_FPUTS_LITERAL (" -> ", stdout);
2187 +         print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1, f->stat_ok, f->filetype, NULL);
2188 +         if (indicator_style != none)
2189 +           print_type_indicator (f->stat_ok, f->linkmode, f->filetype);
2190 +      }
2191 +  }
2192 +  else {
2193 +    if (indicator_style != none)
2194 +      print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
2195 +  }
2196 +}
2197 +#endif
2198 diff -Nur coreutils-6.4/src/mkdir.c coreutils-6.4.selinux/src/mkdir.c
2199 --- coreutils-6.4/src/mkdir.c   2006-10-22 16:54:15.000000000 +0000
2200 +++ coreutils-6.4.selinux/src/mkdir.c   2006-10-31 23:39:34.000000000 +0000
2201 @@ -35,11 +35,18 @@
2202  
2203  #define AUTHORS "David MacKenzie"
2204  
2205 +#ifdef WITH_SELINUX
2206 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
2207 +#endif
2208 +
2209  /* The name this program was run with. */
2210  char *program_name;
2211  
2212  static struct option const longopts[] =
2213  {
2214 +#ifdef WITH_SELINUX
2215 +  {"context", required_argument, NULL, 'Z'},
2216 +#endif
2217    {"mode", required_argument, NULL, 'm'},
2218    {"parents", no_argument, NULL, 'p'},
2219    {"verbose", no_argument, NULL, 'v'},
2220 @@ -61,6 +68,11 @@
2221  Create the DIRECTORY(ies), if they do not already exist.\n\
2222  \n\
2223  "), stdout);
2224 +#ifdef WITH_SELINUX
2225 +      printf (_("\
2226 +  -Z, --context=CONTEXT (SELinux) set security context to CONTEXT\n\
2227 +"));
2228 +#endif
2229        fputs (_("\
2230  Mandatory arguments to long options are mandatory for short options too.\n\
2231  "), stdout);
2232 @@ -154,7 +166,11 @@
2233  
2234    atexit (close_stdout);
2235  
2236 +#ifdef WITH_SELINUX
2237 +  while ((optc = getopt_long (argc, argv, "pm:vZ:", longopts, NULL)) != -1)
2238 +#else
2239    while ((optc = getopt_long (argc, argv, "pm:v", longopts, NULL)) != -1)
2240 +#endif
2241      {
2242        switch (optc)
2243         {
2244 @@ -167,6 +183,19 @@
2245         case 'v': /* --verbose  */
2246           options.created_directory_format = _("created directory %s");
2247           break;
2248 +#ifdef WITH_SELINUX
2249 +       case 'Z':
2250 +         /* politely decline if we're not on a selinux-enabled kernel. */
2251 +         if( !(is_selinux_enabled()>0)) {
2252 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
2253 +           exit( 1 );
2254 +         }
2255 +         if (setfscreatecon(optarg)) {
2256 +           fprintf( stderr, _("Sorry, cannot set default context to %s.\n"), optarg);
2257 +           exit( 1 );
2258 +         }
2259 +         break;
2260 +#endif
2261         case_GETOPT_HELP_CHAR;
2262         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
2263         default:
2264 diff -Nur coreutils-6.4/src/mkfifo.c coreutils-6.4.selinux/src/mkfifo.c
2265 --- coreutils-6.4/src/mkfifo.c  2006-10-22 16:54:15.000000000 +0000
2266 +++ coreutils-6.4.selinux/src/mkfifo.c  2006-10-31 23:39:34.000000000 +0000
2267 @@ -32,11 +32,18 @@
2268  
2269  #define AUTHORS "David MacKenzie"
2270  
2271 +#ifdef WITH_SELINUX
2272 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
2273 +#endif
2274 +
2275  /* The name this program was run with. */
2276  char *program_name;
2277  
2278  static struct option const longopts[] =
2279  {
2280 +#ifdef WITH_SELINUX
2281 +  {"context", required_argument, NULL, 'Z'},
2282 +#endif
2283    {"mode", required_argument, NULL, 'm'},
2284    {GETOPT_HELP_OPTION_DECL},
2285    {GETOPT_VERSION_OPTION_DECL},
2286 @@ -56,6 +63,11 @@
2287  Create named pipes (FIFOs) with the given NAMEs.\n\
2288  \n\
2289  "), stdout);
2290 +#ifdef WITH_SELINUX
2291 +      printf (_("\
2292 +  -Z, --context=CONTEXT   set security context (quoted string)\n\
2293 +"), stdout);
2294 +#endif
2295        fputs (_("\
2296  Mandatory arguments to long options are mandatory for short options too.\n\
2297  "), stdout);
2298 @@ -85,13 +97,31 @@
2299  
2300    atexit (close_stdout);
2301  
2302 -  while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
2303 +  while ((optc = getopt_long (argc, argv, 
2304 +#ifdef WITH_SELINUX
2305 +                                 "m:Z:",
2306 +#else
2307 +                                 "m:",
2308 +#endif                           
2309 +                                 longopts, NULL)) != -1)
2310      {
2311        switch (optc)
2312         {
2313         case 'm':
2314           specified_mode = optarg;
2315           break;
2316 +#ifdef WITH_SELINUX
2317 +       case 'Z':
2318 +         if( !(is_selinux_enabled()>0)) {
2319 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
2320 +           exit( 1 );
2321 +         }
2322 +         if (setfscreatecon(optarg)) {
2323 +           fprintf( stderr, _("Sorry, cannot set default context to %s.\n"), optarg);
2324 +           exit( 1 );
2325 +         }
2326 +         break;
2327 +#endif
2328         case_GETOPT_HELP_CHAR;
2329         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
2330         default:
2331 diff -Nur coreutils-6.4/src/mknod.c coreutils-6.4.selinux/src/mknod.c
2332 --- coreutils-6.4/src/mknod.c   2006-10-22 16:54:15.000000000 +0000
2333 +++ coreutils-6.4.selinux/src/mknod.c   2006-10-31 23:39:34.000000000 +0000
2334 @@ -36,8 +36,15 @@
2335  /* The name this program was run with. */
2336  char *program_name;
2337  
2338 +#ifdef WITH_SELINUX
2339 +#include <selinux/selinux.h>
2340 +#endif
2341 +
2342  static struct option const longopts[] =
2343  {
2344 +#ifdef WITH_SELINUX
2345 +  {"context", required_argument, NULL, 'Z'},
2346 +#endif
2347    {"mode", required_argument, NULL, 'm'},
2348    {GETOPT_HELP_OPTION_DECL},
2349    {GETOPT_VERSION_OPTION_DECL},
2350 @@ -58,6 +65,11 @@
2351  Create the special file NAME of the given TYPE.\n\
2352  \n\
2353  "), stdout);
2354 +#ifdef WITH_SELINUX
2355 +      fputs(_("\
2356 +  -Z, --context=CONTEXT   set security context (quoted string)\n\
2357 +"), stdout);
2358 +#endif
2359        fputs (_("\
2360  Mandatory arguments to long options are mandatory for short options too.\n\
2361  "), stdout);
2362 @@ -101,13 +113,30 @@
2363  
2364    atexit (close_stdout);
2365  
2366 +#ifdef WITH_SELINUX
2367 +  while ((optc = getopt_long (argc, argv, "m:Z:", longopts, NULL)) != -1)
2368 +#else
2369    while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
2370 +#endif
2371      {
2372        switch (optc)
2373         {
2374         case 'm':
2375           specified_mode = optarg;
2376           break;
2377 +#ifdef WITH_SELINUX
2378 +       case 'Z':
2379 +         /* politely decline if we're not on a selinux-enabled kernel. */
2380 +         if( !(is_selinux_enabled()>0)) {
2381 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
2382 +           exit( 1 );
2383 +         }
2384 +         if (setfscreatecon(optarg)) {
2385 +           fprintf( stderr, _("Sorry, cannot set default context to %s.\n"), optarg);
2386 +           exit( 1 );
2387 +         }
2388 +         break;
2389 +#endif
2390         case_GETOPT_HELP_CHAR;
2391         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
2392         default:
2393 diff -Nur coreutils-6.4/src/mv.c coreutils-6.4.selinux/src/mv.c
2394 --- coreutils-6.4/src/mv.c      2006-10-22 16:54:15.000000000 +0000
2395 +++ coreutils-6.4.selinux/src/mv.c      2006-10-31 23:39:34.000000000 +0000
2396 @@ -33,6 +33,11 @@
2397  #include "quote.h"
2398  #include "remove.h"
2399  
2400 +#ifdef WITH_SELINUX
2401 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
2402 +int selinux_enabled=0;
2403 +#endif
2404 +
2405  /* The official name of this program (e.g., no `g' prefix).  */
2406  #define PROGRAM_NAME "mv"
2407  
2408 @@ -125,6 +130,9 @@
2409    x->preserve_links = true;
2410    x->preserve_mode = true;
2411    x->preserve_timestamps = true;
2412 +#ifdef WITH_SELINUX
2413 +  x->preserve_security_context = true;
2414 +#endif
2415    x->require_preserve = false;  /* FIXME: maybe make this an option */
2416    x->recursive = true;
2417    x->sparse_mode = SPARSE_AUTO;  /* FIXME: maybe make this an option */
2418 @@ -356,6 +364,10 @@
2419  
2420    cp_option_init (&x);
2421  
2422 +#ifdef WITH_SELINUX
2423 +  selinux_enabled= (is_selinux_enabled()>0);
2424 +#endif
2425 +
2426    /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
2427       we'll actually use backup_suffix_string.  */
2428    backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
2429 diff -Nur coreutils-6.4/src/runcon.c coreutils-6.4.selinux/src/runcon.c
2430 --- coreutils-6.4/src/runcon.c  1970-01-01 00:00:00.000000000 +0000
2431 +++ coreutils-6.4.selinux/src/runcon.c  2006-10-31 23:39:34.000000000 +0000
2432 @@ -0,0 +1,174 @@
2433 +/*
2434 + * runcon [ context |
2435 + *         ( [ -r role ] [-t type] [ -u user ] [ -l levelrange ] )
2436 + *         command [arg1 [arg2 ...] ]
2437 + *
2438 + * attempt to run the specified command with the specified context.
2439 + * 
2440 + * -r role  : use the current context with the specified role
2441 + * -t type  : use the current context with the specified type
2442 + * -u user  : use the current context with the specified user
2443 + * -l level : use the current context with the specified level range
2444 + *
2445 + * Contexts are interpreted as follows:
2446 + *
2447 + * Number of       MLS
2448 + * components    system?
2449 + *
2450 + *     1            -         type
2451 + *     2            -         role:type
2452 + *     3            Y         role:type:range
2453 + *     3            N         user:role:type
2454 + *     4            Y         user:role:type:range
2455 + *     4            N         error
2456 + */
2457 +
2458 +#include <config.h>
2459 +#include <unistd.h>
2460 +#include <stdio.h>
2461 +#include <getopt.h>
2462 +#include <selinux/context.h>
2463 +#include <selinux/selinux.h>
2464 +#include <errno.h>
2465 +#include "system.h"
2466 +extern int errno;
2467 +
2468 +/* The name the program was run with. */
2469 +char *program_name;
2470 +
2471 +void
2472 +usage(char *str)
2473 +{
2474 +  printf(_("Usage: %s [OPTION]... command [args]\n"
2475 +         "Run a program in a different security context.\n\n"
2476 +         "  context       Complete security context\n"
2477 +         "  -t            type (for same role as parent)\n"
2478 +         "  -u            user identity\n"
2479 +         "  -r            role\n"
2480 +         "  -l            levelrange\n"
2481 +         "    --help      display this help and exit\n"),
2482 +         program_name);
2483 +  exit(1);
2484 +}
2485 +
2486 +int 
2487 +main(int argc,char **argv,char **envp )
2488 +{
2489 +  char *role    = 0;
2490 +  char *range   = 0;
2491 +  char *user    = 0;
2492 +  char *type    = 0;
2493 +  char *context = NULL;
2494 +  security_context_t cur_context = NULL;
2495 +
2496 +  context_t      con;
2497 +
2498 +  program_name = argv[0];
2499 +  setlocale (LC_ALL, "");
2500 +  bindtextdomain (PACKAGE, LOCALEDIR);
2501 +  textdomain (PACKAGE);
2502 +  
2503 +  while (1) {
2504 +    int c;
2505 +    int this_option_optind = optind ? optind : 1;
2506 +    int option_index = 0;
2507 +    static struct option long_options[] = {
2508 +      { "role", 1, 0, 'r' },
2509 +      { "type", 1, 0, 't' },
2510 +      { "user", 1, 0, 'u' },
2511 +      { "range", 1, 0, 'l' },
2512 +      { "help", 0, 0, '?' },
2513 +      { 0, 0, 0, 0 }
2514 +    };
2515 +    c = getopt_long(argc, argv, "s:r:t:u:l:?", long_options, &option_index);
2516 +    if ( c == -1 ) {
2517 +      break;
2518 +    }
2519 +    switch ( c ) {
2520 +    case 'r':
2521 +      if ( role ) {
2522 +       fprintf(stderr,_("multiple roles\n"));
2523 +       exit(1);
2524 +      }
2525 +      role = optarg;
2526 +      break;
2527 +    case 't':
2528 +      if ( type ) {
2529 +       fprintf(stderr,_("multiple types\n"));
2530 +       exit(1);
2531 +      }
2532 +      type = optarg;
2533 +      break;
2534 +    case 'u':
2535 +      if ( user ) {
2536 +       fprintf(stderr,_("multiple users\n"));
2537 +       exit(1);
2538 +      }
2539 +      user = optarg;
2540 +      break;
2541 +    case 'l':
2542 +      if ( range ) {
2543 +       fprintf(stderr,_("multiple levelranges\n"));
2544 +       exit(1);
2545 +      }
2546 +      range = optarg;
2547 +      break;
2548 +    default:
2549 +      fprintf(stderr,_("unrecognised option %c\n"),c);
2550 +    case '?':
2551 +      usage(0);
2552 +      break;
2553 +    }
2554 +  }
2555 +  if ( !(user || role || type || range)) {
2556 +    if ( optind >= argc ) {
2557 +      usage(_("must specify -t, -u, -l, -r, or context"));
2558 +    }
2559 +    context = argv[optind++];
2560 +  }
2561 +  
2562 +  if ( optind >= argc ) {
2563 +    usage(_("no command found"));
2564 +  }
2565 +
2566 +  if ( context ) {
2567 +    con = context_new(context);
2568 +    if (!con) {
2569 +      fprintf(stderr,_("%s is not a valid context\n"), context);
2570 +      exit(1);
2571 +    }
2572 +  }
2573 +  else {
2574 +    getcon(&cur_context);
2575 +    con = context_new(cur_context);
2576 +    if (!con) {
2577 +      fprintf(stderr,_("%s is not a valid context\n"), context);
2578 +      exit(1);
2579 +    }
2580 +    if ( user ) {
2581 +      context_user_set(con,user);
2582 +    }
2583 +    if ( type ) {
2584 +      context_type_set(con,type);
2585 +    }
2586 +    if ( range ) {
2587 +      context_range_set(con,range);
2588 +    }
2589 +    if ( role ) {
2590 +      context_role_set(con,role);
2591 +    }
2592 +  }
2593 +  
2594 +  if (setexeccon(context_str(con))!=0) {
2595 +    fprintf(stderr,_("unable to setup security context %s\n"), context_str(con));
2596 +    exit(1);
2597 +  }
2598 +  if (cur_context!=NULL) 
2599 +    freecon(cur_context);
2600 +
2601 +  if ( execvp(argv[optind],argv+optind) ) {
2602 +    perror("execvp");
2603 +    exit(1);
2604 +  }
2605 +  return 1; /* can't reach this statement.... */
2606 +}
2607 diff -Nur coreutils-6.4/src/stat.c coreutils-6.4.selinux/src/stat.c
2608 --- coreutils-6.4/src/stat.c    2006-10-22 16:54:15.000000000 +0000
2609 +++ coreutils-6.4.selinux/src/stat.c    2006-10-31 23:39:48.000000000 +0000
2610 @@ -55,6 +55,13 @@
2611  # include <fs_info.h>
2612  #endif
2613  
2614 +#ifdef WITH_SELINUX
2615 +#include <selinux/selinux.h>
2616 +#define SECURITY_ID_T security_context_t
2617 +#else
2618 +#define SECURITY_ID_T char *
2619 +#endif
2620 +
2621  #include "system.h"
2622  
2623  #include "error.h"
2624 @@ -161,6 +168,7 @@
2625    {"dereference", no_argument, NULL, 'L'},
2626    {"file-system", no_argument, NULL, 'f'},
2627    {"filesystem", no_argument, NULL, 'f'}, /* obsolete and undocumented alias */
2628 +  {"context", no_argument, 0, 'Z'},
2629    {"format", required_argument, NULL, 'c'},
2630    {"printf", required_argument, NULL, PRINTF_OPTION},
2631    {"terse", no_argument, NULL, 't'},
2632 @@ -397,7 +405,7 @@
2633  /* print statfs info */
2634  static void
2635  print_statfs (char *pformat, size_t prefix_len, char m, char const *filename,
2636 -             void const *data)
2637 +             void const *data, SECURITY_ID_T scontext)
2638  {
2639    STRUCT_STATVFS const *statfsbuf = data;
2640  
2641 @@ -472,7 +480,9 @@
2642      case 'd':
2643        out_int (pformat, prefix_len, statfsbuf->f_ffree);
2644        break;
2645 -
2646 +    case 'C':
2647 +      out_string (pformat, prefix_len, scontext);
2648 +      break;
2649      default:
2650        fputc ('?', stdout);
2651        break;
2652 @@ -482,7 +492,7 @@
2653  /* print stat info */
2654  static void
2655  print_stat (char *pformat, size_t prefix_len, char m,
2656 -           char const *filename, void const *data)
2657 +           char const *filename, void const *data, SECURITY_ID_T scontext)
2658  {
2659    struct stat *statbuf = (struct stat *) data;
2660    struct passwd *pw_ent;
2661 @@ -595,6 +605,9 @@
2662        else
2663         out_uint (pformat, prefix_len, statbuf->st_ctime);
2664        break;
2665 +    case 'C':
2666 +      out_string (pformat, prefix_len, scontext);
2667 +      break;
2668      default:
2669        fputc ('?', stdout);
2670        break;
2671 @@ -641,8 +654,8 @@
2672  
2673  static void
2674  print_it (char const *format, char const *filename,
2675 -         void (*print_func) (char *, size_t, char, char const *, void const *),
2676 -         void const *data)
2677 +         void (*print_func) (char *, size_t, char, char const *, void const *, SECURITY_ID_T),
2678 +         void const *data, SECURITY_ID_T scontext)
2679  {
2680    /* Add 2 to accommodate our conversion of the stat `%s' format string
2681       to the longer printf `%llu' one.  */
2682 @@ -683,7 +696,7 @@
2683                 putchar ('%');
2684                 break;
2685               default:
2686 -               print_func (dest, len + 1, *fmt_char, filename, data);
2687 +               print_func (dest, len + 1, *fmt_char, filename, data, scontext);
2688                 break;
2689               }
2690             break;
2691 @@ -746,9 +759,17 @@
2692  
2693  /* Stat the file system and print what we find.  */
2694  static bool
2695 -do_statfs (char const *filename, bool terse, char const *format)
2696 +do_statfs (char const *filename, bool terse, bool secure, char const *format)
2697  {
2698    STRUCT_STATVFS statfsbuf;
2699 +  SECURITY_ID_T scontext = NULL;
2700 +#ifdef WITH_SELINUX
2701 +  if(secure)
2702 +    if (getfilecon(filename,&scontext)<0) {
2703 +      perror (filename);
2704 +      return false;
2705 +    }
2706 +#endif
2707  
2708    if (STATFS (filename, &statfsbuf) != 0)
2709      {
2710 @@ -759,25 +780,45 @@
2711  
2712    if (format == NULL)
2713      {
2714 -      format = (terse
2715 -               ? "%n %i %l %t %s %S %b %f %a %c %d\n"
2716 -               : "  File: \"%n\"\n"
2717 -               "    ID: %-8i Namelen: %-7l Type: %T\n"
2718 -               "Block size: %-10s Fundamental block size: %S\n"
2719 -               "Blocks: Total: %-10b Free: %-10f Available: %a\n"
2720 -               "Inodes: Total: %-10c Free: %d\n");
2721 -    }
2722 +      if (terse) {
2723 +        if(secure)
2724 +         format = "%n %i %l %t %s %S %b %f %a %c %d %C\n";
2725 +       else
2726 +         format = "%n %i %l %t %s %S %b %f %a %c %d\n";
2727 +       } 
2728 +      else 
2729 +       {
2730 +       if(secure)
2731 +         format = "  File: \"%n\"\n"
2732 +           "    ID: %-8i Namelen: %-7l Type: %T\n"
2733 +           "Block size: %-10s Fundamental block size: %S\n"
2734 +           "Blocks: Total: %-10b Free: %-10f Available: %a\n"
2735 +           "Inodes: Total: %-10c Free: %d\n"
2736 +           "   S_Context: %C\n";
2737 +       else    
2738 +         format = "  File: \"%n\"\n"
2739 +           "    ID: %-8i Namelen: %-7l Type: %T\n"
2740 +           "Block size: %-10s Fundamental block size: %S\n"
2741 +           "Blocks: Total: %-10b Free: %-10f Available: %a\n"
2742 +           "Inodes: Total: %-10c Free: %d\n";
2743 +       }       
2744 +    }
2745 +  print_it (format, filename, print_statfs, &statfsbuf, scontext);
2746 +#ifdef WITH_SELINUX
2747 +  if (scontext != NULL)
2748 +    freecon(scontext);
2749 +#endif
2750  
2751 -  print_it (format, filename, print_statfs, &statfsbuf);
2752    return true;
2753  }
2754  
2755  /* stat the file and print what we find */
2756  static bool
2757 -do_stat (char const *filename, bool follow_links, bool terse,
2758 +do_stat (char const *filename, bool follow_links, bool terse, bool secure,
2759          char const *format)
2760  {
2761    struct stat statbuf;
2762 +  SECURITY_ID_T scontext = NULL;
2763  
2764    if ((follow_links ? stat : lstat) (filename, &statbuf) != 0)
2765      {
2766 @@ -785,11 +826,29 @@
2767        return false;
2768      }
2769  
2770 +#ifdef WITH_SELINUX
2771 +  if(secure) {
2772 +    int i;
2773 +    if (follow_links) 
2774 +      i=lgetfilecon(filename, &scontext);
2775 +    else
2776 +      i=getfilecon(filename, &scontext);
2777 +    if (i == -1)
2778 +      {
2779 +       perror (filename);
2780 +       return false;
2781 +      }
2782 +  }
2783 +#endif
2784 +
2785    if (format == NULL)
2786      {
2787        if (terse)
2788         {
2789 -         format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n";
2790 +          if (secure)
2791 +            format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n";
2792 +          else
2793 +            format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n";
2794         }
2795        else
2796         {
2797 @@ -797,7 +856,17 @@
2798              implemented.  */
2799           if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode))
2800             {
2801 -             format =
2802 +               if (secure)
2803 +                               format =
2804 +                         "  File: %N\n"
2805 +                         "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2806 +                         "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
2807 +                         " Device type: %t,%T\n"
2808 +                         "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
2809 +                         "   S_Context: %C\n"
2810 +                         "Access: %x\n" "Modify: %y\n" "Change: %z\n";
2811 +               else
2812 +              format =
2813                 "  File: %N\n"
2814                 "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2815                 "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
2816 @@ -807,6 +876,15 @@
2817             }
2818           else
2819             {
2820 +               if (secure)
2821 +                 format =
2822 +                   "  File: %N\n"
2823 +                   "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2824 +                   "Device: %Dh/%dd\tInode: %-10i  Links: %-5h\n"
2825 +                   "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
2826 +                   "S_Context: %C\n"
2827 +                   "Access: %x\n" "Modify: %y\n" "Change: %z\n";
2828 +                else
2829               format =
2830                 "  File: %N\n"
2831                 "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2832 @@ -816,7 +894,11 @@
2833             }
2834         }
2835      }
2836 -  print_it (format, filename, print_stat, &statbuf);
2837 +  print_it (format, filename, print_stat, &statbuf, scontext);
2838 +#ifdef WITH_SELINUX
2839 +  if (scontext) 
2840 +    freecon(scontext);
2841 +#endif
2842    return true;
2843  }
2844  
2845 @@ -841,6 +923,7 @@
2846        --printf=FORMAT   like --format, but interpret backslash escapes,\n\
2847                            and do not output a mandatory trailing newline.\n\
2848                            If you want a newline, include \\n in FORMAT.\n\
2849 +  -Z, --context         print the security context\n\
2850    -t, --terse           print the information in terse form\n\
2851  "), stdout);
2852        fputs (HELP_OPTION_DESCRIPTION, stdout);
2853 @@ -892,6 +975,7 @@
2854    %c   Total file nodes in file system\n\
2855    %d   Free file nodes in file system\n\
2856    %f   Free blocks in file system\n\
2857 +  %C   Security context in SELinux\n\
2858  "), stdout);
2859        fputs (_("\
2860    %i   File System ID in hex\n\
2861 @@ -915,6 +999,7 @@
2862    int i;
2863    bool follow_links = false;
2864    bool fs = false;
2865 +  bool secure = false;
2866    bool terse = false;
2867    char *format = NULL;
2868    bool ok = true;
2869 @@ -927,7 +1012,7 @@
2870  
2871    atexit (close_stdout);
2872  
2873 -  while ((c = getopt_long (argc, argv, "c:fLt", long_options, NULL)) != -1)
2874 +  while ((c = getopt_long (argc, argv, "c:fLtZ", long_options, NULL)) != -1)
2875      {
2876        switch (c)
2877         {
2878 @@ -946,6 +1031,14 @@
2879         case 'L':
2880           follow_links = true;
2881           break;
2882 +       case 'Z':
2883 +         if((is_selinux_enabled()>0))
2884 +           secure = true;
2885 +         else {
2886 +           error (0, 0, _("Kernel is not SELinux enabled"));
2887 +           usage (EXIT_FAILURE);
2888 +         }
2889 +         break;
2890  
2891         case 'f':
2892           fs = true;
2893 @@ -972,8 +1065,8 @@
2894  
2895    for (i = optind; i < argc; i++)
2896      ok &= (fs
2897 -          ? do_statfs (argv[i], terse, format)
2898 -          : do_stat (argv[i], follow_links, terse, format));
2899 +          ? do_statfs (argv[i], terse, secure, format)
2900 +          : do_stat (argv[i], follow_links, terse, secure, format));
2901  
2902    exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
2903  }
2904 diff -Nur coreutils-6.4/tests/help-version coreutils-6.4.selinux/tests/help-version
2905 --- coreutils-6.4/tests/help-version    2006-10-22 16:54:15.000000000 +0000
2906 +++ coreutils-6.4.selinux/tests/help-version    2006-10-31 23:39:34.000000000 +0000
2907 @@ -70,6 +70,8 @@
2908  
2909      # Skip `test'; it doesn't accept --help or --version.
2910      test $i = test && continue;
2911 +    test $i = chcon && continue;
2912 +    test $i = runcon && continue;
2913  
2914      # false fails even when invoked with --help or --version.
2915      if test $i = false; then
2916 @@ -190,7 +192,7 @@
2917  
2918  for i in $all_programs; do
2919    # Skip these.
2920 -  case $i in chroot|stty|tty|false) continue;; esac
2921 +  case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
2922  
2923    rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
2924    echo > $tmp_in
This page took 0.295996 seconds and 3 git commands to generate.