]> git.pld-linux.org Git - packages/coreutils.git/blob - coreutils-selinux.patch
- fix security_format
[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 runuser seq sha1sum sha224sum sha256sum
14 +  printenv printf ptx pwd readlink rm rmdir runuser 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:611
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:1553
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:1030
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:692 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:684
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,6 +1577,10 @@
1379         {
1380           /* Here, we are crossing a file system boundary and cp's -x option
1381              is in effect: so don't copy the contents of this directory. */
1382 +#ifdef WITH_SELINUX
1383 +       if (x->preserve_security_context && selinux_enabled)
1384 +         setfscreatecon(NULL);
1385 +#endif
1386         }
1387        else
1388         {
1389 @@ -1689,6 +1728,11 @@
1390             }
1391         }
1392  
1393 +#ifdef WITH_SELINUX
1394 +      if (x->preserve_security_context && selinux_enabled)
1395 +       setfscreatecon(NULL);
1396 +#endif
1397 +
1398        /* There's no need to preserve timestamps or permissions.  */
1399        preserve_metadata = false;
1400  
1401 @@ -1789,6 +1833,11 @@
1402  
1403  un_backup:
1404  
1405 +#ifdef WITH_SELINUX
1406 +  if (x->preserve_security_context && selinux_enabled)
1407 +    setfscreatecon(NULL);
1408 +#endif
1409 +
1410    /* We have failed to create the destination file.
1411       If we've just added a dev/ino entry via the remember_copied
1412       call above (i.e., unless we've just failed to create a hard link),
1413 diff -Nur coreutils-6.4/src/copy.h coreutils-6.4.selinux/src/copy.h
1414 --- coreutils-6.4/src/copy.h    2006-10-22 16:54:15.000000000 +0000
1415 +++ coreutils-6.4.selinux/src/copy.h    2006-10-31 23:39:34.000000000 +0000
1416 @@ -128,6 +128,9 @@
1417    bool preserve_mode;
1418    bool preserve_timestamps;
1419  
1420 +#ifdef WITH_SELINUX
1421 +  bool preserve_security_context;
1422 +#endif
1423    /* Enabled for mv, and for cp by the --preserve=links option.
1424       If true, attempt to preserve in the destination files any
1425       logical hard links between the source files.  If used with cp's
1426 diff -Nur coreutils-6.4/src/cp.c coreutils-6.4.selinux/src/cp.c
1427 --- coreutils-6.4/src/cp.c      2006-10-22 16:54:15.000000000 +0000
1428 +++ coreutils-6.4.selinux/src/cp.c      2006-10-31 23:39:34.000000000 +0000
1429 @@ -51,6 +51,11 @@
1430  
1431  #define AUTHORS "Torbjorn Granlund", "David MacKenzie", "Jim Meyering"
1432  
1433 +#ifdef WITH_SELINUX
1434 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
1435 +int selinux_enabled=0;
1436 +#endif
1437 +
1438  /* Used by do_copy, make_dir_parents_private, and re_protect
1439     to keep a list of leading directories whose protections
1440     need to be fixed after copying. */
1441 @@ -141,6 +146,9 @@
1442    {"target-directory", required_argument, NULL, 't'},
1443    {"update", no_argument, NULL, 'u'},
1444    {"verbose", no_argument, NULL, 'v'},
1445 +#ifdef WITH_SELINUX
1446 +  {"context", required_argument, NULL, 'Z'},
1447 +#endif
1448    {GETOPT_HELP_OPTION_DECL},
1449    {GETOPT_VERSION_OPTION_DECL},
1450    {NULL, 0, NULL, 0}
1451 @@ -194,6 +202,9 @@
1452                                   additional attributes: links, all\n\
1453  "), stdout);
1454        fputs (_("\
1455 +  -c                           same as --preserve=context\n\
1456 +"), stdout);
1457 +      fputs (_("\
1458        --no-preserve=ATTR_LIST  don't preserve the specified attributes\n\
1459        --parents                use full source file name under DIRECTORY\n\
1460  "), stdout);
1461 @@ -219,6 +230,7 @@
1462                                   destination file is missing\n\
1463    -v, --verbose                explain what is being done\n\
1464    -x, --one-file-system        stay on this file system\n\
1465 +  -Z, --context=CONTEXT        set security context of copy to CONTEXT\n\
1466  "), stdout);
1467        fputs (HELP_OPTION_DESCRIPTION, stdout);
1468        fputs (VERSION_OPTION_DESCRIPTION, stdout);
1469 @@ -729,6 +741,10 @@
1470    x->preserve_mode = false;
1471    x->preserve_timestamps = false;
1472  
1473 +#ifdef WITH_SELINUX
1474 +  x->preserve_security_context = false;
1475 +#endif
1476 +
1477    x->require_preserve = false;
1478    x->recursive = false;
1479    x->sparse_mode = SPARSE_AUTO;
1480 @@ -756,18 +772,19 @@
1481        PRESERVE_TIMESTAMPS,
1482        PRESERVE_OWNERSHIP,
1483        PRESERVE_LINK,
1484 +      PRESERVE_CONTEXT,
1485        PRESERVE_ALL
1486      };
1487    static enum File_attribute const preserve_vals[] =
1488      {
1489        PRESERVE_MODE, PRESERVE_TIMESTAMPS,
1490 -      PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_ALL
1491 +      PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_ALL
1492      };
1493    /* Valid arguments to the `--preserve' option. */
1494    static char const* const preserve_args[] =
1495      {
1496        "mode", "timestamps",
1497 -      "ownership", "links", "all", NULL
1498 +      "ownership", "links", "context", "all", NULL
1499      };
1500    ARGMATCH_VERIFY (preserve_args, preserve_vals);
1501  
1502 @@ -803,11 +820,16 @@
1503           x->preserve_links = on_off;
1504           break;
1505  
1506 +       case PRESERVE_CONTEXT:
1507 +         x->preserve_security_context = on_off;
1508 +         break;
1509 +
1510         case PRESERVE_ALL:
1511           x->preserve_mode = on_off;
1512           x->preserve_timestamps = on_off;
1513           x->preserve_ownership = on_off;
1514           x->preserve_links = on_off;
1515 +         x->preserve_security_context = on_off;
1516           break;
1517  
1518         default:
1519 @@ -832,6 +854,10 @@
1520    bool copy_contents = false;
1521    char *target_directory = NULL;
1522    bool no_target_directory = false;
1523 +#ifdef WITH_SELINUX
1524 +  security_context_t scontext = NULL;
1525 +  selinux_enabled= (is_selinux_enabled()>0);
1526 +#endif
1527  
1528    initialize_main (&argc, &argv);
1529    program_name = argv[0];
1530 @@ -847,7 +873,13 @@
1531       we'll actually use backup_suffix_string.  */
1532    backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
1533  
1534 -  while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T",
1535 +  
1536 +  while ((c = getopt_long (argc, argv, 
1537 +#ifdef WITH_SELINUX
1538 +                         "abcdfHilLprst:uvxPRS:TZ:",
1539 +#else
1540 +                         "abdfHilLprst:uvxPRS:T",
1541 +#endif
1542                            long_opts, NULL))
1543          != -1)
1544      {
1545 @@ -938,6 +970,35 @@
1546         case 'R':
1547           x.recursive = true;
1548           break;
1549 +#ifdef WITH_SELINUX
1550 +       case 'c':
1551 +         if ( scontext != NULL ) { 
1552 +             (void) fprintf(stderr, _("%s: cannot force target context <-- %s and preserve it\n"), argv[0], scontext);
1553 +           exit( 1 );
1554 +         }
1555 +         else if (selinux_enabled) 
1556 +           x.preserve_security_context = true;
1557 +         break;
1558 +
1559 +       case 'Z':
1560 +         /* politely decline if we're not on a selinux-enabled kernel. */
1561 +         if( !selinux_enabled ) {
1562 +           fprintf( stderr, _("Warning:  ignoring --context (-Z). It requires a SELinux enabled kernel.\n") );
1563 +           break;
1564 +         }
1565 +         if ( x.preserve_security_context ) {
1566 +           (void) fprintf(stderr, _("%s: cannot force target context to '%s' and preserve it\n"), argv[0], optarg);
1567 +           exit( 1 );
1568 +         }
1569 +         scontext = optarg;
1570 +         /* if there's a security_context given set new path 
1571 +            components to that context, too */
1572 +         if ( setfscreatecon(scontext) < 0 ) {
1573 +           (void) fprintf(stderr, _("cannot set default security context %s"), scontext);
1574 +           exit( 1 );
1575 +         }
1576 +         break;
1577 +#endif
1578  
1579         case REPLY_OPTION: /* Deprecated */
1580           x.interactive = XARGMATCH ("--reply", optarg,
1581 diff -Nur coreutils-6.4/src/id.c coreutils-6.4.selinux/src/id.c
1582 --- coreutils-6.4/src/id.c      2006-10-22 16:54:15.000000000 +0000
1583 +++ coreutils-6.4.selinux/src/id.c      2006-10-31 23:39:34.000000000 +0000
1584 @@ -37,6 +37,20 @@
1585  
1586  int getugroups ();
1587  
1588 +#ifdef WITH_SELINUX
1589 +#include <selinux/selinux.h>
1590 +static void print_context (char* context);
1591 +/* Print the SELinux context */
1592 +static void
1593 +print_context(char *context)
1594 +{
1595 +  printf ("%s", context);
1596 +}
1597 +
1598 +/* If nonzero, output only the SELinux context. -Z */
1599 +static int just_context = 0;
1600 +
1601 +#endif
1602  static void print_user (uid_t uid);
1603  static void print_group (gid_t gid);
1604  static void print_group_list (const char *username);
1605 @@ -55,8 +69,14 @@
1606  /* True unless errors have been encountered.  */
1607  static bool ok = true;
1608  
1609 +/* The SELinux context */
1610 +/* Set `context' to a known invalid value so print_full_info() will *
1611 + * know when `context' has not been set to a meaningful value.      */
1612 +static security_context_t context=NULL;
1613 +
1614  static struct option const longopts[] =
1615  {
1616 +  {"context", no_argument, NULL, 'Z'},
1617    {"group", no_argument, NULL, 'g'},
1618    {"groups", no_argument, NULL, 'G'},
1619    {"name", no_argument, NULL, 'n'},
1620 @@ -80,6 +100,7 @@
1621  Print information for USERNAME, or the current user.\n\
1622  \n\
1623    -a              ignore, for compatibility with other versions\n\
1624 +  -Z, --context   print only the context\n\
1625    -g, --group     print only the effective group ID\n\
1626    -G, --groups    print all group IDs\n\
1627    -n, --name      print a name instead of a number, for -ugG\n\
1628 @@ -101,6 +122,7 @@
1629  main (int argc, char **argv)
1630  {
1631    int optc;
1632 +  int selinux_enabled=(is_selinux_enabled()>0);
1633  
1634    /* If true, output the list of all group IDs. -G */
1635    bool just_group_list = false;
1636 @@ -119,13 +141,23 @@
1637  
1638    atexit (close_stdout);
1639  
1640 -  while ((optc = getopt_long (argc, argv, "agnruG", longopts, NULL)) != -1)
1641 +  while ((optc = getopt_long (argc, argv, "agnruGZ", longopts, NULL)) != -1)
1642      {
1643        switch (optc)
1644         {
1645         case 'a':
1646           /* Ignore -a, for compatibility with SVR4.  */
1647           break;
1648 +#ifdef WITH_SELINUX
1649 +        case 'Z':
1650 +         /* politely decline if we're not on a selinux-enabled kernel. */
1651 +         if( !selinux_enabled ) {
1652 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
1653 +           exit( 1 );
1654 +         }
1655 +          just_context = 1;
1656 +          break;
1657 +#endif
1658         case 'g':
1659           just_group = true;
1660           break;
1661 @@ -148,8 +180,28 @@
1662         }
1663      }
1664  
1665 -  if (just_user + just_group + just_group_list > 1)
1666 -    error (EXIT_FAILURE, 0, _("cannot print only user and only group"));
1667 +#ifdef WITH_SELINUX
1668 +  if (argc - optind == 1)
1669 +    selinux_enabled = 0;
1670 +
1671 +  if( just_context  && !selinux_enabled)
1672 +    error (1, 0, _("\
1673 +cannot display context when SELinux not enabled or when displaying the id\n\
1674 +of a different user"));
1675 +
1676 +  /* If we are on a selinux-enabled kernel, get our context.    *
1677 +   * Otherwise, leave the context variable alone - it has *
1678 +   * been initialized known invalid value; if we see this invalid   *
1679 +   * value later, we will know we are on a non-selinux kernel.         */
1680 +  if( selinux_enabled )
1681 +    {
1682 +      if (getcon(&context))
1683 +        error (1, 0, _("can't get process context"));
1684 +    }
1685 +#endif
1686 +
1687 +  if (just_user + just_group + just_group_list + just_context > 1)
1688 +    error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice"));
1689  
1690    if (just_user + just_group + just_group_list == 0 && (use_real | use_name))
1691      error (EXIT_FAILURE, 0,
1692 @@ -183,6 +235,10 @@
1693      print_group (use_real ? rgid : egid);
1694    else if (just_group_list)
1695      print_group_list (argv[optind]);
1696 +#ifdef WITH_SELINUX
1697 +  else if (just_context)
1698 +    print_context (context);
1699 +#endif
1700    else
1701      print_full_info (argv[optind]);
1702    putchar ('\n');
1703 @@ -385,4 +441,9 @@
1704      free (groups);
1705    }
1706  #endif /* HAVE_GETGROUPS */
1707 +#ifdef WITH_SELINUX
1708 +  if ( context != NULL ) {
1709 +    printf(_(" context=%s"),context);
1710 +  }
1711 +#endif
1712  }
1713 diff -Nur coreutils-6.4/src/install.c coreutils-6.4.selinux/src/install.c
1714 --- coreutils-6.4/src/install.c 2006-10-31 23:38:15.000000000 +0000
1715 +++ coreutils-6.4.selinux/src/install.c 2006-10-31 23:39:34.000000000 +0000
1716 @@ -50,6 +50,11 @@
1717  # include <sys/wait.h>
1718  #endif
1719  
1720 +#ifdef WITH_SELINUX
1721 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
1722 +int selinux_enabled=0;
1723 +#endif
1724 +
1725  #if ! HAVE_ENDGRENT
1726  # define endgrent() ((void) 0)
1727  #endif
1728 @@ -128,12 +133,18 @@
1729  static struct option const long_options[] =
1730  {
1731    {"backup", optional_argument, NULL, 'b'},
1732 +#ifdef WITH_SELINUX
1733 +  {"context", required_argument, NULL, 'Z'},
1734 +#endif
1735    {"directory", no_argument, NULL, 'd'},
1736    {"group", required_argument, NULL, 'g'},
1737    {"mode", required_argument, NULL, 'm'},
1738    {"no-target-directory", no_argument, NULL, 'T'},
1739    {"owner", required_argument, NULL, 'o'},
1740    {"preserve-timestamps", no_argument, NULL, 'p'},
1741 +#ifdef WITH_SELINUX
1742 +  {"preserve_context", no_argument, NULL, 'P'},
1743 +#endif
1744    {"strip", no_argument, NULL, 's'},
1745    {"suffix", required_argument, NULL, 'S'},
1746    {"target-directory", required_argument, NULL, 't'},
1747 @@ -250,6 +261,9 @@
1748  
1749    x->update = false;
1750    x->verbose = false;
1751 +#ifdef WITH_SELINUX
1752 +  x->preserve_security_context = false;
1753 +#endif
1754    x->dest_info = NULL;
1755    x->src_info = NULL;
1756  }
1757 @@ -302,6 +316,11 @@
1758    bool no_target_directory = false;
1759    int n_files;
1760    char **file;
1761 +#ifdef WITH_SELINUX
1762 +  security_context_t scontext = NULL;
1763 + /* set iff kernel has extra selinux system calls */
1764 +  selinux_enabled = (is_selinux_enabled()>0);
1765 +#endif
1766  
1767    initialize_main (&argc, &argv);
1768    program_name = argv[0];
1769 @@ -323,8 +342,13 @@
1770       we'll actually use backup_suffix_string.  */
1771    backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
1772  
1773 -  while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:", long_options,
1774 -                             NULL)) != -1)
1775 +  while ((optc = getopt_long (argc, argv,
1776 +#ifdef WITH_SELINUX
1777 +                                 "bcCsDdg:m:o:pPt:TvS:Z:",
1778 +#else
1779 +                                 "bcCsDdg:m:o:pt:TvS:",
1780 +#endif
1781 +                                 long_options, NULL)) != -1)
1782      {
1783        switch (optc)
1784         {
1785 @@ -388,6 +412,37 @@
1786         case 'T':
1787           no_target_directory = true;
1788           break;
1789 +#ifdef WITH_SELINUX
1790 +       case 'P':
1791 +       /* politely decline if we're not on a selinux-enabled kernel. */
1792 +         if( !selinux_enabled ) {
1793 +           fprintf( stderr, _("Warning:  ignoring --preserve_context (-P) because the kernel is not SELinux-enabled.\n") );
1794 +           break;
1795 +         }
1796 +         if ( scontext!=NULL ) { /* scontext could be NULL because of calloc() failure */
1797 +             (void) fprintf(stderr, _("%s: cannot force target context to '%s' and preserve it\n"), argv[0], scontext);
1798 +           exit( 1 );
1799 +         }
1800 +         x.preserve_security_context = true;
1801 +         break ;
1802 +       case 'Z':
1803 +         /* politely decline if we're not on a selinux-enabled kernel. */
1804 +         if( !selinux_enabled) {
1805 +           fprintf( stderr, _("Warning:  ignoring --context (-Z) because the kernel is not SELinux-enabled.\n") );
1806 +           break;
1807 +         }
1808 +         if ( x.preserve_security_context ) {
1809 +
1810 +                   (void) fprintf(stderr, _("%s: cannot force target context == '%s' and preserve it\n"), argv[0], optarg);
1811 +           exit( 1 );
1812 +         }
1813 +         scontext = optarg;
1814 +         if (setfscreatecon(scontext)) {
1815 +           (void) fprintf(stderr, _("%s: cannot setup default context == '%s'\n"), argv[0], scontext);
1816 +           exit(1);
1817 +         }
1818 +         break;
1819 +#endif
1820         case_GETOPT_HELP_CHAR;
1821         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
1822         default:
1823 @@ -781,6 +836,11 @@
1824    -T, --no-target-directory  treat DEST as a normal file\n\
1825    -v, --verbose       print the name of each directory as it is created\n\
1826  "), stdout);
1827 +      fputs (_("\
1828 +  -P, --preserve_context (SELinux) Preserve security context\n\
1829 +  -Z, --context=CONTEXT  (SELinux) Set security context of files and directories\n\
1830 +"), stdout);
1831 +
1832        fputs (HELP_OPTION_DESCRIPTION, stdout);
1833        fputs (VERSION_OPTION_DESCRIPTION, stdout);
1834        fputs (_("\
1835 diff -Nur coreutils-6.4/src/ls.c coreutils-6.4.selinux/src/ls.c
1836 --- coreutils-6.4/src/ls.c      2006-10-22 16:54:15.000000000 +0000
1837 +++ coreutils-6.4.selinux/src/ls.c      2006-10-31 23:39:34.000000000 +0000
1838 @@ -110,6 +110,17 @@
1839  
1840  #define AUTHORS "Richard Stallman", "David MacKenzie"
1841  
1842 +#ifdef WITH_SELINUX
1843 +#include <selinux/selinux.h>
1844 +int selinux_enabled= 0;
1845 +static int print_scontext       = 0;
1846 +#define check_selinux() if (!selinux_enabled) { \
1847 +           fprintf( stderr, _("Sorry, this option can only be used on a SELinux-enabled kernel.\n") ); \
1848 +           exit( EXIT_FAILURE ); \
1849 +}
1850 +
1851 +#endif
1852 +
1853  #define obstack_chunk_alloc malloc
1854  #define obstack_chunk_free free
1855  
1856 @@ -175,6 +186,10 @@
1857      /* For long listings, true if the file has an access control list.  */
1858      bool have_acl;
1859  #endif
1860 +
1861 +#ifdef WITH_SELINUX
1862 +    security_context_t scontext;
1863 +#endif
1864    };
1865  
1866  #if USE_ACL
1867 @@ -245,6 +260,9 @@
1868  static void sort_files (void);
1869  static void parse_ls_color (void);
1870  void usage (int status);
1871 +#ifdef WITH_SELINUX
1872 +static void print_scontext_format (const struct fileinfo *f);
1873 +#endif
1874  
1875  /* The name this program was run with.  */
1876  char *program_name;
1877 @@ -353,7 +371,10 @@
1878      one_per_line,              /* -1 */
1879      many_per_line,             /* -C */
1880      horizontal,                        /* -x */
1881 -    with_commas                        /* -m */
1882 +#ifdef WITH_SELINUX
1883 +    security_format,           /* -Z */
1884 +#endif
1885 +    with_commas                        /* -m */
1886    };
1887  
1888  static enum format format;
1889 @@ -734,6 +755,11 @@
1890    SHOW_CONTROL_CHARS_OPTION,
1891    SI_OPTION,
1892    SORT_OPTION,
1893 +#ifdef WITH_SELINUX
1894 +  CONTEXT_OPTION,
1895 +  LCONTEXT_OPTION,
1896 +  SCONTEXT_OPTION,
1897 +#endif
1898    TIME_OPTION,
1899    TIME_STYLE_OPTION
1900  };
1901 @@ -780,6 +806,11 @@
1902    {"time-style", required_argument, NULL, TIME_STYLE_OPTION},
1903    {"color", optional_argument, NULL, COLOR_OPTION},
1904    {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
1905 +#ifdef WITH_SELINUX
1906 +  {"context", no_argument, 0, CONTEXT_OPTION},
1907 +  {"lcontext", no_argument, 0, LCONTEXT_OPTION},
1908 +  {"scontext", no_argument, 0, SCONTEXT_OPTION},
1909 +#endif
1910    {"author", no_argument, NULL, AUTHOR_OPTION},
1911    {GETOPT_HELP_OPTION_DECL},
1912    {GETOPT_VERSION_OPTION_DECL},
1913 @@ -789,11 +820,18 @@
1914  static char const *const format_args[] =
1915  {
1916    "verbose", "long", "commas", "horizontal", "across",
1917 -  "vertical", "single-column", NULL
1918 +  "vertical", "single-column", 
1919 +#ifdef WITH_SELINUX
1920 +  "context",
1921 +#endif
1922 +  NULL
1923  };
1924  static enum format const format_types[] =
1925  {
1926    long_format, long_format, with_commas, horizontal, horizontal,
1927 +#ifdef WITH_SELINUX
1928 +  security_format,
1929 +#endif
1930    many_per_line, one_per_line
1931  };
1932  ARGMATCH_VERIFY (format_args, format_types);
1933 @@ -1218,6 +1256,9 @@
1934  
1935    format_needs_stat = sort_type == sort_time || sort_type == sort_size
1936      || format == long_format
1937 +#ifdef WITH_SELINUX
1938 +    || format == security_format || print_scontext
1939 +#endif
1940      || print_block_size;
1941    format_needs_type = (! format_needs_stat
1942                        && (recursive
1943 @@ -1361,6 +1402,11 @@
1944    /* Record whether there is an option specifying sort type.  */
1945    bool sort_type_specified = false;
1946  
1947 +#ifdef WITH_SELINUX
1948 +  /* 1 iff kernel has new selinux system calls */
1949 +  selinux_enabled= (is_selinux_enabled()>0);
1950 +#endif
1951 +
1952    qmark_funny_chars = false;
1953  
1954    /* initialize all switches to default settings */
1955 @@ -1411,6 +1457,9 @@
1956    ignore_mode = IGNORE_DEFAULT;
1957    ignore_patterns = NULL;
1958    hide_patterns = NULL;
1959 +#ifdef WITH_SELINUX
1960 +  print_scontext       = 0;
1961 +#endif
1962  
1963    /* FIXME: put this in a function.  */
1964    {
1965 @@ -1486,7 +1535,7 @@
1966    }
1967  
1968    while ((c = getopt_long (argc, argv,
1969 -                          "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
1970 +                          "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1Z",
1971                            long_options, NULL)) != -1)
1972      {
1973        switch (c)
1974 @@ -1609,6 +1658,13 @@
1975           format = horizontal;
1976           break;
1977  
1978 +#ifdef WITH_SELINUX
1979 +       case 'Z':
1980 +         check_selinux();
1981 +         print_scontext = 1;
1982 +         format = security_format;
1983 +         break;
1984 +#endif
1985         case 'A':
1986           if (ignore_mode == IGNORE_DEFAULT)
1987             ignore_mode = IGNORE_DOT_AND_DOTDOT;
1988 @@ -1789,6 +1845,25 @@
1989  
1990         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
1991  
1992 +#ifdef WITH_SELINUX
1993 +
1994 +       case CONTEXT_OPTION: /* new security format */
1995 +               check_selinux();
1996 +               print_scontext = 1;
1997 +               format = security_format;
1998 +               break;
1999 +       case LCONTEXT_OPTION: /* long format plus security context */
2000 +               check_selinux();
2001 +               print_scontext = 1;
2002 +               format = long_format;
2003 +               break;
2004 +       case SCONTEXT_OPTION: /* short form of new security format */
2005 +               check_selinux();
2006 +               print_scontext = 0;
2007 +               format = security_format;
2008 +               break;
2009 +#endif
2010 +
2011         default:
2012           usage (LS_FAILURE);
2013         }
2014 @@ -2485,6 +2558,12 @@
2015        struct fileinfo *f = sorted_file[i];
2016        free (f->name);
2017        free (f->linkname);
2018 +#ifdef WITH_SELINUX
2019 +      if (f->scontext) {
2020 +       freecon (f->scontext);
2021 +       f->scontext=NULL;
2022 +      }
2023 +#endif
2024      }
2025  
2026    cwd_n_used = 0;
2027 @@ -2527,6 +2608,9 @@
2028    memset (f, '\0', sizeof *f);
2029    f->stat.st_ino = inode;
2030    f->filetype = type;
2031 +#ifdef WITH_SELINUX
2032 +  f->scontext = NULL;
2033 +#endif
2034  
2035    if (command_line_arg
2036        || format_needs_stat
2037 @@ -2582,7 +2666,12 @@
2038             {
2039               bool need_lstat;
2040               err = stat (absolute_name, &f->stat);
2041 -
2042 +#ifdef WITH_SELINUX
2043 +             if (err>=0) 
2044 +               if (selinux_enabled && (format == security_format || print_scontext))
2045 +                 getfilecon(absolute_name, &f->scontext);
2046 +#endif
2047 +       
2048               if (dereference == DEREF_COMMAND_LINE_ARGUMENTS)
2049                 break;
2050  
2051 @@ -2600,6 +2689,11 @@
2052  
2053         default: /* DEREF_NEVER */
2054           err = lstat (absolute_name, &f->stat);
2055 +#ifdef WITH_SELINUX
2056 +         if (err>=0) 
2057 +           if (selinux_enabled && (format == security_format || print_scontext))
2058 +             lgetfilecon(absolute_name, &f->scontext);
2059 +#endif
2060           break;
2061         }
2062  
2063 @@ -3158,6 +3252,16 @@
2064           DIRED_PUTCHAR ('\n');
2065         }
2066        break;
2067 +
2068 +#ifdef WITH_SELINUX
2069 +    case security_format:
2070 +      for (i = 0; i < cwd_n_used; i++)
2071 +      {
2072 +        print_scontext_format (sorted_file[i]);
2073 +        DIRED_PUTCHAR ('\n');
2074 +      }
2075 +      break;
2076 +#endif
2077      }
2078  }
2079  
2080 @@ -3412,6 +3516,14 @@
2081       The latter is wrong when nlink_width is zero.  */
2082    p += strlen (p);
2083  
2084 +#ifdef WITH_SELINUX
2085 +
2086 +  if ( print_scontext ) {
2087 +    sprintf (p, "%-32s ", f->scontext);
2088 +    p += strlen (p);
2089 +  }
2090 +#endif
2091 +
2092    DIRED_INDENT ();
2093  
2094    if (print_owner | print_group | print_author)
2095 @@ -4347,6 +4459,16 @@
2096    -X                         sort alphabetically by entry extension\n\
2097    -1                         list one file per line\n\
2098  "), stdout);
2099 +#ifdef WITH_SELINUX
2100 +printf(_("\nSELinux options:\n\n\
2101 +      --lcontext             Display security context.   Enable -l. Lines\n\
2102 +                               will probably be too wide for most displays.\n\
2103 +      -Z, --context          Display security context so it fits on most\n\
2104 +                               displays.  Displays only mode, user, group,\n\
2105 +                               security context and file name.\n\
2106 +      --scontext             Display only security context and file name.\n\
2107 +\n\n"));
2108 +#endif
2109        fputs (HELP_OPTION_DESCRIPTION, stdout);
2110        fputs (VERSION_OPTION_DESCRIPTION, stdout);
2111        fputs (_("\n\
2112 @@ -4370,3 +4492,79 @@
2113      }
2114    exit (status);
2115  }
2116 +
2117 +#ifdef WITH_SELINUX
2118 +
2119 +static void
2120 +print_scontext_format (const struct fileinfo *f)
2121 +{
2122 +  char modebuf[12];
2123 +
2124 +  /* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
2125 +     1 10-byte mode string,
2126 +     9 spaces, one following each of these fields, and
2127 +     1 trailing NUL byte.  */
2128 +
2129 +  char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10  + 9 + 1];
2130 +  char *buf = init_bigbuf;
2131 +  size_t bufsize = sizeof (init_bigbuf);
2132 +  size_t s;
2133 +  char *p;
2134 +  const char *fmt;
2135 +  char *user_name;
2136 +  char *group_name;
2137 +  int rv;
2138 +  char *scontext;
2139 +
2140 +  p = buf;
2141 +
2142 +  if ( print_scontext ) { /* zero means terse listing */
2143 +    filemodestring (&f->stat, modebuf);
2144 +    modebuf[10] = (FILE_HAS_ACL (f) ? '+' : ' ');
2145 +    modebuf[11] = '\0';
2146 +
2147 +    /* print mode */
2148 +
2149 +    (void) sprintf (p, "%s ", modebuf);
2150 +    p += strlen (p);
2151 +
2152 +    /* print standard user and group */
2153 +
2154 +    user_name = (numeric_ids ? NULL : getuser (f->stat.st_uid));
2155 +    if (user_name)
2156 +      (void) sprintf (p, "%-8.8s ", user_name);
2157 +    else
2158 +      (void) sprintf (p, "%-8u ", (unsigned int) f->stat.st_uid);
2159 +    p += strlen (p);
2160 +
2161 +    if ( print_group ) {
2162 +      group_name = (numeric_ids ? NULL : getgroup (f->stat.st_gid));
2163 +      if (group_name)
2164 +       (void) sprintf (p, "%-8.8s ", group_name);
2165 +      else
2166 +       (void) sprintf (p, "%-8u ", (unsigned int) f->stat.st_gid);
2167 +      p += strlen (p);
2168 +    }
2169 +  }
2170 +
2171 +  (void) sprintf (p, "%-32s ", f->scontext);
2172 +  p += strlen (p);
2173
2174 +  DIRED_INDENT ();
2175 +  DIRED_FPUTS (buf, stdout, p - buf);
2176 +  print_name_with_quoting (f->name, f->stat.st_mode, f->linkok, f->stat_ok, f->filetype, &dired_obstack);
2177
2178 +  if (f->filetype == symbolic_link) {
2179 +      if (f->linkname) {
2180 +         DIRED_FPUTS_LITERAL (" -> ", stdout);
2181 +         print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1, f->stat_ok, f->filetype, NULL);
2182 +         if (indicator_style != none)
2183 +           print_type_indicator (f->stat_ok, f->linkmode, f->filetype);
2184 +      }
2185 +  }
2186 +  else {
2187 +    if (indicator_style != none)
2188 +      print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
2189 +  }
2190 +}
2191 +#endif
2192 diff -Nur coreutils-6.4/src/mkdir.c coreutils-6.4.selinux/src/mkdir.c
2193 --- coreutils-6.4/src/mkdir.c   2006-10-22 16:54:15.000000000 +0000
2194 +++ coreutils-6.4.selinux/src/mkdir.c   2006-10-31 23:39:34.000000000 +0000
2195 @@ -35,11 +35,18 @@
2196  
2197  #define AUTHORS "David MacKenzie"
2198  
2199 +#ifdef WITH_SELINUX
2200 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
2201 +#endif
2202 +
2203  /* The name this program was run with. */
2204  char *program_name;
2205  
2206  static struct option const longopts[] =
2207  {
2208 +#ifdef WITH_SELINUX
2209 +  {"context", required_argument, NULL, 'Z'},
2210 +#endif
2211    {"mode", required_argument, NULL, 'm'},
2212    {"parents", no_argument, NULL, 'p'},
2213    {"verbose", no_argument, NULL, 'v'},
2214 @@ -61,6 +68,11 @@
2215  Create the DIRECTORY(ies), if they do not already exist.\n\
2216  \n\
2217  "), stdout);
2218 +#ifdef WITH_SELINUX
2219 +      printf (_("\
2220 +  -Z, --context=CONTEXT (SELinux) set security context to CONTEXT\n\
2221 +"));
2222 +#endif
2223        fputs (_("\
2224  Mandatory arguments to long options are mandatory for short options too.\n\
2225  "), stdout);
2226 @@ -154,7 +166,11 @@
2227  
2228    atexit (close_stdout);
2229  
2230 +#ifdef WITH_SELINUX
2231 +  while ((optc = getopt_long (argc, argv, "pm:vZ:", longopts, NULL)) != -1)
2232 +#else
2233    while ((optc = getopt_long (argc, argv, "pm:v", longopts, NULL)) != -1)
2234 +#endif
2235      {
2236        switch (optc)
2237         {
2238 @@ -167,6 +183,19 @@
2239         case 'v': /* --verbose  */
2240           options.created_directory_format = _("created directory %s");
2241           break;
2242 +#ifdef WITH_SELINUX
2243 +       case 'Z':
2244 +         /* politely decline if we're not on a selinux-enabled kernel. */
2245 +         if( !(is_selinux_enabled()>0)) {
2246 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
2247 +           exit( 1 );
2248 +         }
2249 +         if (setfscreatecon(optarg)) {
2250 +           fprintf( stderr, _("Sorry, cannot set default context to %s.\n"), optarg);
2251 +           exit( 1 );
2252 +         }
2253 +         break;
2254 +#endif
2255         case_GETOPT_HELP_CHAR;
2256         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
2257         default:
2258 diff -Nur coreutils-6.4/src/mkfifo.c coreutils-6.4.selinux/src/mkfifo.c
2259 --- coreutils-6.4/src/mkfifo.c  2006-10-22 16:54:15.000000000 +0000
2260 +++ coreutils-6.4.selinux/src/mkfifo.c  2006-10-31 23:39:34.000000000 +0000
2261 @@ -32,11 +32,18 @@
2262  
2263  #define AUTHORS "David MacKenzie"
2264  
2265 +#ifdef WITH_SELINUX
2266 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
2267 +#endif
2268 +
2269  /* The name this program was run with. */
2270  char *program_name;
2271  
2272  static struct option const longopts[] =
2273  {
2274 +#ifdef WITH_SELINUX
2275 +  {"context", required_argument, NULL, 'Z'},
2276 +#endif
2277    {"mode", required_argument, NULL, 'm'},
2278    {GETOPT_HELP_OPTION_DECL},
2279    {GETOPT_VERSION_OPTION_DECL},
2280 @@ -56,6 +63,11 @@
2281  Create named pipes (FIFOs) with the given NAMEs.\n\
2282  \n\
2283  "), stdout);
2284 +#ifdef WITH_SELINUX
2285 +      printf (_("\
2286 +  -Z, --context=CONTEXT   set security context (quoted string)\n\
2287 +"), stdout);
2288 +#endif
2289        fputs (_("\
2290  Mandatory arguments to long options are mandatory for short options too.\n\
2291  "), stdout);
2292 @@ -85,13 +97,31 @@
2293  
2294    atexit (close_stdout);
2295  
2296 -  while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
2297 +  while ((optc = getopt_long (argc, argv, 
2298 +#ifdef WITH_SELINUX
2299 +                                 "m:Z:",
2300 +#else
2301 +                                 "m:",
2302 +#endif                           
2303 +                                 longopts, NULL)) != -1)
2304      {
2305        switch (optc)
2306         {
2307         case 'm':
2308           specified_mode = optarg;
2309           break;
2310 +#ifdef WITH_SELINUX
2311 +       case 'Z':
2312 +         if( !(is_selinux_enabled()>0)) {
2313 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
2314 +           exit( 1 );
2315 +         }
2316 +         if (setfscreatecon(optarg)) {
2317 +           fprintf( stderr, _("Sorry, cannot set default context to %s.\n"), optarg);
2318 +           exit( 1 );
2319 +         }
2320 +         break;
2321 +#endif
2322         case_GETOPT_HELP_CHAR;
2323         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
2324         default:
2325 diff -Nur coreutils-6.4/src/mknod.c coreutils-6.4.selinux/src/mknod.c
2326 --- coreutils-6.4/src/mknod.c   2006-10-22 16:54:15.000000000 +0000
2327 +++ coreutils-6.4.selinux/src/mknod.c   2006-10-31 23:39:34.000000000 +0000
2328 @@ -36,8 +36,15 @@
2329  /* The name this program was run with. */
2330  char *program_name;
2331  
2332 +#ifdef WITH_SELINUX
2333 +#include <selinux/selinux.h>
2334 +#endif
2335 +
2336  static struct option const longopts[] =
2337  {
2338 +#ifdef WITH_SELINUX
2339 +  {"context", required_argument, NULL, 'Z'},
2340 +#endif
2341    {"mode", required_argument, NULL, 'm'},
2342    {GETOPT_HELP_OPTION_DECL},
2343    {GETOPT_VERSION_OPTION_DECL},
2344 @@ -58,6 +65,11 @@
2345  Create the special file NAME of the given TYPE.\n\
2346  \n\
2347  "), stdout);
2348 +#ifdef WITH_SELINUX
2349 +      fputs(_("\
2350 +  -Z, --context=CONTEXT   set security context (quoted string)\n\
2351 +"), stdout);
2352 +#endif
2353        fputs (_("\
2354  Mandatory arguments to long options are mandatory for short options too.\n\
2355  "), stdout);
2356 @@ -101,13 +113,30 @@
2357  
2358    atexit (close_stdout);
2359  
2360 +#ifdef WITH_SELINUX
2361 +  while ((optc = getopt_long (argc, argv, "m:Z:", longopts, NULL)) != -1)
2362 +#else
2363    while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
2364 +#endif
2365      {
2366        switch (optc)
2367         {
2368         case 'm':
2369           specified_mode = optarg;
2370           break;
2371 +#ifdef WITH_SELINUX
2372 +       case 'Z':
2373 +         /* politely decline if we're not on a selinux-enabled kernel. */
2374 +         if( !(is_selinux_enabled()>0)) {
2375 +           fprintf( stderr, _("Sorry, --context (-Z) can be used only on a SELinux-enabled kernel.\n") );
2376 +           exit( 1 );
2377 +         }
2378 +         if (setfscreatecon(optarg)) {
2379 +           fprintf( stderr, _("Sorry, cannot set default context to %s.\n"), optarg);
2380 +           exit( 1 );
2381 +         }
2382 +         break;
2383 +#endif
2384         case_GETOPT_HELP_CHAR;
2385         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
2386         default:
2387 diff -Nur coreutils-6.4/src/mv.c coreutils-6.4.selinux/src/mv.c
2388 --- coreutils-6.4/src/mv.c      2006-10-22 16:54:15.000000000 +0000
2389 +++ coreutils-6.4.selinux/src/mv.c      2006-10-31 23:39:34.000000000 +0000
2390 @@ -33,6 +33,11 @@
2391  #include "quote.h"
2392  #include "remove.h"
2393  
2394 +#ifdef WITH_SELINUX
2395 +#include <selinux/selinux.h>          /* for is_selinux_enabled() */
2396 +int selinux_enabled=0;
2397 +#endif
2398 +
2399  /* The official name of this program (e.g., no `g' prefix).  */
2400  #define PROGRAM_NAME "mv"
2401  
2402 @@ -125,6 +130,9 @@
2403    x->preserve_links = true;
2404    x->preserve_mode = true;
2405    x->preserve_timestamps = true;
2406 +#ifdef WITH_SELINUX
2407 +  x->preserve_security_context = true;
2408 +#endif
2409    x->require_preserve = false;  /* FIXME: maybe make this an option */
2410    x->recursive = true;
2411    x->sparse_mode = SPARSE_AUTO;  /* FIXME: maybe make this an option */
2412 @@ -356,6 +364,10 @@
2413  
2414    cp_option_init (&x);
2415  
2416 +#ifdef WITH_SELINUX
2417 +  selinux_enabled= (is_selinux_enabled()>0);
2418 +#endif
2419 +
2420    /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
2421       we'll actually use backup_suffix_string.  */
2422    backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
2423 diff -Nur coreutils-6.4/src/runcon.c coreutils-6.4.selinux/src/runcon.c
2424 --- coreutils-6.4/src/runcon.c  1970-01-01 00:00:00.000000000 +0000
2425 +++ coreutils-6.4.selinux/src/runcon.c  2006-10-31 23:39:34.000000000 +0000
2426 @@ -0,0 +1,174 @@
2427 +/*
2428 + * runcon [ context |
2429 + *         ( [ -r role ] [-t type] [ -u user ] [ -l levelrange ] )
2430 + *         command [arg1 [arg2 ...] ]
2431 + *
2432 + * attempt to run the specified command with the specified context.
2433 + * 
2434 + * -r role  : use the current context with the specified role
2435 + * -t type  : use the current context with the specified type
2436 + * -u user  : use the current context with the specified user
2437 + * -l level : use the current context with the specified level range
2438 + *
2439 + * Contexts are interpreted as follows:
2440 + *
2441 + * Number of       MLS
2442 + * components    system?
2443 + *
2444 + *     1            -         type
2445 + *     2            -         role:type
2446 + *     3            Y         role:type:range
2447 + *     3            N         user:role:type
2448 + *     4            Y         user:role:type:range
2449 + *     4            N         error
2450 + */
2451 +
2452 +#include <config.h>
2453 +#include <unistd.h>
2454 +#include <stdio.h>
2455 +#include <getopt.h>
2456 +#include <selinux/context.h>
2457 +#include <selinux/selinux.h>
2458 +#include <errno.h>
2459 +#include "system.h"
2460 +extern int errno;
2461 +
2462 +/* The name the program was run with. */
2463 +char *program_name;
2464 +
2465 +void
2466 +usage(char *str)
2467 +{
2468 +  printf(_("Usage: %s [OPTION]... command [args]\n"
2469 +         "Run a program in a different security context.\n\n"
2470 +         "  context       Complete security context\n"
2471 +         "  -t            type (for same role as parent)\n"
2472 +         "  -u            user identity\n"
2473 +         "  -r            role\n"
2474 +         "  -l            levelrange\n"
2475 +         "    --help      display this help and exit\n"),
2476 +         program_name);
2477 +  exit(1);
2478 +}
2479 +
2480 +int 
2481 +main(int argc,char **argv,char **envp )
2482 +{
2483 +  char *role    = 0;
2484 +  char *range   = 0;
2485 +  char *user    = 0;
2486 +  char *type    = 0;
2487 +  char *context = NULL;
2488 +  security_context_t cur_context = NULL;
2489 +
2490 +  context_t      con;
2491 +
2492 +  program_name = argv[0];
2493 +  setlocale (LC_ALL, "");
2494 +  bindtextdomain (PACKAGE, LOCALEDIR);
2495 +  textdomain (PACKAGE);
2496 +  
2497 +  while (1) {
2498 +    int c;
2499 +    int this_option_optind = optind ? optind : 1;
2500 +    int option_index = 0;
2501 +    static struct option long_options[] = {
2502 +      { "role", 1, 0, 'r' },
2503 +      { "type", 1, 0, 't' },
2504 +      { "user", 1, 0, 'u' },
2505 +      { "range", 1, 0, 'l' },
2506 +      { "help", 0, 0, '?' },
2507 +      { 0, 0, 0, 0 }
2508 +    };
2509 +    c = getopt_long(argc, argv, "s:r:t:u:l:?", long_options, &option_index);
2510 +    if ( c == -1 ) {
2511 +      break;
2512 +    }
2513 +    switch ( c ) {
2514 +    case 'r':
2515 +      if ( role ) {
2516 +       fprintf(stderr,_("multiple roles\n"));
2517 +       exit(1);
2518 +      }
2519 +      role = optarg;
2520 +      break;
2521 +    case 't':
2522 +      if ( type ) {
2523 +       fprintf(stderr,_("multiple types\n"));
2524 +       exit(1);
2525 +      }
2526 +      type = optarg;
2527 +      break;
2528 +    case 'u':
2529 +      if ( user ) {
2530 +       fprintf(stderr,_("multiple users\n"));
2531 +       exit(1);
2532 +      }
2533 +      user = optarg;
2534 +      break;
2535 +    case 'l':
2536 +      if ( range ) {
2537 +       fprintf(stderr,_("multiple levelranges\n"));
2538 +       exit(1);
2539 +      }
2540 +      range = optarg;
2541 +      break;
2542 +    default:
2543 +      fprintf(stderr,_("unrecognised option %c\n"),c);
2544 +    case '?':
2545 +      usage(0);
2546 +      break;
2547 +    }
2548 +  }
2549 +  if ( !(user || role || type || range)) {
2550 +    if ( optind >= argc ) {
2551 +      usage(_("must specify -t, -u, -l, -r, or context"));
2552 +    }
2553 +    context = argv[optind++];
2554 +  }
2555 +  
2556 +  if ( optind >= argc ) {
2557 +    usage(_("no command found"));
2558 +  }
2559 +
2560 +  if ( context ) {
2561 +    con = context_new(context);
2562 +    if (!con) {
2563 +      fprintf(stderr,_("%s is not a valid context\n"), context);
2564 +      exit(1);
2565 +    }
2566 +  }
2567 +  else {
2568 +    getcon(&cur_context);
2569 +    con = context_new(cur_context);
2570 +    if (!con) {
2571 +      fprintf(stderr,_("%s is not a valid context\n"), context);
2572 +      exit(1);
2573 +    }
2574 +    if ( user ) {
2575 +      context_user_set(con,user);
2576 +    }
2577 +    if ( type ) {
2578 +      context_type_set(con,type);
2579 +    }
2580 +    if ( range ) {
2581 +      context_range_set(con,range);
2582 +    }
2583 +    if ( role ) {
2584 +      context_role_set(con,role);
2585 +    }
2586 +  }
2587 +  
2588 +  if (setexeccon(context_str(con))!=0) {
2589 +    fprintf(stderr,_("unable to setup security context %s\n"), context_str(con));
2590 +    exit(1);
2591 +  }
2592 +  if (cur_context!=NULL) 
2593 +    freecon(cur_context);
2594 +
2595 +  if ( execvp(argv[optind],argv+optind) ) {
2596 +    perror("execvp");
2597 +    exit(1);
2598 +  }
2599 +  return 1; /* can't reach this statement.... */
2600 +}
2601 diff -Nur coreutils-6.4/src/stat.c coreutils-6.4.selinux/src/stat.c
2602 --- coreutils-6.4/src/stat.c    2006-10-22 16:54:15.000000000 +0000
2603 +++ coreutils-6.4.selinux/src/stat.c    2006-10-31 23:39:48.000000000 +0000
2604 @@ -55,6 +55,13 @@
2605  # include <fs_info.h>
2606  #endif
2607  
2608 +#ifdef WITH_SELINUX
2609 +#include <selinux/selinux.h>
2610 +#define SECURITY_ID_T security_context_t
2611 +#else
2612 +#define SECURITY_ID_T char *
2613 +#endif
2614 +
2615  #include "system.h"
2616  
2617  #include "error.h"
2618 @@ -161,6 +168,7 @@
2619    {"dereference", no_argument, NULL, 'L'},
2620    {"file-system", no_argument, NULL, 'f'},
2621    {"filesystem", no_argument, NULL, 'f'}, /* obsolete and undocumented alias */
2622 +  {"context", no_argument, 0, 'Z'},
2623    {"format", required_argument, NULL, 'c'},
2624    {"printf", required_argument, NULL, PRINTF_OPTION},
2625    {"terse", no_argument, NULL, 't'},
2626 @@ -397,7 +405,7 @@
2627  /* print statfs info */
2628  static void
2629  print_statfs (char *pformat, size_t prefix_len, char m, char const *filename,
2630 -             void const *data)
2631 +             void const *data, SECURITY_ID_T scontext)
2632  {
2633    STRUCT_STATVFS const *statfsbuf = data;
2634  
2635 @@ -472,7 +480,9 @@
2636      case 'd':
2637        out_int (pformat, prefix_len, statfsbuf->f_ffree);
2638        break;
2639 -
2640 +    case 'C':
2641 +      out_string (pformat, prefix_len, scontext);
2642 +      break;
2643      default:
2644        fputc ('?', stdout);
2645        break;
2646 @@ -482,7 +492,7 @@
2647  /* print stat info */
2648  static void
2649  print_stat (char *pformat, size_t prefix_len, char m,
2650 -           char const *filename, void const *data)
2651 +           char const *filename, void const *data, SECURITY_ID_T scontext)
2652  {
2653    struct stat *statbuf = (struct stat *) data;
2654    struct passwd *pw_ent;
2655 @@ -595,6 +605,9 @@
2656        else
2657         out_uint (pformat, prefix_len, statbuf->st_ctime);
2658        break;
2659 +    case 'C':
2660 +      out_string (pformat, prefix_len, scontext);
2661 +      break;
2662      default:
2663        fputc ('?', stdout);
2664        break;
2665 @@ -641,8 +654,8 @@
2666  
2667  static void
2668  print_it (char const *format, char const *filename,
2669 -         void (*print_func) (char *, size_t, char, char const *, void const *),
2670 -         void const *data)
2671 +         void (*print_func) (char *, size_t, char, char const *, void const *, SECURITY_ID_T),
2672 +         void const *data, SECURITY_ID_T scontext)
2673  {
2674    /* Add 2 to accommodate our conversion of the stat `%s' format string
2675       to the longer printf `%llu' one.  */
2676 @@ -683,7 +696,7 @@
2677                 putchar ('%');
2678                 break;
2679               default:
2680 -               print_func (dest, len + 1, *fmt_char, filename, data);
2681 +               print_func (dest, len + 1, *fmt_char, filename, data, scontext);
2682                 break;
2683               }
2684             break;
2685 @@ -746,9 +759,17 @@
2686  
2687  /* Stat the file system and print what we find.  */
2688  static bool
2689 -do_statfs (char const *filename, bool terse, char const *format)
2690 +do_statfs (char const *filename, bool terse, bool secure, char const *format)
2691  {
2692    STRUCT_STATVFS statfsbuf;
2693 +  SECURITY_ID_T scontext = NULL;
2694 +#ifdef WITH_SELINUX
2695 +  if(secure)
2696 +    if (getfilecon(filename,&scontext)<0) {
2697 +      perror (filename);
2698 +      return false;
2699 +    }
2700 +#endif
2701  
2702    if (STATFS (filename, &statfsbuf) != 0)
2703      {
2704 @@ -759,25 +780,45 @@
2705  
2706    if (format == NULL)
2707      {
2708 -      format = (terse
2709 -               ? "%n %i %l %t %s %S %b %f %a %c %d\n"
2710 -               : "  File: \"%n\"\n"
2711 -               "    ID: %-8i Namelen: %-7l Type: %T\n"
2712 -               "Block size: %-10s Fundamental block size: %S\n"
2713 -               "Blocks: Total: %-10b Free: %-10f Available: %a\n"
2714 -               "Inodes: Total: %-10c Free: %d\n");
2715 -    }
2716 +      if (terse) {
2717 +        if(secure)
2718 +         format = "%n %i %l %t %s %S %b %f %a %c %d %C\n";
2719 +       else
2720 +         format = "%n %i %l %t %s %S %b %f %a %c %d\n";
2721 +       } 
2722 +      else 
2723 +       {
2724 +       if(secure)
2725 +         format = "  File: \"%n\"\n"
2726 +           "    ID: %-8i Namelen: %-7l Type: %T\n"
2727 +           "Block size: %-10s Fundamental block size: %S\n"
2728 +           "Blocks: Total: %-10b Free: %-10f Available: %a\n"
2729 +           "Inodes: Total: %-10c Free: %d\n"
2730 +           "   S_Context: %C\n";
2731 +       else    
2732 +         format = "  File: \"%n\"\n"
2733 +           "    ID: %-8i Namelen: %-7l Type: %T\n"
2734 +           "Block size: %-10s Fundamental block size: %S\n"
2735 +           "Blocks: Total: %-10b Free: %-10f Available: %a\n"
2736 +           "Inodes: Total: %-10c Free: %d\n";
2737 +       }       
2738 +    }
2739 +  print_it (format, filename, print_statfs, &statfsbuf, scontext);
2740 +#ifdef WITH_SELINUX
2741 +  if (scontext != NULL)
2742 +    freecon(scontext);
2743 +#endif
2744  
2745 -  print_it (format, filename, print_statfs, &statfsbuf);
2746    return true;
2747  }
2748  
2749  /* stat the file and print what we find */
2750  static bool
2751 -do_stat (char const *filename, bool follow_links, bool terse,
2752 +do_stat (char const *filename, bool follow_links, bool terse, bool secure,
2753          char const *format)
2754  {
2755    struct stat statbuf;
2756 +  SECURITY_ID_T scontext = NULL;
2757  
2758    if ((follow_links ? stat : lstat) (filename, &statbuf) != 0)
2759      {
2760 @@ -785,11 +826,29 @@
2761        return false;
2762      }
2763  
2764 +#ifdef WITH_SELINUX
2765 +  if(secure) {
2766 +    int i;
2767 +    if (follow_links) 
2768 +      i=lgetfilecon(filename, &scontext);
2769 +    else
2770 +      i=getfilecon(filename, &scontext);
2771 +    if (i == -1)
2772 +      {
2773 +       perror (filename);
2774 +       return false;
2775 +      }
2776 +  }
2777 +#endif
2778 +
2779    if (format == NULL)
2780      {
2781        if (terse)
2782         {
2783 -         format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n";
2784 +          if (secure)
2785 +            format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n";
2786 +          else
2787 +            format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n";
2788         }
2789        else
2790         {
2791 @@ -797,7 +856,17 @@
2792              implemented.  */
2793           if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode))
2794             {
2795 -             format =
2796 +               if (secure)
2797 +                               format =
2798 +                         "  File: %N\n"
2799 +                         "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2800 +                         "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
2801 +                         " Device type: %t,%T\n"
2802 +                         "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
2803 +                         "   S_Context: %C\n"
2804 +                         "Access: %x\n" "Modify: %y\n" "Change: %z\n";
2805 +               else
2806 +              format =
2807                 "  File: %N\n"
2808                 "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2809                 "Device: %Dh/%dd\tInode: %-10i  Links: %-5h"
2810 @@ -807,6 +876,15 @@
2811             }
2812           else
2813             {
2814 +               if (secure)
2815 +                 format =
2816 +                   "  File: %N\n"
2817 +                   "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2818 +                   "Device: %Dh/%dd\tInode: %-10i  Links: %-5h\n"
2819 +                   "Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n"
2820 +                   "S_Context: %C\n"
2821 +                   "Access: %x\n" "Modify: %y\n" "Change: %z\n";
2822 +                else
2823               format =
2824                 "  File: %N\n"
2825                 "  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
2826 @@ -816,7 +894,11 @@
2827             }
2828         }
2829      }
2830 -  print_it (format, filename, print_stat, &statbuf);
2831 +  print_it (format, filename, print_stat, &statbuf, scontext);
2832 +#ifdef WITH_SELINUX
2833 +  if (scontext) 
2834 +    freecon(scontext);
2835 +#endif
2836    return true;
2837  }
2838  
2839 @@ -841,6 +923,7 @@
2840        --printf=FORMAT   like --format, but interpret backslash escapes,\n\
2841                            and do not output a mandatory trailing newline.\n\
2842                            If you want a newline, include \\n in FORMAT.\n\
2843 +  -Z, --context         print the security context\n\
2844    -t, --terse           print the information in terse form\n\
2845  "), stdout);
2846        fputs (HELP_OPTION_DESCRIPTION, stdout);
2847 @@ -892,6 +975,7 @@
2848    %c   Total file nodes in file system\n\
2849    %d   Free file nodes in file system\n\
2850    %f   Free blocks in file system\n\
2851 +  %C   Security context in SELinux\n\
2852  "), stdout);
2853        fputs (_("\
2854    %i   File System ID in hex\n\
2855 @@ -915,6 +999,7 @@
2856    int i;
2857    bool follow_links = false;
2858    bool fs = false;
2859 +  bool secure = false;
2860    bool terse = false;
2861    char *format = NULL;
2862    bool ok = true;
2863 @@ -927,7 +1012,7 @@
2864  
2865    atexit (close_stdout);
2866  
2867 -  while ((c = getopt_long (argc, argv, "c:fLt", long_options, NULL)) != -1)
2868 +  while ((c = getopt_long (argc, argv, "c:fLtZ", long_options, NULL)) != -1)
2869      {
2870        switch (c)
2871         {
2872 @@ -946,6 +1031,14 @@
2873         case 'L':
2874           follow_links = true;
2875           break;
2876 +       case 'Z':
2877 +         if((is_selinux_enabled()>0))
2878 +           secure = true;
2879 +         else {
2880 +           error (0, 0, _("Kernel is not SELinux enabled"));
2881 +           usage (EXIT_FAILURE);
2882 +         }
2883 +         break;
2884  
2885         case 'f':
2886           fs = true;
2887 @@ -972,8 +1065,8 @@
2888  
2889    for (i = optind; i < argc; i++)
2890      ok &= (fs
2891 -          ? do_statfs (argv[i], terse, format)
2892 -          : do_stat (argv[i], follow_links, terse, format));
2893 +          ? do_statfs (argv[i], terse, secure, format)
2894 +          : do_stat (argv[i], follow_links, terse, secure, format));
2895  
2896    exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
2897  }
2898 diff -Nur coreutils-6.4/tests/help-version coreutils-6.4.selinux/tests/help-version
2899 --- coreutils-6.4/tests/help-version    2006-10-22 16:54:15.000000000 +0000
2900 +++ coreutils-6.4.selinux/tests/help-version    2006-10-31 23:39:34.000000000 +0000
2901 @@ -70,6 +70,8 @@
2902  
2903      # Skip `test'; it doesn't accept --help or --version.
2904      test $i = test && continue;
2905 +    test $i = chcon && continue;
2906 +    test $i = runcon && continue;
2907  
2908      # false fails even when invoked with --help or --version.
2909      if test $i = false; then
2910 @@ -190,7 +192,7 @@
2911  
2912  for i in $all_programs; do
2913    # Skip these.
2914 -  case $i in chroot|stty|tty|false) continue;; esac
2915 +  case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
2916  
2917    rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
2918    echo > $tmp_in
This page took 0.323474 seconds and 3 git commands to generate.