Skip to content
Snippets Groups Projects
Commit cecac4c2 authored by Guido Günther's avatar Guido Günther
Browse files

[PATCH] Don't hardcode ssh port

based on a patch by Adrian Bridgett.
Closes: #513605
parent d4a69d1f
No related branches found
No related tags found
No related merge requests found
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Fri, 30 Jan 2009 22:01:15 +0100
Subject: [PATCH] Don't hardcode ssh port
based on a patch by Adrian Bridgett.
Closes: #513605
---
src/remote_internal.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 7bf8766..d2f4397 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -353,9 +353,6 @@ doRemoteOpen (virConnectPtr conn,
} else if (transport == trans_tcp) {
port = strdup (LIBVIRTD_TCP_PORT);
if (!port) goto out_of_memory;
- } else if (transport == trans_ssh) {
- port = strdup ("22");
- if (!port) goto out_of_memory;
} else
port = NULL; /* Port not used for unix, ext. */
@@ -644,24 +641,27 @@ doRemoteOpen (virConnectPtr conn,
}
case trans_ssh: {
- int j, nr_args = 8;
+ int j, nr_args = 6;
if (username) nr_args += 2; /* For -l username */
if (no_tty) nr_args += 5; /* For -T -o BatchMode=yes -e none */
+ if (port) nr_args += 2; /* For -p port */
command = command ? : strdup ("ssh");
if (command == NULL)
goto out_of_memory;
// Generate the final command argv[] array.
- // ssh -p $port [-l $username] $hostname $netcat -U $sockname [NULL]
+ // ssh [-p $port] [-l $username] $hostname $netcat -U $sockname [NULL]
if (VIR_ALLOC_N(cmd_argv, nr_args) < 0)
goto out_of_memory;
j = 0;
cmd_argv[j++] = strdup (command);
- cmd_argv[j++] = strdup ("-p");
- cmd_argv[j++] = strdup (port);
+ if (port) {
+ cmd_argv[j++] = strdup ("-p");
+ cmd_argv[j++] = strdup (port);
+ }
if (username) {
cmd_argv[j++] = strdup ("-l");
cmd_argv[j++] = strdup (username);
--
......@@ -5,3 +5,4 @@
0005-qemu-fix-parallel-serial-mode-tcp-and-unix.patch
0006-Fix-missing-read-only-access-checks-CVE-2008-5086.patch
0007-don-t-fail-on-missing-locales.patch
0008-Don-t-hardcode-ssh-port.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment