* Mon Jan 10 2005 Dan Walsh <dwalsh@redhat.com> 1.20.1-2

- Fix restorecon segfault
This commit is contained in:
Daniel J Walsh 2005-01-10 18:18:41 +00:00
parent fc11f85f43
commit a52deb4d72
2 changed files with 14 additions and 37 deletions

View File

@ -1,38 +1,11 @@
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/restorecon/restorecon.c policycoreutils-1.19.2/restorecon/restorecon.c
--- 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->%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);
--- policycoreutils-1.20.1/restorecon/restorecon.c.rhat 2005-01-07 09:43:00.000000000 -0500
+++ policycoreutils-1.20.1/restorecon/restorecon.c 2005-01-10 13:18:06.742707066 -0500
@@ -146,7 +146,7 @@
if (verbose > 1 ||
!only_changed_user(scontext, prev_context))
fprintf(stderr,"%s reset context %s:%s->%s\n",
- progname, filename, prev_context, scontext);
+ progname, filename, (retcontext >= 0 ? prev_context : ""), scontext);
}
if (retcontext >= 0)
freecon(prev_context);

View File

@ -1,10 +1,11 @@
Summary: SELinux policy core utilities.
Name: policycoreutils
Version: 1.20.1
Release: 1
Release: 2
License: GPL
Group: System Environment/Base
Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
Patch: policycoreutils-rhat.patch
Prefix: %{_prefix}
BuildRequires: libselinux-devel >= 1.15.3 pam-devel libsepol-devel >= 1.1.1
@ -31,7 +32,7 @@ context.
%prep
%setup -q
%patch -p1 -b .rhat
%build
make CFLAGS="%{optflags}" all
@ -74,6 +75,9 @@ rm -rf ${RPM_BUILD_ROOT}
%changelog
* Mon Jan 10 2005 Dan Walsh <dwalsh@redhat.com> 1.20.1-2
- Fix restorecon segfault
* Mon Jan 3 2005 Dan Walsh <dwalsh@redhat.com> 1.20.1-1
- Update to latest from NSA
* Merged fixfiles rewrite from Dan Walsh.