From 7e64d5bb547e06ee0f4f4eed0182c5eeb5ee0998 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Dec 20 2005 11:35:21 +0000 Subject: * Tue Dec 20 2005 Dan Walsh 1.29.2-4 - Add try catch for files that may not exists * Mon Dec 19 2005 Dan Walsh 1.29.2-3 - Remove commands from genhomedircon for installer --- diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index 494f183..6a27307 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -1,7 +1,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.29.2/scripts/genhomedircon --- nsapolicycoreutils/scripts/genhomedircon 2005-12-07 07:28:00.000000000 -0500 -+++ policycoreutils-1.29.2/scripts/genhomedircon 2005-12-19 18:17:05.000000000 -0500 -@@ -26,64 +26,70 @@ ++++ policycoreutils-1.29.2/scripts/genhomedircon 2005-12-20 06:32:04.000000000 -0500 +@@ -26,64 +26,73 @@ # # @@ -25,16 +25,19 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + +def findval(file, var, delim=""): + val="" -+ fd=open(file, 'r') -+ for i in fd.read().split('\n'): -+ if i.startswith(var) == 1: -+ if delim == "": -+ val = i.split()[1] -+ else: -+ val = i.split(delim)[1] -+ val = val.split("#")[0] -+ val = val.strip() -+ fd.close() ++ try: ++ fd=open(file, 'r') ++ for i in fd.read().split('\n'): ++ if i.startswith(var) == 1: ++ if delim == "": ++ val = i.split()[1] ++ else: ++ val = i.split(delim)[1] ++ val = val.split("#")[0] ++ val = val.strip() ++ fd.close() ++ except: ++ val="" + return val def getStartingUID(): @@ -110,7 +113,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po return "targeted" def usage(error = ""): -@@ -129,11 +135,17 @@ +@@ -129,11 +138,17 @@ return self.getFileContextDir()+"/homedir_template" def getHomeRootContext(self, homedir): @@ -133,7 +136,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po def heading(self): ret = "\n#\n#\n# User-specific file contexts, generated via %s\n" % sys.argv[0] -@@ -152,32 +164,40 @@ +@@ -152,32 +167,40 @@ return "user_r" return name def getOldRole(self, role): @@ -190,7 +193,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po def getUsers(self): udict = {} -@@ -190,30 +210,45 @@ +@@ -190,30 +213,45 @@ self.adduser(udict, semanage_seuser_get_name(seuser), seusername, self.defaultrole(seusername)) else: @@ -252,7 +255,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po warning("genhomedircon: Warning! No support yet for expanding ROLE macros in the %s file when using libsemanage." % self.getHomeDirTemplate()); warning("genhomedircon: You must manually update file_contexts.homedirs for any non-user_r users (including root)."); users = self.getUsers() -@@ -225,40 +260,23 @@ +@@ -225,40 +263,23 @@ return ret+"\n" def checkExists(self, home): @@ -308,7 +311,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po starting_uid=getStartingUID() if self.usepwd==0: return homedirs -@@ -270,7 +288,7 @@ +@@ -270,7 +291,7 @@ string.count(u[5], "/") > 1: homedir = u[5][:string.rfind(u[5], "/")] if not homedir in homedirs: @@ -317,7 +320,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po warning("%s homedir %s or its parent directoy conflicts with a\ndefined context in %s,\n%s will not create a new context." % (u[0], u[5], self.getFileContextFile(), sys.argv[0])) else: homedirs.append(homedir) -@@ -336,4 +354,4 @@ +@@ -336,4 +357,4 @@ except ValueError, error: errorExit("ValueError %s" % error) except IndexError, error: diff --git a/policycoreutils.spec b/policycoreutils.spec index 861039d..41f3a88 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -4,7 +4,7 @@ Summary: SELinux policy core utilities. Name: policycoreutils Version: 1.29.2 -Release: 3 +Release: 4 License: GPL Group: System Environment/Base Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz @@ -96,7 +96,10 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sestatus.conf %changelog -* Wed Dec 14 2005 Dan Walsh 1.29.2-3 +* Tue Dec 20 2005 Dan Walsh 1.29.2-4 +- Add try catch for files that may not exists + +* Mon Dec 19 2005 Dan Walsh 1.29.2-3 - Remove commands from genhomedircon for installer * Wed Dec 14 2005 Dan Walsh 1.29.2-1