Skip to contentSkip to conversation

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

PATCH Superseded Christophe Fergeau 2 participants 7 messages Aug 14, 2015

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 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
Quoted 9 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.

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

IMHO we should not be changing the authentication method as a side effect of trying to set the password.

If app has disabled ticketing, it should remain disabled and the set password call is right to return an error.

We should have a graphics-set-auth command for changing authentication parameters on existing graphics backend.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#2 lore raw

Hey,

Quoted 8 lines · Daniel P. Berrange
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 9 lines
Quoted 2 lines

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

IMHO we should not be changing the authentication method as a side effect of trying to set the password.

If app has disabled ticketing, it should remain disabled and the set password call is right to return an error.

In general I agree with you. However in this case, this used to be working until ~1 year ago, and this change of behaviour caused a bug in oVirt (oVirt side is being fixed). This is why I sent this patch.

The intent of commit b1ea7b seems to be to prevent qemu_spice_set_passwd() from being called when SASL is used, and does not mention at all whether preventing going from auth being "none" to "spice" is intentional.

If this change of behaviour was an intentional bug fix, and if we are fine with asking for oVirt changes for this, then I'm ok with dropping this patch.

Christophe

#3 lore raw
Quoted 25 lines · Christophe Fergeau

Hey,

Quoted 8 lines · Daniel P. Berrange
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 9 lines
Quoted 2 lines

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

IMHO we should not be changing the authentication method as a side effect of trying to set the password.

If app has disabled ticketing, it should remain disabled and the set password call is right to return an error.

In general I agree with you. However in this case, this used to be working until ~1 year ago, and this change of behaviour caused a bug in oVirt (oVirt side is being fixed). This is why I sent this patch.

Quoted 8 lines

The intent of commit b1ea7b seems to be to prevent qemu_spice_set_passwd() from being called when SASL is used, and does not mention at all whether preventing going from auth being "none" to "spice" is intentional.

If this change of behaviour was an intentional bug fix, and if we are fine with asking for oVirt changes for this, then I'm ok with dropping this patch.

Hmm, is oVirt using this via libvirt ? If so, I guess we have to fix it, as that would be a break in current usage.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#4 lore raw
Quoted 2 lines · Daniel P. Berrange

Hmm, is oVirt using this via libvirt ? If so, I guess we have to fix it, as that would be a break in current usage.

Yes this is done through libvirt.

Before commit qemu-2.1.0-rc2~11^2, you could use virsh update-device with
<graphics type='spice' autoport='yes' listen='127.0.0.1' passwd='bar'/> to set the password for a running domain whose graphics node is <graphics type='spice' autoport='yes' listen='127.0.0.1'/>

After qemu-2.1.0-rc2~11^2, this results in an error.

Christophe

Reviewed-by on v1 1/1
#5 lore raw
In reply to Christophe Fergeau
Quoted 9 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.

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

BTW, you need to have a Signed-of-by here

Quoted 3 lines
---
 ui/spice-core.c | 4 ++++
 1 file changed, 4 insertions(+)

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#6 lore raw
Quoted 8 lines · Daniel P. Berrange
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 4 lines
Quoted 2 lines

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

BTW, you need to have a Signed-of-by here

Ah right, thanks, just sent a v2 with this added.

Christophe