From 6c45c3d8145406b221e17c6e717320848c935c9e Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 22 Mar 2012 09:58:42 +0100 Subject: [PATCH 55/55] Error out when tls-channel option is used without TLS RH-Author: Christophe Fergeau Message-id: <1332410322-8308-1-git-send-email-cfergeau@redhat.com> Patchwork-id: 38910 O-Subject: [PATCH RHEL6.3 qemu-kvm] Error out when tls-channel option is used without TLS Bugzilla: 790421 RH-Acked-by: Alon Levy RH-Acked-by: Gerd Hoffmann RH-Acked-by: Laszlo Ersek It's currently possible to setup spice channels using TLS when no TLS port has been specified (ie TLS is disabled). This cannot work, so better to error out in such a situation. Signed-off-by: Gerd Hoffmann (cherry picked from commit 35c633291439185d3bbf84da23db1572498e0d5d) Signed-off-by: Christophe Fergeau BZ: 790421 Upstream-status: committed --- ui/spice-core.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- ui/spice-core.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ui/spice-core.c b/ui/spice-core.c index adfaa85..d16610b 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -559,6 +559,12 @@ static int add_channel(const char *name, const char *value, void *opaque) int rc; if (strcmp(name, "tls-channel") == 0) { + int *tls_port = opaque; + if (!*tls_port) { + error_report("spice: tried to setup tls-channel" + " without specifying a TLS port"); + exit(1); + } security = SPICE_CHANNEL_SECURITY_SSL; } if (strcmp(name, "plaintext-channel") == 0) { @@ -720,7 +726,7 @@ void qemu_spice_init(void) #endif /* >= 0.6.0 */ - qemu_opt_foreach(opts, add_channel, NULL, 0); + qemu_opt_foreach(opts, add_channel, &tls_port, 0); if (0 != spice_server_init(spice_server, &core_interface)) { fprintf(stderr, "failed to initialize spice server"); -- 1.7.7.6