Blob Blame History Raw
Patch by Robert Scheck <robert@fedoraproject.org> for drbdlinks <= 1.19, which
fixes "ValueError: too many values to unpack" if the SELinux filesystem element
label includes range as well, e.g. "system_u:object_r:admin_home_t:s0" rather
only "system_u:object_r:admin_home_t". If you are running mcstrans daemon, you
will also maybe not see the range. As drbdlinks is also still in use on systems
with Red Hat Enterprise Linux 4, this patch should be python 2.3 compatible.

--- drbdlinks-1.19/drbdlinks			2011-05-06 01:48:53.000000000 +0200
+++ drbdlinks-1.19/drbdlinks.selinux		2011-07-09 15:32:23.000000000 +0200
@@ -328,9 +328,11 @@
 			fp.close()
 			if line:
 				line = string.split(line, ' ')[0]
-				seUser, seRole, seType = string.split(line, ':')
-				os.system('chcon -h -u "%s" -r "%s" -t "%s" "%s"'
-						% ( seUser, seRole, seType, linkLocal ))
+				seUser, seRole, seType, seRange = (string.split(line, ':') + [None] * 4)[:4]
+				if seRange:
+					os.system('chcon -h -u "%s" -r "%s" -t "%s" -l "%s" "%s"' % ( seUser, seRole, seType, seRange, linkLocal ))
+				else:
+					os.system('chcon -h -u "%s" -r "%s" -t "%s" "%s"' % ( seUser, seRole, seType, linkLocal ))
 	
 	if anyLinksChanged:
 		if restartSyslog(config): errorCount = errorCount + 1