* Mon Jan 3 2005 Dan Walsh <dwalsh@redhat.com> 1.19.3-1

- Update to latest from NSA
	* Merged fixfiles and restorecon patches from Dan Walsh.
	* Don't display change if only user part changed.
This commit is contained in:
Daniel J Walsh 2005-01-05 20:17:09 +00:00
parent 29309fe6a6
commit 9fb0a29c97
4 changed files with 41 additions and 83 deletions

View File

@ -4,3 +4,4 @@ policycoreutils-1.17.7.tgz
policycoreutils-1.18.1.tgz
policycoreutils-1.19.1.tgz
policycoreutils-1.19.2.tgz
policycoreutils-1.19.3.tgz

View File

@ -1,86 +1,38 @@
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/restorecon/restorecon.c policycoreutils-1.19.2/restorecon/restorecon.c
--- nsapolicycoreutils/restorecon/restorecon.c 2004-12-29 12:18:11.000000000 -0500
+++ policycoreutils-1.19.2/restorecon/restorecon.c 2005-01-03 14:14:12.256118904 -0500
@@ -68,7 +68,8 @@
return 1;
}
if (S_ISLNK(st.st_mode)) {
- fprintf(stderr,"Warning! %s refers to a symbolic link, not following last component.\n", filename);
+ if (verbose>1)
+ fprintf(stderr,"Warning! %s refers to a symbolic link, not following last component.\n", filename);
char *p = NULL, *file_sep;
char *tmp_path = strdup(filename);
if (!tmp_path) {
@@ -129,8 +130,8 @@
--- nsapolicycoreutils/restorecon/restorecon.c 2005-01-05 15:12:59.569516712 -0500
+++ policycoreutils-1.19.2/restorecon/restorecon.c 2005-01-05 15:11:14.994550830 -0500
@@ -43,6 +43,20 @@
static int errors=0;
static int recurse;
+/* Compare two contexts to see if their differences are "significant",
+ * or whether the only difference is in the user. */
+static int only_changed_user(const char *a, const char *b)
+{
+ char *rest_a, *rest_b; /* Rest of the context after the user */
+ rest_a = strchr(a, ':');
+ rest_b = strchr(b, ':');
+ if (!rest_a || !rest_b)
+ return 0;
+ if (strcmp(rest_a, rest_b) == 0)
+ return 1;
+ return 0;
+}
+
void usage(const char * const name)
{
fprintf(stderr,
@@ -129,9 +143,10 @@
freecon(scontext);
return 1;
} else
if (verbose)
- fprintf(stderr,"%s reset context %s->%s\n",
- progname, filename, scontext);
+ fprintf(stderr,"%s reset context %s %s->%s\n",
+ progname, filename, prev_context, scontext);
- if (verbose)
- fprintf(stderr,"%s reset context %s:%s->%s\n",
- progname, filename, prev_context, scontext);
+ if (verbose > 1 ||
+ !only_changed_user(scontext, prev_context))
+ fprintf(stderr,"%s reset context %s:%s->%s\n",
+ progname, filename, prev_context, scontext);
}
if (retcontext >= 0)
freecon(prev_context);
@@ -198,7 +199,7 @@
}
break;
case 'v':
- verbose = 1;
+ verbose++;
break;
case 'f':
file = 1;
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/fixfiles policycoreutils-1.19.2/scripts/fixfiles
--- nsapolicycoreutils/scripts/fixfiles 2004-10-26 11:15:41.000000000 -0400
+++ policycoreutils-1.19.2/scripts/fixfiles 2005-01-03 13:30:04.000000000 -0500
@@ -53,10 +53,13 @@
echo $1 >> $LOGFILE
fi
}
+rpmlist() {
+rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" | grep '^0 ' | cut -f2- -d ' '
+}
checkLabels () {
if [ ! -z "$1" ]; then
for i in `echo $1 | sed 's/,/ /g'`; do
- rpm -q -l $i | restorecon ${OUTFILES} -n -v -f - 2>&1 >> $LOGFILE
+ rpmlist $i | restorecon ${OUTFILES} -R -n -v -f - 2>&1 >> $LOGFILE
done
else
if [ ! -z "$FILESYSTEMSRO" ]; then
@@ -70,7 +73,7 @@
restoreLabels () {
if [ ! -z "$1" ]; then
for i in `echo $1 | sed 's/,/ /g'`; do
- rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 >> $LOGFILE
+ rpmlist $i | restorecon ${OUTFILES} -R -v -f - 2>&1 >> $LOGFILE
done
else
if [ ! -z "$FILESYSTEMSRO" ]; then
@@ -82,13 +85,11 @@
}
relabel() {
-logit "Cleaning out /tmp"
-rm -rf /tmp/.??* /tmp/*
if [ ! -z "$1" ]; then
- for i in `echo $1 | sed 's/,/ /g'`; do
- rpm -q -l $i | restorecon ${OUTFILES} -v -f - 2>&1 >> $LOGFILE
- done
+ restoreLabels $1
else
+ logit "Cleaning out /tmp"
+ rm -rf /tmp/.??* /tmp/*
if [ ! -z "$FILESYSTEMSRO" ]; then
logit "Warning: Skipping the following R/O filesystems:"
logit "$FILESYSTEMSRO"
@@ -180,7 +181,7 @@
restoreLabels $rpmFiles
fi
if [ $relabelFlag = 1 ]; then
- if [ $fullFlag = 1 ]; then
+ if [ $fullFlag = 1 -o ! -z "$rpmFiles" ]; then
relabel $rpmFiles
else
relabelCheck $rpmFiles

View File

@ -1,7 +1,7 @@
Summary: SELinux policy core utilities.
Name: policycoreutils
Version: 1.19.2
Release: 4
Version: 1.19.3
Release: 1
License: GPL
Group: System Environment/Base
Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
@ -76,6 +76,11 @@ rm -rf ${RPM_BUILD_ROOT}
%changelog
* Mon Jan 3 2005 Dan Walsh <dwalsh@redhat.com> 1.19.3-1
- Update to latest from NSA
* Merged fixfiles and restorecon patches from Dan Walsh.
* Don't display change if only user part changed.
* Mon Jan 3 2005 Dan Walsh <dwalsh@redhat.com> 1.19.2-4
- Fix fixfiles handling of rpm
- Fix restorecon to not warn on symlinks unless -v -v

View File

@ -1 +1 @@
20d84da78f1ed97a69e4e237bbed4769 policycoreutils-1.19.2.tgz
13d3b87256d977ed6a8ca3b4ad8b3b9a policycoreutils-1.19.3.tgz