1c3013d
Patch by Robert Scheck <robert@fedoraproject.org> for drbdlinks <= 1.19, which
1c3013d
fixes "ValueError: too many values to unpack" if the SELinux filesystem element
1c3013d
label includes range as well, e.g. "system_u:object_r:admin_home_t:s0" rather
1c3013d
only "system_u:object_r:admin_home_t". If you are running mcstrans daemon, you
1c3013d
will also maybe not see the range. As drbdlinks is also still in use on systems
1c3013d
with Red Hat Enterprise Linux 4, this patch should be python 2.3 compatible.
1c3013d
1c3013d
--- drbdlinks-1.19/drbdlinks			2011-05-06 01:48:53.000000000 +0200
1c3013d
+++ drbdlinks-1.19/drbdlinks.selinux		2011-07-09 15:32:23.000000000 +0200
1c3013d
@@ -328,9 +328,11 @@
1c3013d
 			fp.close()
1c3013d
 			if line:
1c3013d
 				line = string.split(line, ' ')[0]
1c3013d
-				seUser, seRole, seType = string.split(line, ':')
1c3013d
-				os.system('chcon -h -u "%s" -r "%s" -t "%s" "%s"'
1c3013d
-						% ( seUser, seRole, seType, linkLocal ))
1c3013d
+				seUser, seRole, seType, seRange = (string.split(line, ':') + [None] * 4)[:4]
1c3013d
+				if seRange:
1c3013d
+					os.system('chcon -h -u "%s" -r "%s" -t "%s" -l "%s" "%s"' % ( seUser, seRole, seType, seRange, linkLocal ))
1c3013d
+				else:
1c3013d
+					os.system('chcon -h -u "%s" -r "%s" -t "%s" "%s"' % ( seUser, seRole, seType, linkLocal ))
1c3013d
 	
1c3013d
 	if anyLinksChanged:
1c3013d
 		if restartSyslog(config): errorCount = errorCount + 1