From 87889760442d0e1651a942f64721958373ecd992 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 24 Feb 2005 18:23:58 +0000 Subject: [PATCH] * Thu Feb 23 2005 Dan Walsh 1.21.19-3 - Fix genhomedircon to handle root --- policycoreutils-rhat.patch | 34 ++++++++++++++++++++++++++++++---- policycoreutils.spec | 5 ++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index e058b73..390d572 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -14,7 +14,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/fixfiles policyc } diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.21.19/scripts/genhomedircon --- nsapolicycoreutils/scripts/genhomedircon 2005-02-17 14:28:23.000000000 -0500 -+++ policycoreutils-1.21.19/scripts/genhomedircon 2005-02-23 09:33:26.000000000 -0500 ++++ policycoreutils-1.21.19/scripts/genhomedircon 2005-02-24 13:20:09.000000000 -0500 @@ -154,13 +154,13 @@ def getDefaultHomeDir(): rc=commands.getstatusoutput("grep ^HOME= /etc/default/useradd | tail -1") @@ -31,7 +31,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po return "targeted" def usage(error = ""): -@@ -203,7 +203,7 @@ +@@ -203,13 +203,15 @@ def getHomeRootContext(self, homedir): rc=commands.getstatusoutput("grep HOME_ROOT %s | sed -e \"s|^HOME_ROOT|%s|\"" % ( self.getHomeDirTemplate(), homedir)) if rc[0] == 0: @@ -40,7 +40,33 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po else: errorExit(string.join("sed error ", rc[1])) -@@ -254,7 +254,7 @@ + def getUsersFile(self): + return self.selinuxdir+self.type+"/users/local.users" + ++ def getSystemUsersFile(self): ++ return self.selinuxdir+self.type+"/users/system.users" + + def heading(self): + ret = "\n#\n#\n# User-specific file contexts, generated via %s\n" % sys.argv[0] +@@ -217,11 +219,16 @@ + return ret + + def getUsers(self): ++ users="" ++ rc = commands.getstatusoutput('grep "^user.*root" %s' % self.getSystemUsersFile()) ++ if rc[0] == 0: ++ users+=rc[1]+"\n" + rc = commands.getstatusoutput("grep ^user %s" % self.getUsersFile()) + udict = {} + prefs = {} + if rc[0] == 0: +- ulist = rc[1].strip().split("\n") ++ users+=rc[1] ++ ulist = users.split("\n") + for u in ulist: + user = u.split() + try: +@@ -254,7 +261,7 @@ # Fill in HOME and ROLE for users that are defined for u in users.keys(): ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"]) @@ -49,7 +75,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po def checkExists(self, home): return commands.getstatusoutput("grep -E '^%s[^[:alnum:]_-]' %s" % (home, self.getFileContextFile()))[0] -@@ -285,7 +285,6 @@ +@@ -285,7 +292,6 @@ ret= self.heading() for h in self.getHomeDirs(): ret += self.getHomeDirContext ("user_u" , h+'/[^/]*', "user") diff --git a/policycoreutils.spec b/policycoreutils.spec index 12f80b6..7bb2f9d 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -3,7 +3,7 @@ Summary: SELinux policy core utilities. Name: policycoreutils Version: 1.21.19 -Release: 2 +Release: 3 License: GPL Group: System Environment/Base Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz @@ -82,6 +82,9 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sestatus.conf %changelog +* Thu Feb 23 2005 Dan Walsh 1.21.19-3 +- Fix genhomedircon to handle root + * Wed Feb 23 2005 Dan Walsh 1.21.19-2 - Fix genhomedircon to handle spaces in SELINUXPOLICYTYPE