Blame SOURCES/authconfig-6.2.8-restorecon.patch

977b74
diff -up authconfig-6.2.8/authinfo.py.restorecon authconfig-6.2.8/authinfo.py
977b74
--- authconfig-6.2.8/authinfo.py.restorecon	2014-01-29 15:21:07.000000000 +0100
977b74
+++ authconfig-6.2.8/authinfo.py	2014-01-29 15:21:32.024225923 +0100
977b74
@@ -1009,10 +1009,12 @@ class SaveGroup:
977b74
 class SafeFile:
977b74
 	def __init__(self, filename, default_mode):
977b74
 		(base, name) = os.path.split(filename)
977b74
+		self.missing = False
977b74
 		self.file = tempfile.NamedTemporaryFile(dir=base, prefix=name, delete=True)
977b74
 		# overwrite the inode attributes and contents
977b74
 		if call(["/bin/cp", "-af", filename, self.file.name],
977b74
 			stderr=os.open('/dev/null', os.O_WRONLY)) == 1:
977b74
+			self.missing = True
977b74
 			# the mode was not copied, use the default
977b74
 			os.fchmod(self.file.fileno(), default_mode)
977b74
 		self.filename = filename
977b74
@@ -1021,6 +1023,9 @@ class SafeFile:
977b74
 		self.file.flush()
977b74
 		os.fsync(self.file.fileno())
977b74
 		os.rename(self.file.name, self.filename)
977b74
+		if self.missing:
977b74
+			call(["/usr/sbin/restorecon", self.filename],
977b74
+				stderr=os.open('/dev/null', os.O_WRONLY))
977b74
 
977b74
 	def close(self):
977b74
 		# we may have renamed the temp file, need to catch OSError
977b74
@@ -1111,7 +1116,9 @@ class FileBackup:
977b74
 			rv = self.safeCopy(backuppath, self.origPath)
977b74
 
977b74
 		try:
977b74
-			os.system("restorecon '"+self.origPath+"'")
977b74
+			if rv:
977b74
+				call(["/usr/sbin/restorecon", self.origPath],
977b74
+					stderr=os.open('/dev/null', os.O_WRONLY))
977b74
 		except (IOError, OSError):
977b74
 			pass
977b74