diff mbox

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

Message ID 1439565057-18889-1-git-send-email-cfergeau@redhat.com
State New
Headers show

Commit Message

Christophe Fergeau Aug. 14, 2015, 3:10 p.m. UTC
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.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
---
Changes since v1:
- added Reviewed-by and missing Signed-off-by tags


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

Comments

Christophe Fergeau Oct. 9, 2015, 4:43 p.m. UTC | #1
Hey,

On Fri, Aug 14, 2015 at 05:10:57PM +0200, Christophe Fergeau wrote:
> 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.
> 
> Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Any taker for that patch?

Thanks,

Christophe


> ---
> Changes since v1:
> - added Reviewed-by and missing Signed-off-by tags
> 
> 
>  ui/spice-core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 4da3042..3b20c6c 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -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;
>      }
> -- 
> 2.4.3
> 
>
Gerd Hoffmann Oct. 12, 2015, 7:57 a.m. UTC | #2
Hi,

> > Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
> > Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
> 
> Any taker for that patch?

please resend, with me in cc, and add to the changelog why this is
needed.

thanks,
  Gerd
diff mbox

Patch

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 4da3042..3b20c6c 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -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;
     }