Blob Blame History Raw
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.29.15/scripts/genhomedircon
--- nsapolicycoreutils/scripts/genhomedircon	2006-01-27 20:35:37.000000000 -0500
+++ policycoreutils-1.29.15/scripts/genhomedircon	2006-01-30 11:49:16.000000000 -0500
@@ -38,6 +38,17 @@
 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 grep(file, var):
+	ret=""
+	fd=open(file, 'r')
+
+	for i in  fd.read().split('\n'):
+	    if re.search(var, i, 0) != None:
+	        ret=i
+                break
+	fd.close()
+	return ret
+
 def findval(file, var, delim=""):
 	val=""
 	try:
@@ -87,6 +98,12 @@
 	
 	if ret == []:
 		ret.append("/home")
+
+	# Add /export/home if it exists
+	# Some customers use this for automounted homedirs
+	if os.path.exists("/export/home"):
+		ret.append("/export/home")
+
 	return ret
 
 def getSELinuxType(directory):
@@ -168,9 +185,9 @@
 					return "user_r"
 		return name
 	def getOldRole(self, role):
-		rc=findval(self.selinuxdir+self.type+"/users/system.users", 'grep "^user %s"' % role, "=")
+		rc=grep(self.selinuxdir+self.type+"/users/system.users", "^user %s" % role)
 		if rc == "":					    
-			rc=findval(self.selinuxdir+self.type+"/users/local.users", 'grep "^user %s"' % role, "=")
+			rc=grep(self.selinuxdir+self.type+"/users/local.users", "^user %s" % role)
 		if rc != "":
 			user=rc.split()
 			role = user[3]
@@ -259,7 +276,7 @@
 		return ret
 
 	def genHomeDirContext(self):
-		if self.semanaged and findval(self.getHomeDirTemplate(), "ROLE", "=") != "":
+		if self.semanaged and grep(self.getHomeDirTemplate(), "ROLE") != "":
 			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()