[virt-tools-list] [PATCH 3/4] Don't print incorrect port numbers
Guido Günther
agx at sigxcpu.org
Fri Aug 12 17:50:29 UTC 2011
The port isn't 22 when we connect to an alternate port given in
.ssh/config.
---
src/virt-viewer-app.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
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,
--
1.7.5.4
More information about the virt-tools-list
mailing list