policycoreutils/policycoreutils-rhat.patch
Daniel J Walsh b14fed2892 * Thu Sep 15 2005 Dan Walsh <dwalsh@redhat.com> 1.26-3
- Add chcat script for use with chcon.
2005-09-15 20:02:48 +00:00

108 lines
3.8 KiB
Diff

diff --exclude-from=exclude -N -u -r nsapolicycoreutils/restorecon/restorecon.c policycoreutils-1.26/restorecon/restorecon.c
--- nsapolicycoreutils/restorecon/restorecon.c 2005-09-12 16:33:30.000000000 -0400
+++ policycoreutils-1.26/restorecon/restorecon.c 2005-09-13 13:19:58.000000000 -0400
@@ -259,7 +259,6 @@
int main(int argc, char **argv) {
int i=0;
char *file_name=NULL;
- int errors=0;
int file=0;
int opt;
char buf[PATH_MAX];
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycoreutils-1.26/scripts/chcat
--- nsapolicycoreutils/scripts/chcat 1969-12-31 19:00:00.000000000 -0500
+++ policycoreutils-1.26/scripts/chcat 2005-09-15 15:47:46.000000000 -0400
@@ -0,0 +1,13 @@
+#!/bin/sh
+if [ $# -lt 2 ]; then
+ echo "Usage $0 Category File ..."
+ echo "Usage $0 -d File ..."
+ exit 1
+fi
+if [ $1 == "-d" ]; then
+shift
+chcon -l "" $*
+else
+chcon -l $*
+fi
+
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat.8 policycoreutils-1.26/scripts/chcat.8
--- nsapolicycoreutils/scripts/chcat.8 1969-12-31 19:00:00.000000000 -0500
+++ policycoreutils-1.26/scripts/chcat.8 2005-09-15 16:00:05.000000000 -0400
@@ -0,0 +1,23 @@
+.TH CHCAT "8" "September 2005" "chcat" "User Commands"
+.SH NAME
+chcat \- change file security category
+.SH SYNOPSIS
+.B chcat
+\fICATEGORY FILE\fR...
+.br
+.B chcat
+[\fI-d\fR] \fIFILE\fR...
+.br
+.PP
+Change/Remove the security CATEGORY for each FILE.
+.br
+This script wraps the chcon command.
+.TP
+\fB\-d\fR
+delete the category from each file.
+.SH "SEE ALSO"
+.TP
+chcon(1), selinux(8)
+.SH "FILES"
+/etc/mcs.conf
+
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/fixfiles policycoreutils-1.26/scripts/fixfiles
--- nsapolicycoreutils/scripts/fixfiles 2005-09-14 15:32:01.000000000 -0400
+++ policycoreutils-1.26/scripts/fixfiles 2005-09-13 13:19:58.000000000 -0400
@@ -61,7 +61,11 @@
if [ -f ${PREFC} -a -x /usr/bin/diff ]; then
TEMPFILE=`mktemp ${FC}.XXXXXXXXXX`
test -z "$TEMPFILE" && exit
- /usr/bin/diff $PREFC $FC | grep '^[<>]'|cut -c3-| grep ^/ | \
+ PREFCTEMPFILE=`mktemp ${PREFC}.XXXXXXXXXX`
+ sed -r -e 's,:s0[[:space:]], ,g' $PREFC > ${PREFCTEMPFILE}
+ sed -r -e 's,:s0[[:space:]], ,g' $FC | \
+ /usr/bin/diff -b ${PREFCTEMPFILE} - | \
+ grep '^[<>]'|cut -c3-| grep ^/ | \
egrep -v '(^/home|^/root|^/tmp|^/dev)' |\
sed -r -e 's,[[:blank:]].*,,g' \
-e 's|\(([/[:alnum:]]+)\)\?|{\1,}|g' \
@@ -85,7 +89,7 @@
while read pattern ; do find $pattern \( -fstype ext2 -o -fstype ext3 -o -fstype jfs -o -fstype xfs \) -print; done 2> /dev/null | \
egrep -v '(^/home|^/root|^/tmp|^/dev)' |\
${RESTORECON} $2 -v -f -
- rm -f ${TEMPFILE}
+ rm -f ${TEMPFILE} ${PREFCTEMPFILE}
fi
}
#
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/setfiles/setfiles.8 policycoreutils-1.26/setfiles/setfiles.8
--- nsapolicycoreutils/setfiles/setfiles.8 2005-09-12 16:33:30.000000000 -0400
+++ policycoreutils-1.26/setfiles/setfiles.8 2005-09-13 13:19:58.000000000 -0400
@@ -35,6 +35,9 @@
.B \-q
suppress non-error output.
.TP
+.B \-r
+use an alternate root path
+.TP
.B \-e directory
directory to exclude (repeat option for more than one directory.)
.TP
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/setfiles/setfiles.c policycoreutils-1.26/setfiles/setfiles.c
--- nsapolicycoreutils/setfiles/setfiles.c 2005-09-12 16:33:30.000000000 -0400
+++ policycoreutils-1.26/setfiles/setfiles.c 2005-09-13 13:19:58.000000000 -0400
@@ -198,8 +198,8 @@
void usage(const char * const name)
{
fprintf(stderr,
- "usage: %s [-dnqvW] [-o filename] spec_file pathname...\n"
- "usage: %s [-c policyfile] spec_file\n"
+ "usage: %s [-dnqvW] [-o filename] [-r alt_root_path ] spec_file pathname...\n"
+ "usage: %s -c policyfile spec_file\n"
"usage: %s -s [-dnqvW] [-o filename ] spec_file\n", name, name, name);
exit(1);
}