From 565fe97388fdb17124025f301b2c0335c2131488 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 20 Feb 2007 22:00:54 +0000 Subject: [PATCH] * Tue Feb 20 2007 Dan Walsh 2.0.2-3 - Updated newrole NONBlOCK patch --- policycoreutils-rhat.patch | 68 ++++++++++++++++++++++---------------- policycoreutils.spec | 5 ++- 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index debf7f0..03d6185 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -7,35 +7,6 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.0 --exclude=gui --exclude=po all install relabel clean indent: @for subdir in $(SUBDIRS); do \ -diff --exclude-from=exclude --exclude=sepolgen-1.0.0 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/newrole/newrole.c policycoreutils-2.0.1/newrole/newrole.c ---- nsapolicycoreutils/newrole/newrole.c 2007-01-24 10:03:59.000000000 -0500 -+++ policycoreutils-2.0.1/newrole/newrole.c 2007-02-15 15:16:09.000000000 -0500 -@@ -640,7 +640,7 @@ - } - - /* Re-open TTY descriptor */ -- fd = open(ttyn, O_RDWR); -+ fd = open(ttyn, O_RDWR|O_NONBLOCK); - if (fd < 0) { - fprintf(stderr, _("Error! Could not open %s.\n"), ttyn); - return fd; -@@ -1131,13 +1131,13 @@ - fprintf(stderr, _("Could not close descriptors.\n")); - goto err_close_pam; - } -- fd = open(ttyn, O_RDONLY); -+ fd = open(ttyn, O_RDONLY|O_NONBLOCK); - if (fd != 0) - goto err_close_pam; -- fd = open(ttyn, O_RDWR); -+ fd = open(ttyn, O_RDWR|O_NONBLOCK); - if (fd != 1) - goto err_close_pam; -- fd = open(ttyn, O_RDWR); -+ fd = open(ttyn, O_RDWR|O_NONBLOCK); - if (fd != 2) - goto err_close_pam; - diff --exclude-from=exclude --exclude=sepolgen-1.0.0 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/restorecond/restorecond.c policycoreutils-2.0.1/restorecond/restorecond.c --- nsapolicycoreutils/restorecond/restorecond.c 2006-11-16 17:14:28.000000000 -0500 +++ policycoreutils-2.0.1/restorecond/restorecond.c 2007-02-15 15:16:09.000000000 -0500 @@ -281,3 +252,42 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.0 --exclude=gui --exclude=po if len(roles) != 0: for r in rlist: +diff --exclude-from=exclude --exclude=sepolgen-1.0.0 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/newrole/newrole.c policycoreutils-2.0.1/newrole/newrole.c +--- nsapolicycoreutils/newrole/newrole.c 2007-01-24 10:03:59.000000000 -0500 ++++ policycoreutils-2.0.1/newrole/newrole.c 2007-02-15 15:16:09.000000000 -0500 +@@ -636,11 +636,12 @@ static int relabel_tty(const char *ttyn, + } + + /* Re-open TTY descriptor */ +- fd = open(ttyn, O_RDWR); ++ fd = open(ttyn, O_RDWR|O_NONBLOCK); + if (fd < 0) { + fprintf(stderr, _("Error! Could not open %s.\n"), ttyn); + return fd; + } ++ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); + + if (fgetfilecon(fd, &tty_con) < 0) { + fprintf(stderr, _("%s! Could not get current context " +@@ -1127,15 +1128,18 @@ int main(int argc, char *argv[]) + fprintf(stderr, _("Could not close descriptors.\n")); + goto err_close_pam; + } +- fd = open(ttyn, O_RDONLY); ++ fd = open(ttyn, O_RDONLY|O_NONBLOCK); + if (fd != 0) + goto err_close_pam; +- fd = open(ttyn, O_RDWR); ++ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); ++ fd = open(ttyn, O_RDWR|O_NONBLOCK); + if (fd != 1) + goto err_close_pam; +- fd = open(ttyn, O_RDWR); ++ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); ++ fd = open(ttyn, O_RDWR|O_NONBLOCK); + if (fd != 2) + goto err_close_pam; ++ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); + + /* + * Step 5: Execute a new shell with the new context in `new_context'. diff --git a/policycoreutils.spec b/policycoreutils.spec index 52cfd4d..556c9f8 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -6,7 +6,7 @@ Summary: SELinux policy core utilities. Name: policycoreutils Version: 2.0.2 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL Group: System Environment/Base Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz @@ -181,6 +181,9 @@ fi /usr/bin/sepolgen-ifgen > /dev/null %changelog +* Tue Feb 20 2007 Dan Walsh 2.0.2-3 +- Updated newrole NONBlOCK patch + * Tue Feb 20 2007 Dan Walsh 2.0.2-2 - Remove Requires: %{name}-plugins