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 <mpriv...@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