qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] spice: Implement set_password without password


From: Michal Privoznik
Subject: [Qemu-devel] [PATCH 2/3] spice: Implement set_password without password
Date: Tue, 17 Feb 2015 17:40:46 +0100

This is quite easy. SPICE has a function to disable ticketing.
So, if no password was provided, call the function, and if a
password was provided, call another function to actually set it.

Signed-off-by: Michal Privoznik <address@hidden>
---
 ui/spice-core.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/ui/spice-core.c b/ui/spice-core.c
index c8f7f18..50e1939 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -895,13 +895,24 @@ 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) {
+    if (strcmp(auth, "spice") != 0 && strcmp(auth, "none") != 0) {
         return -1;
     }
 
     g_free(auth_passwd);
     auth_passwd = g_strdup(passwd);
-    return qemu_spice_set_ticket(fail_if_conn, disconnect_if_conn);
+
+    if (!passwd) {
+        if (spice_server_set_noauth(spice_server) < 0)
+            return -1;
+        auth = "none";
+    } else {
+        if (qemu_spice_set_ticket(fail_if_conn, disconnect_if_conn) < 0)
+            return -1;
+        auth = "spice";
+    }
+
+    return 0;
 }
 
 int qemu_spice_set_pw_expire(time_t expires)
-- 
2.0.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]