7238655897
- Fix genhomedircon to work in installer - Update to match NSA * Merged patch for chcat script from Dan Walsh.
65 lines
2.0 KiB
Diff
65 lines
2.0 KiB
Diff
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.29.1/scripts/genhomedircon
|
|
--- nsapolicycoreutils/scripts/genhomedircon 2005-12-07 07:28:00.000000000 -0500
|
|
+++ policycoreutils-1.29.1/scripts/genhomedircon 2005-12-14 14:12:00.000000000 -0500
|
|
@@ -29,11 +29,14 @@
|
|
import commands, sys, os, pwd, string, getopt, re
|
|
from semanage import *;
|
|
|
|
-fd=open("/etc/shells", 'r')
|
|
-VALID_SHELLS=fd.read().split('\n')
|
|
-fd.close()
|
|
-if "/sbin/nologin" in VALID_SHELLS:
|
|
- VALID_SHELLS.remove("/sbin/nologin")
|
|
+try:
|
|
+ fd=open("/etc/shells", 'r')
|
|
+ VALID_SHELLS=fd.read().split('\n')
|
|
+ fd.close()
|
|
+ if "/sbin/nologin" in VALID_SHELLS:
|
|
+ VALID_SHELLS.remove("/sbin/nologin")
|
|
+except:
|
|
+ VALID_SHELLS = ['/bin/sh', '/bin/bash', '/bin/ash', '/bin/bsh', '/bin/ksh', '/usr/bin/ksh', '/usr/bin/pdksh', '/bin/tcsh', '/bin/csh', '/bin/zsh']
|
|
|
|
def getStartingUID():
|
|
starting_uid = sys.maxint
|
|
@@ -163,21 +166,29 @@
|
|
return role
|
|
|
|
def adduser(self, udict, user, seuser, role):
|
|
+ if seuser == "user_u" or user == "__default__":
|
|
+ return
|
|
+ # !!! chooses first role in the list to use in the file context !!!
|
|
+ if role[-2:] == "_r" or role[-2:] == "_u":
|
|
+ role = role[:-2]
|
|
try:
|
|
- if seuser == "user_u" or user == "__default__":
|
|
- return
|
|
- # !!! chooses first role in the list to use in the file context !!!
|
|
- if role[-2:] == "_r" or role[-2:] == "_u":
|
|
- role = role[:-2]
|
|
home = pwd.getpwnam(user)[5]
|
|
if home == "/":
|
|
- return
|
|
- prefs = {}
|
|
- prefs["role"] = role
|
|
- prefs["home"] = home
|
|
- udict[seuser] = prefs
|
|
+ # Probably install so hard code to /root
|
|
+ if user == "root":
|
|
+ home="/root"
|
|
+ else:
|
|
+ return
|
|
except KeyError:
|
|
- sys.stderr.write("The user \"%s\" is not present in the passwd file, skipping...\n" % user)
|
|
+ if user == "root":
|
|
+ home = "/root"
|
|
+ else:
|
|
+ sys.stderr.write("The user \"%s\" is not present in the passwd file, skipping...\n" % user)
|
|
+ return
|
|
+ prefs = {}
|
|
+ prefs["role"] = role
|
|
+ prefs["home"] = home
|
|
+ udict[seuser] = prefs
|
|
|
|
def getUsers(self):
|
|
udict = {}
|