virt-viewer/virt-viewer-0.4.1-sshport3.patch

38 lines
1.3 KiB
Diff
Raw Normal View History

2011-08-14 20:57:59 +00:00
commit 60145f31a6fb2c7331101ba4ee7d25d08dd7eb48
Author: Guido Günther <agx@sigxcpu.org>
Date: Fri Aug 12 19:50:29 2011 +0200
Don't print incorrect port numbers
The port isn't 22 when we connect to an alternate port given in
.ssh/config.
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 2ad5710..c80d52f 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -635,6 +635,8 @@ virt_viewer_app_activate(VirtViewerApp *self)
if (priv->transport &&
g_strcasecmp(priv->transport, "ssh") == 0 &&
!priv->direct) {
+ gchar *p = NULL;
+
if (priv->gport) {
virt_viewer_app_trace(self, "Opening indirect TCP connection to display at %s:%s\n",
priv->ghost, priv->gport);
@@ -642,8 +644,12 @@ virt_viewer_app_activate(VirtViewerApp *self)
virt_viewer_app_trace(self, "Opening indirect UNIX connection to display at %s\n",
priv->unixsock);
}
- virt_viewer_app_trace(self, "Setting up SSH tunnel via %s@%s:%d\n",
- priv->user, priv->host, priv->port ? priv->port : 22);
+ if (priv->port)
+ p = g_strdup_printf(":%d", priv->port);
+
+ virt_viewer_app_trace(self, "Setting up SSH tunnel via %s@%s%s\n",
+ priv->user, priv->host, p ? p : "");
+ g_free(p);
if ((fd = virt_viewer_app_open_tunnel_ssh(priv->host, priv->port,
priv->user, priv->ghost,