Skip to contentSkip to conversation

spice: Allow to set password even if disable-ticketing was used

PATCH Superseded Christophe Fergeau 2 participants 3 messages Aug 14, 2015 – Oct 12, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spice: Allow to set password even if disable-ticketing was used

Before commit b1ea7b79e1, it was possible to start with -spice disable-ticketing, and then use the "set_password spice" command to enable ticketing with SPICE. Since commit b1ea7b79e1 this is no longer possible as qemu_spice_set_ticket() will return an error unless the 'auth' type is "spice". When ticketing is disabled, 'auth' is "none" so the attempt to set password fails.

This commit allows to call qemu_spice_set_ticket() when 'auth' is "none" and changes 'auth' to "spice" when this happens.

---
Changes since v1:
- added Reviewed-by and missing Signed-off-by tags

 ui/spice-core.c | 4 ++++
 1 file changed, 4 insertions(+)
ui/spice-core.c +4 -0
index 4da3042..3b20c6c 100644
@@ -882,6 +882,10 @@ static int qemu_spice_set_ticket(bool fail_if_conn, bool disconnect_if_conn)
 int qemu_spice_set_passwd(const char *passwd,
                           bool fail_if_conn, bool disconnect_if_conn)
 {
+    if (strcmp(auth, "none") == 0) {
+        /* Allow to set a password when started with 'disable-ticketing' */
+        auth = "spice";
+    }
     if (strcmp(auth, "spice") != 0) {
         return -1;
     }
Signature · 1 line
2.4.3
#1 lore raw

Hey,

Quoted 7 lines · Christophe Fergeau

Before commit b1ea7b79e1, it was possible to start with -spice disable-ticketing, and then use the "set_password spice" command to enable ticketing with SPICE. Since commit b1ea7b79e1 this is no longer possible as qemu_spice_set_ticket() will return an error unless the 'auth' type is "spice". When ticketing is disabled, 'auth' is "none" so the attempt to set password fails.

Quoted 5 lines

This commit allows to call qemu_spice_set_ticket() when 'auth' is "none" and changes 'auth' to "spice" when this happens.

Any taker for that patch?

Thanks,

Christophe

Quoted 27 lines

---
Changes since v1:
- added Reviewed-by and missing Signed-off-by tags

 ui/spice-core.c | 4 ++++
 1 file changed, 4 insertions(+)
ui/spice-core.c +4 -0
index 4da3042..3b20c6c 100644
@@ -882,6 +882,10 @@ static int qemu_spice_set_ticket(bool fail_if_conn, bool disconnect_if_conn)
 int qemu_spice_set_passwd(const char *passwd,
                           bool fail_if_conn, bool disconnect_if_conn)
 {
+    if (strcmp(auth, "none") == 0) {
+        /* Allow to set a password when started with 'disable-ticketing' */
+        auth = "spice";
+    }
     if (strcmp(auth, "spice") != 0) {
         return -1;
     }
Signature · 1 line
2.4.3