summaryrefslogtreecommitdiffstats
path: root/src/remote-viewer.c
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-03-12 17:39:47 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-03-13 15:51:58 +0100
commit1eafd0407e1e49467e2ba851e915f1962f2dec9c (patch)
treee4b6702f134dadcdeabab119fc69549f69c283de /src/remote-viewer.c
parent32d0ae09b865cfd6446b499225c895feaba27a51 (diff)
downloadvirt-viewer-1eafd0407e1e49467e2ba851e915f1962f2dec9c.tar.gz
virt-viewer-1eafd0407e1e49467e2ba851e915f1962f2dec9c.tar.xz
virt-viewer-1eafd0407e1e49467e2ba851e915f1962f2dec9c.zip
ovirt: Don't try to use invalid port numbers
If a remote oVirt VM don't specify a port/secure port number, we'd still try to pass it down to spice-gtk, which would then complain that 0 (the default value) isn't a valid port number. This commit make sure we filter out the default port/secure-port value and pass NULL to spice-gtk instead when we get these values.
Diffstat (limited to 'src/remote-viewer.c')
-rw-r--r--src/remote-viewer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 12bd912..4541515 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -916,8 +916,12 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err)
"host-subject", &host_subject,
"proxy-url", &proxy_url,
NULL);
- gport = g_strdup_printf("%d", port);
- gtlsport = g_strdup_printf("%d", secure_port);
+ if (port != 0) {
+ gport = g_strdup_printf("%d", port);
+ }
+ if (secure_port != 0) {
+ gtlsport = g_strdup_printf("%d", secure_port);
+ }
if (ghost == NULL) {
g_set_error(&error, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,