2011/7/11 Oskari Saarenmaa <os(a)ohmu.fi>:
Set StrictHostKeyChecking=no to auto-accept new ssh host keys if the
no_verify extra parameter was specified. This won't disable host key
checking for already known hosts. Includes a test and documentation.
---
Thanks for the review, here's an updated patch.
docs/remote.html.in | 9 +++++++--
src/remote/remote_driver.c | 1 +
src/rpc/virnetclient.c | 3 ++-
src/rpc/virnetclient.h | 1 +
src/rpc/virnetsocket.c | 3 +++
src/rpc/virnetsocket.h | 1 +
tests/virnetsockettest.c | 22 +++++++++++++++++++---
7 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index f6c7274..e003a23 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -510,20 +513,33 @@ mymain(void)
ret = -1;
struct testSSHData sshData3 = {
+ .nodename = "somehost",
+ .service = "9000",
+ .username = "fred",
+ .netcat = "netcat",
+ .noTTY = false,
+ .noVerify = true,
+ .path = "/tmp/socket",
+ .expectOut = "-p 9000 -l fred -o StrictHostKeyChecking=no somehost netcat
-U /tmp/socket\n",
+ };
+ if (virtTestRun("SSH test 3", 1, testSocketSSH, &sshData2) < 0)
You use sshData2 in test 3, shouldn't this be sshData3?
+
+ struct testSSHData sshData4 = {
.nodename = "nosuchhost",
.path = "/tmp/socket",
.failConnect = true,
};
- if (virtTestRun("SSH test 3", 1, testSocketSSH, &sshData3) < 0)
+ if (virtTestRun("SSH test 4", 1, testSocketSSH, &sshData3) < 0)
ret = -1;
Here it should be sshData4 instead of sshData3, I think.
- struct testSSHData sshData4 = {
+ struct testSSHData sshData5 = {
.nodename = "crashyhost",
.path = "/tmp/socket",
.expectOut = "crashyhost nc -U /tmp/socket\n",
.dieEarly = true,
};
- if (virtTestRun("SSH test 4", 1, testSocketSSH, &sshData4) < 0)
+ if (virtTestRun("SSH test 5", 1, testSocketSSH, &sshData4) < 0)
ret = -1;
And here it should be sshData5 instead of sshData4, shouldn't it?
I'm squashing in this diff to fix the off-by-one problem and pushing
the result, thanks.
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index e003a23..1697ced 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -522,7 +522,7 @@ mymain(void)
.path = "/tmp/socket",
.expectOut = "-p 9000 -l fred -o StrictHostKeyChecking=no
somehost netcat -U /tmp/socket\n",
};
- if (virtTestRun("SSH test 3", 1, testSocketSSH, &sshData2) < 0)
+ if (virtTestRun("SSH test 3", 1, testSocketSSH, &sshData3) < 0)
ret = -1;
struct testSSHData sshData4 = {
@@ -530,7 +530,7 @@ mymain(void)
.path = "/tmp/socket",
.failConnect = true,
};
- if (virtTestRun("SSH test 4", 1, testSocketSSH, &sshData3) < 0)
+ if (virtTestRun("SSH test 4", 1, testSocketSSH, &sshData4) < 0)
ret = -1;
struct testSSHData sshData5 = {
@@ -539,7 +539,7 @@ mymain(void)
.expectOut = "crashyhost nc -U /tmp/socket\n",
.dieEarly = true,
};
- if (virtTestRun("SSH test 5", 1, testSocketSSH, &sshData4) < 0)
+ if (virtTestRun("SSH test 5", 1, testSocketSSH, &sshData5) < 0)
ret = -1;
#endif
I'm also adding you to the authors list.
--
Matthias Bolte
http://photron.blogspot.com