diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index a416a8b..de4a812 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -1,6 +1,6 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.22/scripts/genhomedircon --- nsapolicycoreutils/scripts/genhomedircon 2005-03-08 14:03:05.000000000 -0500 -+++ policycoreutils-1.22/scripts/genhomedircon 2005-03-10 09:36:17.000000000 -0500 ++++ policycoreutils-1.22/scripts/genhomedircon 2005-03-10 14:10:15.000000000 -0500 @@ -40,15 +40,32 @@ # are always "real" (including root, in the default configuration). # @@ -57,6 +57,15 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po prefix = u[5][:string.rfind(u[5], "/")] if not prefixes.has_key(prefix): prefixes[prefix] = "" +@@ -92,7 +109,7 @@ + prefs["home"] = home + udict[user[1]] = prefs + except KeyError: +- 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 + + def update(filecontext, user, prefs): @@ -104,46 +121,108 @@ return rc @@ -102,7 +111,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + else: + #rc[0] == 256 means the file was there, we read it, but the grep didn't match + if rc[0] != 256: -+ sys.stderr.write("%s\n" % (rc[1],)) ++ sys.stderr.write("%s\n" % rc[1]) + sys.stderr.write("You do not have access to /etc/default/useradd HOME=\n") + sys.stderr.flush() + @@ -117,7 +126,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + prefixes[homedir] = "" + else: + if rc[0] != 256: -+ sys.stderr.write("%s\n" % (rc[1],)) ++ sys.stderr.write("%s\n" % rc[1]) + sys.stderr.write("You do not have access to /etc/libuser.conf LU_HOMEDIRECTORY=\n") + sys.stderr.flush() + @@ -138,7 +147,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + if rc[0] == 0: + prefix_regex = rc[1].split("\n") + else: -+ sys.stderr.write("%s\n" % (rc[1],)) ++ sys.stderr.write("%s\n" % rc[1]) + sys.stderr.write("You do not have access to grep/cut/the file contexts\n") + sys.stderr.flush() + for potential in potential_prefixes.keys(): @@ -205,7 +214,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po ############################################################################# # -@@ -152,203 +231,256 @@ +@@ -152,203 +231,258 @@ ############################################################################# def getDefaultHomeDir(): @@ -224,7 +233,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + else: + #rc[0] == 256 means the file was there, we read it, but the grep didn't match + if rc[0] != 256: -+ sys.stderr.write("%s\n" % (rc[1],)) ++ sys.stderr.write("%s\n" % rc[1]) + sys.stderr.write("You do not have access to /etc/default/useradd HOME=\n") + sys.stderr.flush() + rc=commands.getstatusoutput("grep -h '^LU_HOMEDIRECTORY' /etc/libuser.conf") @@ -237,9 +246,11 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + else: + #rc[0] == 256 means the file was there, we read it, but the grep didn't match + if rc[0] != 256: -+ sys.stderr.write("%s\n" % (rc[1],)) ++ sys.stderr.write("%s\n" % rc[1]) + sys.stderr.write("You do not have access to /etc/libuser.conf LU_HOMEDIRECTORY=\n") + sys.stderr.flush() ++ if ret == []: ++ ret.append("/home") + return ret def getSELinuxType(directory): @@ -260,7 +271,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po - sys.exit(1) - + if error != "": -+ sys.stderr.write("%s\n" % (error,)) ++ sys.stderr.write("%s\n" % error) + sys.stderr.write("Usage: %s [ -d selinuxdir ] [-n | --nopasswd] [-t selinuxtype ]\n" % sys.argv[0]) + sys.stderr.flush() + sys.exit(1) @@ -399,7 +410,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + prefs["home"] = home + udict[user[1]] = prefs + except KeyError: -+ 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 + + def getHomeDirContext(self, user, home, role): @@ -425,7 +436,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po + if rc[0] == 0: + prefix_regex = rc[1].split("\n") + else: -+ sys.stderr.write("%s\n" % (rc[1],)) ++ sys.stderr.write("%s\n" % rc[1]) + sys.stderr.write("You do not have access to grep/cut/the file contexts\n") + sys.stderr.flush() + exists=1 diff --git a/policycoreutils.spec b/policycoreutils.spec index 3f36fd4..37b10a5 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -3,7 +3,7 @@ Summary: SELinux policy core utilities. Name: policycoreutils Version: 1.22 -Release: 1 +Release: 2 License: GPL Group: System Environment/Base Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz @@ -81,7 +81,7 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sestatus.conf %changelog -* Thu Mar 10 2005 Dan Walsh 1.22-1 +* Thu Mar 10 2005 Dan Walsh 1.22-2 - Update to released version from NSA - Patch genhomedircon to handle passwd in different places.