* Mon Nov 14 2005 Dan Walsh <dwalsh@redhat.com> 1.27.27-5

- Fix genhomedircon to work with non libsemanage systems
This commit is contained in:
Daniel J Walsh 2005-11-14 18:59:33 +00:00
parent 7fb8345697
commit e27699418d
2 changed files with 17 additions and 16 deletions

View File

@ -1,6 +1,6 @@
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.27.27/scripts/genhomedircon diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.27.27/scripts/genhomedircon
--- nsapolicycoreutils/scripts/genhomedircon 2005-09-12 16:33:30.000000000 -0400 --- nsapolicycoreutils/scripts/genhomedircon 2005-09-12 16:33:30.000000000 -0400
+++ policycoreutils-1.27.27/scripts/genhomedircon 2005-11-14 12:58:49.000000000 -0500 +++ policycoreutils-1.27.27/scripts/genhomedircon 2005-11-14 13:56:01.000000000 -0500
@@ -15,32 +15,19 @@ @@ -15,32 +15,19 @@
# The file CONTEXTDIR/files/homedir_template exists. This file is used to # The file CONTEXTDIR/files/homedir_template exists. This file is used to
# set up the home directory context for each real user. # set up the home directory context for each real user.
@ -220,22 +220,23 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
self.type=type self.type=type
self.selinuxdir=selinuxdir +"/" self.selinuxdir=selinuxdir +"/"
self.contextdir="/contexts" self.contextdir="/contexts"
@@ -313,47 +142,70 @@ @@ -312,48 +141,68 @@
else:
errorExit(string.join("sed error ", rc[1])) errorExit(string.join("sed error ", rc[1]))
def getUsersFile(self): - def getUsersFile(self):
- return self.selinuxdir+self.type+"/users/local.users" - return self.selinuxdir+self.type+"/users/local.users"
+ if self.semanaged: -
+ return self.selinuxdir+self.type+"module/active/seusers"
+ else:
+ return self.selinuxdir+self.type+"/seusers"
- def getSystemUsersFile(self): - def getSystemUsersFile(self):
- return self.selinuxdir+self.type+"/users/system.users" - return self.selinuxdir+self.type+"/users/system.users"
- -
def heading(self): def heading(self):
ret = "\n#\n#\n# User-specific file contexts, generated via %s\n" % sys.argv[0] ret = "\n#\n#\n# User-specific file contexts, generated via %s\n" % sys.argv[0]
ret += "# edit %s to change file_context\n#\n#\n" % self.getUsersFile() - ret += "# edit %s to change file_context\n#\n#\n" % self.getUsersFile()
+ if self.semanaged:
+ ret += "# use seusers command to manage system users in order to change the file_context\n#\n#\n"
+ else:
+ ret += "# edit %s to change file_context\n#\n#\n" % self.selinuxdir+self.type+"/seusers"
return ret return ret
+ +
@ -292,7 +293,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ self.adduser(udict, semanage_seuser_get_name(seuser), seusername, self.defaultrole(seusername)) + self.adduser(udict, semanage_seuser_get_name(seuser), seusername, self.defaultrole(seusername))
+ +
+ else: + else:
+ rc = commands.getstatusoutput("grep -v '^ *#' %s" % self.getUsersFile()) + rc = commands.getstatusoutput("grep -v '^ *#' %s" % self.selinuxdir+self.type+"/seusers")
+ if rc[0] == 0 and rc[1] != "": + if rc[0] == 0 and rc[1] != "":
+ ulist = rc[1].split("\n") + ulist = rc[1].split("\n")
+ for u in ulist: + for u in ulist:
@ -317,12 +318,12 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ if user[0] == "root": + if user[0] == "root":
+ role="user" + role="user"
+ else: + else:
+ role=user[0] + role=user[1]
+ self.adduser(udict, user[0], user[1], role) + self.adduser(udict, user[0], user[1], role)
return udict return udict
def getHomeDirContext(self, user, home, role): def getHomeDirContext(self, user, home, role):
@@ -362,9 +214,8 @@ @@ -362,9 +211,8 @@
return ret + rc[1] + "\n" return ret + rc[1] + "\n"
def getUserContext(self, user, sel_user, role): def getUserContext(self, user, sel_user, role):
@ -333,7 +334,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
def genHomeDirContext(self): def genHomeDirContext(self):
users = self.getUsers() users = self.getUsers()
@@ -478,10 +329,6 @@ @@ -478,10 +326,6 @@
if type==None: if type==None:
type=getSELinuxType(directory) type=getSELinuxType(directory)

View File

@ -3,7 +3,7 @@
Summary: SELinux policy core utilities. Summary: SELinux policy core utilities.
Name: policycoreutils Name: policycoreutils
Version: 1.27.27 Version: 1.27.27
Release: 4 Release: 5
License: GPL License: GPL
Group: System Environment/Base Group: System Environment/Base
Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
@ -88,7 +88,7 @@ rm -rf ${RPM_BUILD_ROOT}
%config(noreplace) %{_sysconfdir}/sestatus.conf %config(noreplace) %{_sysconfdir}/sestatus.conf
%changelog %changelog
* Mon Nov 14 2005 Dan Walsh <dwalsh@redhat.com> 1.27.27-4 * Mon Nov 14 2005 Dan Walsh <dwalsh@redhat.com> 1.27.27-5
- Fix genhomedircon to work with non libsemanage systems - Fix genhomedircon to work with non libsemanage systems
* Fri Nov 11 2005 Dan Walsh <dwalsh@redhat.com> 1.27.27-3 * Fri Nov 11 2005 Dan Walsh <dwalsh@redhat.com> 1.27.27-3