From a52deb4d72cc780c3e21f394d35ccb36cc474006 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 10 Jan 2005 18:18:41 +0000 Subject: [PATCH] * Mon Jan 10 2005 Dan Walsh 1.20.1-2 - Fix restorecon segfault --- policycoreutils-rhat.patch | 43 +++++++------------------------------- policycoreutils.spec | 8 +++++-- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index 10736ab..c5be15a 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -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); diff --git a/policycoreutils.spec b/policycoreutils.spec index 6c830f5..bf087eb 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -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 1.20.1-2 +- Fix restorecon segfault + * Mon Jan 3 2005 Dan Walsh 1.20.1-1 - Update to latest from NSA * Merged fixfiles rewrite from Dan Walsh.