All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Privoznik <mprivozn@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] spice: Implement set_password without password
Date: Tue, 17 Feb 2015 17:40:46 +0100	[thread overview]
Message-ID: <d508957670b59ab9e4f7f610948fddae55039194.1424190993.git.mprivozn@redhat.com> (raw)
In-Reply-To: <cover.1424190993.git.mprivozn@redhat.com>
In-Reply-To: <cover.1424190993.git.mprivozn@redhat.com>

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 <mprivozn@redhat.com>
---
 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

  parent reply	other threads:[~2015-02-17 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 16:40 [Qemu-devel] [PATCH 0/3] SPICE/VNC: Allow ticketing on the fly Michal Privoznik
2015-02-17 16:40 ` [Qemu-devel] [PATCH 1/3] qapi-schema: Make @password in set_password optional Michal Privoznik
2015-02-17 16:53   ` Daniel P. Berrange
2015-02-17 17:05     ` Eric Blake
2015-02-17 16:40 ` Michal Privoznik [this message]
2015-02-17 16:40 ` [Qemu-devel] [PATCH 3/3] vnc: Implement set_password without password Michal Privoznik
2015-02-18  8:29 ` [Qemu-devel] [PATCH 0/3] SPICE/VNC: Allow ticketing on the fly Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d508957670b59ab9e4f7f610948fddae55039194.1424190993.git.mprivozn@redhat.com \
    --to=mprivozn@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.