* Thu Mar 10 2005 Dan Walsh <dwalsh@redhat.com> 1.22-2

- Update to released version from NSA
- Patch genhomedircon to handle passwd in different places.
This commit is contained in:
Daniel J Walsh 2005-03-10 19:27:18 +00:00
parent 69a80f1250
commit 407451201f
2 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,6 @@
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.22/scripts/genhomedircon 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 --- 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 @@ @@ -40,15 +40,32 @@
# are always "real" (including root, in the default configuration). # 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], "/")] prefix = u[5][:string.rfind(u[5], "/")]
if not prefixes.has_key(prefix): if not prefixes.has_key(prefix):
prefixes[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 @@ @@ -104,46 +121,108 @@
return rc return rc
@ -102,7 +111,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ else: + else:
+ #rc[0] == 256 means the file was there, we read it, but the grep didn't match + #rc[0] == 256 means the file was there, we read it, but the grep didn't match
+ if rc[0] != 256: + 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.write("You do not have access to /etc/default/useradd HOME=\n")
+ sys.stderr.flush() + sys.stderr.flush()
+ +
@ -117,7 +126,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ prefixes[homedir] = "" + prefixes[homedir] = ""
+ else: + else:
+ if rc[0] != 256: + 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.write("You do not have access to /etc/libuser.conf LU_HOMEDIRECTORY=\n")
+ sys.stderr.flush() + sys.stderr.flush()
+ +
@ -138,7 +147,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ if rc[0] == 0: + if rc[0] == 0:
+ prefix_regex = rc[1].split("\n") + prefix_regex = rc[1].split("\n")
+ else: + 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.write("You do not have access to grep/cut/the file contexts\n")
+ sys.stderr.flush() + sys.stderr.flush()
+ for potential in potential_prefixes.keys(): + 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(): def getDefaultHomeDir():
@ -224,7 +233,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ else: + else:
+ #rc[0] == 256 means the file was there, we read it, but the grep didn't match + #rc[0] == 256 means the file was there, we read it, but the grep didn't match
+ if rc[0] != 256: + 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.write("You do not have access to /etc/default/useradd HOME=\n")
+ sys.stderr.flush() + sys.stderr.flush()
+ rc=commands.getstatusoutput("grep -h '^LU_HOMEDIRECTORY' /etc/libuser.conf") + 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: + else:
+ #rc[0] == 256 means the file was there, we read it, but the grep didn't match + #rc[0] == 256 means the file was there, we read it, but the grep didn't match
+ if rc[0] != 256: + 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.write("You do not have access to /etc/libuser.conf LU_HOMEDIRECTORY=\n")
+ sys.stderr.flush() + sys.stderr.flush()
+ if ret == []:
+ ret.append("/home")
+ return ret + return ret
def getSELinuxType(directory): def getSELinuxType(directory):
@ -260,7 +271,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
- sys.exit(1) - sys.exit(1)
- -
+ if error != "": + 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.write("Usage: %s [ -d selinuxdir ] [-n | --nopasswd] [-t selinuxtype ]\n" % sys.argv[0])
+ sys.stderr.flush() + sys.stderr.flush()
+ sys.exit(1) + sys.exit(1)
@ -399,7 +410,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon po
+ prefs["home"] = home + prefs["home"] = home
+ udict[user[1]] = prefs + udict[user[1]] = prefs
+ except KeyError: + 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 + return udict
+ +
+ def getHomeDirContext(self, user, home, role): + 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: + if rc[0] == 0:
+ prefix_regex = rc[1].split("\n") + prefix_regex = rc[1].split("\n")
+ else: + 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.write("You do not have access to grep/cut/the file contexts\n")
+ sys.stderr.flush() + sys.stderr.flush()
+ exists=1 + exists=1

View File

@ -3,7 +3,7 @@
Summary: SELinux policy core utilities. Summary: SELinux policy core utilities.
Name: policycoreutils Name: policycoreutils
Version: 1.22 Version: 1.22
Release: 1 Release: 2
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
* Thu Mar 10 2005 Dan Walsh <dwalsh@redhat.com> 1.22-1 * Thu Mar 10 2005 Dan Walsh <dwalsh@redhat.com> 1.22-2
- Update to released version from NSA - Update to released version from NSA
- Patch genhomedircon to handle passwd in different places. - Patch genhomedircon to handle passwd in different places.