render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Daniel Veillard 4f644c
--- src/qemu_conf.c.orig	2009-05-29 19:24:59.000000000 +0200
Daniel Veillard 4f644c
+++ src/qemu_conf.c	2009-05-29 19:19:39.000000000 +0200
Daniel Veillard 4f644c
@@ -792,6 +792,20 @@ int qemudBuildCommandLine(virConnectPtr 
Daniel Veillard 4f644c
     char uuid[VIR_UUID_STRING_BUFLEN];
Daniel Veillard cdd5b3
     char domid[50];
Daniel Veillard cdd5b3
     const char *cpu = NULL;
Daniel Veillard cdd5b3
+    int skipSound = 0;
Daniel Veillard cdd5b3
+
Daniel Veillard cdd5b3
+    if (driver->securityDriver &&
Daniel Veillard cdd5b3
+        driver->securityDriver->name &&
Daniel Veillard cdd5b3
+        STREQ(driver->securityDriver->name, "selinux") &&
Daniel Veillard cdd5b3
+        getuid() == 0) {
Daniel Veillard cdd5b3
+        static int soundWarned = 0; 
Daniel Veillard cdd5b3
+        skipSound = 1;
Daniel Veillard cdd5b3
+        if (def->nsounds &&
Daniel Veillard cdd5b3
+            !soundWarned) {
Daniel Veillard cdd5b3
+            soundWarned = 1;
Daniel Veillard cdd5b3
+            VIR_WARN0("Sound cards for VMs are disabled while SELinux security model is active");
Daniel Veillard cdd5b3
+        }
Daniel Veillard cdd5b3
+    }
Daniel Veillard cdd5b3
 
Daniel Veillard cdd5b3
     uname_normalize(&ut);
Daniel Veillard cdd5b3
 
Daniel Veillard 4f644c
@@ -1429,7 +1443,8 @@ int qemudBuildCommandLine(virConnectPtr 
Daniel Veillard cdd5b3
     }
Daniel Veillard cdd5b3
 
Daniel Veillard cdd5b3
     /* Add sound hardware */
Daniel Veillard cdd5b3
-    if (def->nsounds) {
Daniel Veillard cdd5b3
+    if (def->nsounds &&
Daniel Veillard cdd5b3
+        !skipSound) {
Daniel Veillard cdd5b3
         int size = 100;
Daniel Veillard cdd5b3
         char *modstr;
Daniel Veillard cdd5b3
         if (VIR_ALLOC_N(modstr, size+1) < 0)