]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Generate a valid imagelabel even for type 'none'
authorJán Tomko <jtomko@redhat.com>
Wed, 5 Feb 2014 17:34:51 +0000 (18:34 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 5 Feb 2014 18:47:30 +0000 (19:47 +0100)
Commit 2ce63c1 added imagelabel generation when relabeling is turned
off. But we weren't filling out the sensitivity for type 'none' labels,
resulting in an invalid label:

$ virsh managedsave domain
error: unable to set security context 'system_u:object_r:svirt_image_t'
on fd 28: Invalid argument

src/security/security_selinux.c

index aa47667b149564b132765870abede7f968896ab6..448f686ea2b1a1e9ed39fff8b00bdbfcbc45a40b 100644 (file)
@@ -670,7 +670,14 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
         break;
 
     case VIR_DOMAIN_SECLABEL_NONE:
-        /* no op */
+        if (virSecuritySELinuxMCSGetProcessRange(&sens,
+                                                 &catMin,
+                                                 &catMax) < 0)
+            goto cleanup;
+
+        if (VIR_STRDUP(mcs, sens) < 0)
+            goto cleanup;
+
         break;
 
     default: