]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
xenconfig: fix spicepasswd handling
authorJim Fehlig <jfehlig@suse.com>
Thu, 23 Apr 2015 22:00:45 +0000 (16:00 -0600)
committerJim Fehlig <jfehlig@suse.com>
Mon, 18 May 2015 18:46:16 +0000 (12:46 -0600)
The logic related to spicedisable_ticketing and spicepasswd was
inverted.  As per man xl.cfg(5), 'spicedisable_ticketing = 1'
means no passwd is required.  On the other hand, a passwd is
required if 'spicedisable_ticketing = 0'.  Fix the logic and
produce and error if 'spicedisable_ticketing = 0' but spicepasswd
is not provided.  Also fix the spice cfg test file.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/xenconfig/xen_xl.c
tests/xlconfigdata/test-spice.cfg

index 19a2698848d50e6578bce7d0de86a871876b749e..92c12bf3d75d7743788405255dacc028d2d8a49e 100644 (file)
@@ -192,9 +192,9 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def)
 
             if (xenConfigGetBool(conf, "spicedisable_ticketing", &val, 0) < 0)
                 goto cleanup;
-            if (val) {
-                if (xenConfigCopyStringOpt(conf, "spicepasswd",
-                                           &graphics->data.spice.auth.passwd) < 0)
+            if (!val) {
+                if (xenConfigCopyString(conf, "spicepasswd",
+                                        &graphics->data.spice.auth.passwd) < 0)
                     goto cleanup;
             }
 
@@ -697,12 +697,14 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
                 return -1;
 
             if (graphics->data.spice.auth.passwd) {
-                if (xenConfigSetInt(conf, "spicedisable_ticketing", 1) < 0)
+                if (xenConfigSetInt(conf, "spicedisable_ticketing", 0) < 0)
                     return -1;
 
-                if (graphics->data.spice.auth.passwd &&
-                    xenConfigSetString(conf, "spicepasswd",
-                                graphics->data.spice.auth.passwd) < 0)
+                if (xenConfigSetString(conf, "spicepasswd",
+                                       graphics->data.spice.auth.passwd) < 0)
+                    return -1;
+            } else {
+                if (xenConfigSetInt(conf, "spicedisable_ticketing", 1) < 0)
                     return -1;
             }
 
index b2b9742fed70f134429462cf9fa98d3d7d3ce735..d89f2bad9afba860250e4713fd82ec62b07c2ba9 100644 (file)
@@ -25,6 +25,6 @@ spice = 1
 spicehost = "127.0.0.1"
 spiceport = 590
 spicetls_port = 500
-spicedisable_ticketing = 1
+spicedisable_ticketing = 0
 spicepasswd = "thebeast"
 spiceagent_mouse = 0