From 27712930f021672951b352b274c49bcc49787fe6 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 20 Apr 2007 18:01:26 +0000 Subject: [PATCH] * Fri Apr 20 2007 Dan Walsh 2.0.9-10 - Fix genhomedircon to handle non user_u for the default user --- policycoreutils-rhat.patch | 66 ++++++++++++++++++++++++++++++++++++-- policycoreutils.spec | 5 ++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index ac8e0a0..48a0975 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -200,7 +200,7 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-2.0.9/scripts/genhomedircon --- nsapolicycoreutils/scripts/genhomedircon 2006-11-28 09:24:33.000000000 -0500 -+++ policycoreutils-2.0.9/scripts/genhomedircon 2007-04-16 13:26:34.000000000 -0400 ++++ policycoreutils-2.0.9/scripts/genhomedircon 2007-04-20 13:58:01.000000000 -0400 @@ -26,6 +26,7 @@ import sys, os, pwd, string, getopt, re @@ -209,7 +209,41 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po import gettext gettext.install('policycoreutils') -@@ -249,7 +250,10 @@ +@@ -135,6 +136,9 @@ + self.contextdir = "/contexts" + self.filecontextdir = self.contextdir+"/files" + self.usepwd = usepwd ++ self.default_user = "user_u" ++ self.default_prefix = "user" ++ self.users = self.getUsers() + + def getFileContextDir(self): + return self.selinuxdir+self.type+self.filecontextdir +@@ -211,6 +215,10 @@ + prefs["prefix"] = prefix + prefs["home"] = home + udict[user] = prefs ++ ++ def setDefaultUser(self, user, prefix): ++ self.default_user = user ++ self.default_prefix = prefix + + def getUsers(self): + udict = {} +@@ -219,7 +227,11 @@ + for seuser in list: + user = [] + seusername = semanage_seuser_get_sename(seuser) +- self.adduser(udict, semanage_seuser_get_name(seuser), seusername, self.get_default_prefix(seusername)) ++ prefix = self.get_default_prefix(seusername) ++ if semanage_seuser_get_name(seuser) == "__default__": ++ self.setDefaultUser(seusername, prefix) ++ ++ self.adduser(udict, semanage_seuser_get_name(seuser), seusername, prefix) + + else: + try: +@@ -249,7 +261,10 @@ i = i.replace("HOME_DIR", home) i = i.replace("ROLE", prefix) i = i.replace("system_u", seuser) @@ -221,6 +255,34 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po fd.close() return ret +@@ -266,12 +281,11 @@ + return ret + + def genHomeDirContext(self): +- users = self.getUsers() + ret = "" + # Fill in HOME and prefix for users that are defined +- for u in users.keys(): +- ret += self.getHomeDirContext (u, users[u]["seuser"], users[u]["home"], users[u]["prefix"]) +- ret += self.getUserContext (u, users[u]["seuser"], users[u]["prefix"]) ++ for u in self.users.keys(): ++ ret += self.getHomeDirContext (u, self.users[u]["seuser"], self.users[u]["home"], self.users[u]["prefix"]) ++ ret += self.getUserContext (u, self.users[u]["seuser"], self.users[u]["prefix"]) + return ret+"\n" + + def checkExists(self, home): +@@ -318,9 +332,9 @@ + def genoutput(self): + ret = self.heading() + for h in self.getHomeDirs(): +- ret += self.getHomeDirContext ("user_u", "user_u" , h+'/[^/]*', "user") ++ ret += self.getHomeDirContext (self.default_user, self.default_user, h+'/[^/]*', self.default_prefix) + ret += self.getHomeRootContext(h) +- ret += self.getUserContext(".*", "user_u", "user") + "\n" ++ ret += self.getUserContext(".*", self.default_user, self.default_prefix) + "\n" + ret += self.genHomeDirContext() + return ret + diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/semanage/seobject.py policycoreutils-2.0.9/semanage/seobject.py --- nsapolicycoreutils/semanage/seobject.py 2007-04-12 12:43:06.000000000 -0400 +++ policycoreutils-2.0.9/semanage/seobject.py 2007-04-16 13:26:34.000000000 -0400 diff --git a/policycoreutils.spec b/policycoreutils.spec index d7f5e12..ed06812 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -6,7 +6,7 @@ Summary: SELinux policy core utilities. Name: policycoreutils Version: 2.0.9 -Release: 9%{?dist} +Release: 10%{?dist} License: GPL Group: System Environment/Base Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz @@ -192,6 +192,9 @@ if [ "$1" -ge "1" ]; then fi %changelog +* Fri Apr 20 2007 Dan Walsh 2.0.9-10 +- Fix genhomedircon to handle non user_u for the default user + * Wed Apr 18 2007 Dan Walsh 2.0.9-9 - More cleanups for gui