|
|
e76f14 |
From bddb2e72e53439f3626656b9bd6c971eed502308 Mon Sep 17 00:00:00 2001
|
|
|
e76f14 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
e76f14 |
Date: Thu, 30 Jun 2016 13:52:43 +0100
|
|
|
e76f14 |
Subject: [PATCH] p2v: ssh: Set cooked mode on the ssh session which runs
|
|
|
e76f14 |
virt-v2v.
|
|
|
e76f14 |
|
|
|
e76f14 |
(cherry picked from commit fa6402a0f8c54397588597e3553bc05576a3863d)
|
|
|
e76f14 |
---
|
|
|
e76f14 |
p2v/ssh.c | 18 ++++++++++++------
|
|
|
e76f14 |
1 file changed, 12 insertions(+), 6 deletions(-)
|
|
|
e76f14 |
|
|
|
e76f14 |
diff --git a/p2v/ssh.c b/p2v/ssh.c
|
|
|
e76f14 |
index 270f1e5..4cae732 100644
|
|
|
e76f14 |
--- a/p2v/ssh.c
|
|
|
e76f14 |
+++ b/p2v/ssh.c
|
|
|
e76f14 |
@@ -307,7 +307,8 @@ cache_ssh_identity (struct config *config)
|
|
|
e76f14 |
* optional arguments. Also handles authentication.
|
|
|
e76f14 |
*/
|
|
|
e76f14 |
static mexp_h *
|
|
|
e76f14 |
-start_ssh (struct config *config, char **extra_args, int wait_prompt)
|
|
|
e76f14 |
+start_ssh (unsigned spawn_flags, struct config *config,
|
|
|
e76f14 |
+ char **extra_args, int wait_prompt)
|
|
|
e76f14 |
{
|
|
|
e76f14 |
size_t i, j, nr_args, count;
|
|
|
e76f14 |
char port_str[64];
|
|
|
e76f14 |
@@ -383,9 +384,9 @@ start_ssh (struct config *config, char **extra_args, int wait_prompt)
|
|
|
e76f14 |
#endif
|
|
|
e76f14 |
|
|
|
e76f14 |
/* Create the miniexpect handle. */
|
|
|
e76f14 |
- h = mexp_spawnv ("ssh", (char **) args);
|
|
|
e76f14 |
+ h = mexp_spawnvf (spawn_flags, "ssh", (char **) args);
|
|
|
e76f14 |
if (h == NULL) {
|
|
|
e76f14 |
- set_ssh_internal_error ("ssh: mexp_spawnv: %m");
|
|
|
e76f14 |
+ set_ssh_internal_error ("ssh: mexp_spawnvf: %m");
|
|
|
e76f14 |
return NULL;
|
|
|
e76f14 |
}
|
|
|
e76f14 |
|
|
|
e76f14 |
@@ -756,7 +757,7 @@ test_connection (struct config *config)
|
|
|
e76f14 |
const int ovecsize = 12;
|
|
|
e76f14 |
int ovector[ovecsize];
|
|
|
e76f14 |
|
|
|
e76f14 |
- h = start_ssh (config, NULL, 1);
|
|
|
e76f14 |
+ h = start_ssh (0, config, NULL, 1);
|
|
|
e76f14 |
if (h == NULL)
|
|
|
e76f14 |
return -1;
|
|
|
e76f14 |
|
|
|
e76f14 |
@@ -1063,7 +1064,7 @@ open_data_connection (struct config *config, int *local_port, int *remote_port)
|
|
|
e76f14 |
*local_port = nbd_local_port;
|
|
|
e76f14 |
nbd_local_port++;
|
|
|
e76f14 |
|
|
|
e76f14 |
- h = start_ssh (config, (char **) extra_args, 0);
|
|
|
e76f14 |
+ h = start_ssh (0, config, (char **) extra_args, 0);
|
|
|
e76f14 |
if (h == NULL)
|
|
|
e76f14 |
return NULL;
|
|
|
e76f14 |
|
|
|
e76f14 |
@@ -1151,7 +1152,12 @@ start_remote_connection (struct config *config, const char *remote_dir)
|
|
|
e76f14 |
{
|
|
|
e76f14 |
mexp_h *h;
|
|
|
e76f14 |
|
|
|
e76f14 |
- h = start_ssh (config, NULL, 1);
|
|
|
e76f14 |
+ /* This connection is opened in cooked mode so that we can send ^C
|
|
|
e76f14 |
+ * if the conversion needs to be cancelled. However that also means
|
|
|
e76f14 |
+ * we must be careful not to accidentally send any control
|
|
|
e76f14 |
+ * characters over this connection at other times.
|
|
|
e76f14 |
+ */
|
|
|
e76f14 |
+ h = start_ssh (MEXP_SPAWN_COOKED_MODE, config, NULL, 1);
|
|
|
e76f14 |
if (h == NULL)
|
|
|
e76f14 |
return NULL;
|
|
|
e76f14 |
|
|
|
e76f14 |
--
|
|
|
aa0300 |
2.7.4
|
|
|
e76f14 |
|