summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-07-02 12:56:42 +0200
committerGerd Hoffmann <kraxel@redhat.com>2014-07-11 10:12:47 +0200
commitb1ea7b79e1675355ea7abe2548ad71dcf7d64b60 (patch)
treef029401d0c0e28f3e33f02fd264d56a470d1d1ff
parent9e99c5fd7060267a0331d900e73fdb36047bfe0c (diff)
downloadfocaccia-qemu-b1ea7b79e1675355ea7abe2548ad71dcf7d64b60.tar.gz
focaccia-qemu-b1ea7b79e1675355ea7abe2548ad71dcf7d64b60.zip
spice: auth fixes
Set auth to sasl when sasl is enabled, this makes "info spice" correctly
display sasl auth.  Also throw an error in case someone tries to set
a spice password via monitor without auth mode being "spice".

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--ui/spice-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 70df4460e4..7bb91e6bad 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -741,6 +741,7 @@ void qemu_spice_init(void)
             error_report("spice: failed to enable sasl");
             exit(1);
         }
+        auth = "sasl";
     }
     if (qemu_opt_get_bool(opts, "disable-ticketing", 0)) {
         auth = "none";
@@ -894,6 +895,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, "spice") != 0) {
+        return -1;
+    }
+
     g_free(auth_passwd);
     auth_passwd = g_strdup(passwd);
     return qemu_spice_set_ticket(fail_if_conn, disconnect_if_conn);