* Fri Feb 11 2005 Dan Walsh <dwalsh@redhat.com> 1.21.15-7
- Fix genhomedircon regular expression
This commit is contained in:
parent
5e0b9272b3
commit
b26d374a91
@ -1,7 +1,7 @@
|
|||||||
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.21.15/scripts/genhomedircon
|
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.21.15/scripts/genhomedircon
|
||||||
--- nsapolicycoreutils/scripts/genhomedircon 2005-01-28 11:16:36.000000000 -0500
|
--- nsapolicycoreutils/scripts/genhomedircon 2005-01-28 11:16:36.000000000 -0500
|
||||||
+++ policycoreutils-1.21.15/scripts/genhomedircon 2005-02-11 08:22:00.000000000 -0500
|
+++ policycoreutils-1.21.15/scripts/genhomedircon 2005-02-11 15:06:35.000000000 -0500
|
||||||
@@ -13,38 +13,109 @@
|
@@ -13,38 +13,116 @@
|
||||||
#
|
#
|
||||||
# ASSUMPTIONS:
|
# ASSUMPTIONS:
|
||||||
#
|
#
|
||||||
@ -77,6 +77,10 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
+ sys.stderr.flush()
|
+ sys.stderr.flush()
|
||||||
+ sys.exit(1)
|
+ sys.exit(1)
|
||||||
+
|
+
|
||||||
|
+def warning(warning = ""):
|
||||||
|
+ sys.stderr.write("%s\n" % warning)
|
||||||
|
+ sys.stderr.flush()
|
||||||
|
+
|
||||||
+def errorExit(error):
|
+def errorExit(error):
|
||||||
+ sys.stderr.write("%s exiting for: " % sys.argv[0])
|
+ sys.stderr.write("%s exiting for: " % sys.argv[0])
|
||||||
+ sys.stderr.write("%s\n" % error)
|
+ sys.stderr.write("%s\n" % error)
|
||||||
@ -102,14 +106,17 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
+ def getFileContextDir(self):
|
+ def getFileContextDir(self):
|
||||||
+ return self.selinuxdir+self.getSelinuxType()+self.filecontextdir
|
+ return self.selinuxdir+self.getSelinuxType()+self.filecontextdir
|
||||||
+
|
+
|
||||||
|
+ def getFileContextFile(self):
|
||||||
|
+ return self.getFileContextDir()+"/file_contexts"
|
||||||
|
+
|
||||||
+ def getContextDir(self):
|
+ def getContextDir(self):
|
||||||
+ return self.selinuxdir+self.getSelinuxType()+self.contextdir
|
+ return self.selinuxdir+self.getSelinuxType()+self.contextdir
|
||||||
+
|
+
|
||||||
+ def getHomeDirTemplate(self):
|
+ def getHomeDirTemplate(self):
|
||||||
+ return self.getFileContextDir()+"/homedir_template"
|
+ return self.getFileContextDir()+"/homedir_template"
|
||||||
+
|
+
|
||||||
+ def getHomeRootContext(self):
|
+ def getHomeRootContext(self, homedir):
|
||||||
+ rc=commands.getstatusoutput("grep HOME_ROOT %s | sed -e \"s|^HOME_ROOT|%s|\"" % ( self.getHomeDirTemplate(), getDefaultHomeDir()))
|
+ rc=commands.getstatusoutput("grep HOME_ROOT %s | sed -e \"s|^HOME_ROOT|%s|\"" % ( self.getHomeDirTemplate(), homedir))
|
||||||
+ if rc[0] == 0:
|
+ if rc[0] == 0:
|
||||||
+ return rc[1]
|
+ return rc[1]
|
||||||
+ else:
|
+ else:
|
||||||
@ -131,7 +138,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
if rc[0] == 0:
|
if rc[0] == 0:
|
||||||
ulist = rc[1].strip().split("\n")
|
ulist = rc[1].strip().split("\n")
|
||||||
for u in ulist:
|
for u in ulist:
|
||||||
@@ -68,72 +139,90 @@
|
@@ -68,72 +146,96 @@
|
||||||
sys.stderr.write("The user \"%s\" is not present in the passwd file, skipping...\n" % (user[1],))
|
sys.stderr.write("The user \"%s\" is not present in the passwd file, skipping...\n" % (user[1],))
|
||||||
return udict
|
return udict
|
||||||
|
|
||||||
@ -199,10 +206,9 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
-
|
-
|
||||||
+ def getHomeDirContext(self, user, home, role):
|
+ def getHomeDirContext(self, user, home, role):
|
||||||
+ ret="\n\n#\n# Context for user %s\n#\n\n" % user
|
+ ret="\n\n#\n# Context for user %s\n#\n\n" % user
|
||||||
+ rc=commands.getstatusoutput("grep -e '^HOME_DIR' %s | sed -e 's|HOME_DIR|%s|' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (self.getHomeDirTemplate(), home, role, user))
|
+ rc=commands.getstatusoutput("grep '^HOME_DIR' %s | sed -e 's|HOME_DIR|%s|' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (self.getHomeDirTemplate(), home, role, user))
|
||||||
+ return ret + rc[1] + "\n"
|
+ return ret + rc[1] + "\n"
|
||||||
+
|
+
|
||||||
+
|
|
||||||
+ def genHomeDirContext(self):
|
+ def genHomeDirContext(self):
|
||||||
+ users = self.getUsers()
|
+ users = self.getUsers()
|
||||||
+ ret=""
|
+ ret=""
|
||||||
@ -212,6 +218,9 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
+ ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"])
|
+ ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"])
|
||||||
+ return ret
|
+ return ret
|
||||||
+
|
+
|
||||||
|
+ def checkExists(self, home):
|
||||||
|
+ return commands.getstatusoutput("grep -E '^%s[^[:alnum:]_-]' %s" % (home, self.getFileContextFile()))[0]
|
||||||
|
+
|
||||||
+ def getHomeDirs(self):
|
+ def getHomeDirs(self):
|
||||||
+ homedirs = []
|
+ homedirs = []
|
||||||
+ homedirs.append(getDefaultHomeDir())
|
+ homedirs.append(getDefaultHomeDir())
|
||||||
@ -226,6 +235,9 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
+ string.count(u[5], "/") > 1:
|
+ string.count(u[5], "/") > 1:
|
||||||
+ homedir = u[5][:string.rfind(u[5], "/")]
|
+ homedir = u[5][:string.rfind(u[5], "/")]
|
||||||
+ if not homedir in homedirs:
|
+ if not homedir in homedirs:
|
||||||
|
+ if self.checkExists(homedir)==0:
|
||||||
|
+ warning("%s is already defined in %s,\n%s will not create a new context." % (homedir, self.getFileContextFile(), sys.argv[0]))
|
||||||
|
+ else:
|
||||||
+ homedirs.append(homedir)
|
+ homedirs.append(homedir)
|
||||||
+
|
+
|
||||||
+ homedirs.sort()
|
+ homedirs.sort()
|
||||||
@ -233,9 +245,10 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
|
|||||||
+
|
+
|
||||||
+ def genoutput(self):
|
+ def genoutput(self):
|
||||||
+ ret= self.heading()
|
+ ret= self.heading()
|
||||||
+ ret += self.getHomeRootContext()
|
|
||||||
+ for h in self.getHomeDirs():
|
+ for h in self.getHomeDirs():
|
||||||
+ ret += self.getHomeDirContext ("user_u" , h+'/[^/]*', "user")
|
+ ret += self.getHomeDirContext ("user_u" , h+'/[^/]*', "user")
|
||||||
|
+ ret += "\n"
|
||||||
|
+ ret += self.getHomeRootContext(h)
|
||||||
+ ret += self.genHomeDirContext()
|
+ ret += self.genHomeDirContext()
|
||||||
+ return ret
|
+ return ret
|
||||||
+
|
+
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
%define libselinuxver 1.21.9-2
|
un%define libselinuxver 1.21.9-2
|
||||||
Summary: SELinux policy core utilities.
|
Summary: SELinux policy core utilities.
|
||||||
Name: policycoreutils
|
Name: policycoreutils
|
||||||
Version: 1.21.15
|
Version: 1.21.15
|
||||||
Release: 6
|
Release: 7
|
||||||
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
|
||||||
@ -81,7 +81,7 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%config(noreplace) %{_sysconfdir}/sestatus.conf
|
%config(noreplace) %{_sysconfdir}/sestatus.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Feb 11 2005 Dan Walsh <dwalsh@redhat.com> 1.21.15-6
|
* Fri Feb 11 2005 Dan Walsh <dwalsh@redhat.com> 1.21.15-7
|
||||||
- Fix genhomedircon regular expression
|
- Fix genhomedircon regular expression
|
||||||
|
|
||||||
* Thu Feb 10 2005 Dan Walsh <dwalsh@redhat.com> 1.21.15-5
|
* Thu Feb 10 2005 Dan Walsh <dwalsh@redhat.com> 1.21.15-5
|
||||||
|
Loading…
Reference in New Issue
Block a user